Help Required on Getting Homebrew EmonPi Running

I am looking for some help on where to go in my EmonPi build. I have had boards made (Emonpi and LCD) from the gerbers available and assembled both boards. Both boards are the latest revision (Emonpi V1.6 and LCD V1.2).
I have programmed the Emonpi board (ATMega328) and produced an SD card image for the RPi3 successfully, so everything seems OK so far.

Note I am using a Raspberry Pi 3 board.

On powering the unit up, all seems OK and the LCD shows:

emonPi Build:
emonSD-26 Oct 17

Wifi: YES 48%
(IP Address 192.168.0.21)

Ethernet: YES
(IP Address 169.254.xxx.xxx)

Connecting… Please Wait.

My problems are:

  1. Can’t shut the Emonpi down via the shutdown button. (Is this because I am using an RPi3, and if so, how do I change the port configuration?)
  2. I have all sensors connected 2 x CT’s, DS18B20 and a 9V AC-AC voltage adaptor, but nothing is discovered on startup. (I think I have to load some Arduino sketches, but where from, and how do I load them as I am not overly familar with Arduino - although I managed to program the ATMega 328 with AVRDude?)
    3 On start up it shows Connecting… Please Wait (Connecting to what?)

Other comments
I can log in to EmonPi
I have updated both Raspbian and RPI (now on rpi-4.14.y)
I can log in to EmonCMS Local on the RPI3
I can access EmonHub (from EmonCMS)

Any assistance that can be provided would be appreciated (Located in Australia).
Regards,
Dave

it looks like all 3 issues might point to the lack of firmware on the emonpi board. The shutdown button is controlled there and the initial LCD output is controlled by the emonpi sketch as it boots faster than the Pi, once the Pi is up and running it takes over the LCD.

If you have an emonSD and the bootloader is installed to the ATmega, it should be as simple as clicking the “update emonPi” button from the admin page of emoncms and waiting. The emonPi updater always overwrites the emonpi FW so just running the update should install the FW.

The “Connecting…Please wait” message is coming from the emonPi LCD script:

The emonPi LCD script is trying to connect to MQTT. Could you check that MQTT mosquitto is up and running:

sudo service mosquitto stauts

and post the log from the emonPi LCD script:

cat /var/log/emonpilcd/emonpilcd.log

It should look like this:

pi@emonpi(ro):~$ cat /var/log/emonpilcd/emonpilcd.log 
2018-03-09 12:17:18,319 INFO Starting emonPiLCD V2.1.0
2018-03-09 12:17:18,431 INFO I2C LCD DETECTED 0x27
2018-03-09 12:17:18,885 INFO SD card image build version: emonSD-07Nov16
2018-03-09 12:17:18,890 INFO Connecting to redis server...
2018-03-09 12:17:18,900 ERROR waiting for redis-server to start...
2018-03-09 12:17:19,906 ERROR waiting for redis-server to start...
2018-03-09 12:17:20,912 ERROR waiting for redis-server to start...
2018-03-09 12:17:21,917 ERROR waiting for redis-server to start...
2018-03-09 12:17:22,923 ERROR waiting for redis-server to start...
2018-03-09 12:17:23,929 ERROR waiting for redis-server to start...
2018-03-09 12:17:24,935 ERROR waiting for redis-server to start...
2018-03-09 12:17:25,941 ERROR waiting for redis-server to start...
2018-03-09 12:17:26,947 ERROR waiting for redis-server to start...
2018-03-09 12:17:27,954 ERROR waiting for redis-server to start...
2018-03-09 12:17:28,962 INFO Connected to redis
2018-03-09 12:17:28,963 INFO Connecting to MQTT Server: 127.0.0.1 on port: 1883 with user: emonpi
2018-03-09 12:17:28,967 ERROR Could not connect to MQTT
2018-03-09 12:17:52,289 INFO Starting emonPiLCD V2.1.0
2018-03-09 12:17:52,397 INFO I2C LCD DETECTED 0x27
2018-03-09 12:17:52,861 INFO SD card image build version: emonSD-07Nov16
2018-03-09 12:17:52,863 INFO Connecting to redis server...
2018-03-09 12:17:52,872 INFO Connected to redis
2018-03-09 12:17:52,875 INFO Connecting to MQTT Server: 127.0.0.1 on port: 1883 with user: emonpi
2018-03-09 12:17:52,884 INFO Connected to MQTT

Or it could mean that no data is being received from emonhub on MQTT. Please also post emonHub log file:

sudo service emonhub restart
head /var/log/emonhub/emonhub.log -n50

Hi Paul,
apologies for the delayed response but I have been away on business during the week.
I wasn’t aware of the update Emonpi button until I scrolled down the page. I have carried out the update, so there obviously was a bootloader installed, but unfortunately it has made no difference to the issues I am experiencing. (At least I now know I have the latest ATMega FW installed).

Regards,
Dave

Hi Glyn,
apologies for the delayed response, but I have been away on business during the week.
I have tried posting the information you requested, but as I am a new user I received the following response:
Sorry, new users can only put 2 links in a post.
If you can change my status, I can post the information.

Regards,
Dave

I’ve upgraded your Trust Level. Try posting now.

How had you confirmed that if the behavior hasn’t changed? Did you check the logs? There is an emonpi update log located in ~/data and you should also check /var/log/service-runner.log too.

Thanks Robert,
Logs as per Glyn’s request:

=~=~=~=~=~=~=~=~=~=~=~= PuTTY log 2018.03.17 10:11:07 =~=~=~=~=~=~=~=~=~=~=~=
login as: pi
[email protected]'s password: 


                                                   ooooooooo.    o8o  
                                                   `888   `Y88.  `"'  
  .ooooo.  ooo. .oo.  .oo.    .ooooo.  ooo. .oo.    888   .d88' oooo  
 d88' `88b `888P"Y88bP"Y88b  d88' `88b `888P"Y88b   888ooo88P'  `888  
 888ooo888  888   888   888  888   888  888   888   888          888  
 888    .o  888   888   888  888   888  888   888   888          888  
 `Y8bod8P' o888o o888o o888o `Y8bod8P' o888o o888o o888o        o888o 


The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.

The file system is in Read Only (RO) mode. If you need to make changes, 
use the command 'rpi-rw' to put the file system in Read Write (RW) mode. 
Use 'rpi-ro' to return to RO mode. The /home/pi/data directory is always in RW mode.

pi@emonpi(ro):~$ sudo service mosquitto status
 mosquitto.service - Mosquitto MQTT Broker
   Loaded: loaded (/lib/systemd/system/mosquitto.service; enabled)
   Active: active (running) since Sat 2018-03-17 09:42:02 AEDT; 29min ago
     Docs: man:mosquitto(8)
           https://mosquitto.org/
 Main PID: 1930 (mosquitto)
   CGroup: /system.slice/mosquitto.service
           1930 /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf

Mar 17 09:42:02 emonpi systemd[1]: Started Mosquitto MQTT Broker.
pi@emonpi(ro):~$ cat /var/log/emonpilcd/emonpilcd.log
2018-03-14 08:17:20,709 INFO Starting emonPiLCD V2.1.1
2018-03-14 08:17:20,818 INFO I2C LCD DETECTED 0x27
2018-03-14 08:17:21,260 INFO SD card image build version: emonSD-26Oct17
2018-03-14 08:17:21,263 INFO Connecting to redis server...
2018-03-14 08:17:21,273 ERROR waiting for redis-server to start...
2018-03-14 08:17:22,278 ERROR waiting for redis-server to start...
2018-03-14 08:17:23,284 ERROR waiting for redis-server to start...
2018-03-14 08:17:24,289 ERROR waiting for redis-server to start...
2018-03-14 08:17:25,295 ERROR waiting for redis-server to start...
2018-03-14 08:17:26,301 INFO Connected to redis
2018-03-14 08:17:26,302 INFO Connecting to MQTT Server: 127.0.0.1 on port: 1883 with user: emonpi
2018-03-14 08:17:26,307 ERROR Could not connect to MQTT
2018-03-17 09:42:08,474 INFO Starting emonPiLCD V2.1.1
2018-03-17 09:42:08,576 INFO I2C LCD DETECTED 0x27
2018-03-17 09:42:09,038 INFO SD card image build version: emonSD-26Oct17
2018-03-17 09:42:09,040 INFO Connecting to redis server...
2018-03-17 09:42:09,048 INFO Connected to redis
2018-03-17 09:42:09,050 INFO Connecting to MQTT Server: 127.0.0.1 on port: 1883 with user: emonpi
2018-03-17 09:42:09,059 INFO Connected to MQTT
pi@emonpi(ro):~$ sudo service emonhub restart
pi@emonpi(ro):~$ head /var/log/emonhub/emonhub.log -n50
2018-03-14 08:17:21,010 INFO     MainThread EmonHub emonHub emon-pi variant v2.1.1
2018-03-14 08:17:21,011 INFO     MainThread Opening hub...
2018-03-14 08:17:21,012 INFO     MainThread Logging level set to DEBUG
2018-03-14 08:17:21,013 INFO     MainThread Creating EmonHubJeeInterfacer 'RFM2Pi' 
2018-03-14 08:17:21,017 DEBUG    MainThread Opening serial port: /dev/ttyAMA0 @ 38400 bits/s
2018-03-14 08:17:23,020 WARNING  MainThread Device communication error - check settings
2018-03-14 08:17:23,021 INFO     MainThread Setting RFM2Pi frequency: 433 (4b)
2018-03-14 08:17:24,023 INFO     MainThread Setting RFM2Pi group: 210 (210g)
2018-03-14 08:17:25,026 INFO     MainThread Setting RFM2Pi quiet: 0 (0q)
2018-03-14 08:17:26,028 INFO     MainThread Setting RFM2Pi baseid: 5 (5i)
2018-03-14 08:17:27,031 INFO     MainThread Setting RFM2Pi calibration: 230V (1p)
2018-03-14 08:17:28,033 DEBUG    MainThread Setting RFM2Pi subchannels: ['ToRFM12']
2018-03-14 08:17:28,035 DEBUG    MainThread Setting RFM2Pi pubchannels: ['ToEmonCMS']
2018-03-14 08:17:28,037 INFO     MainThread Creating EmonHubMqttInterfacer 'MQTT' 
2018-03-14 08:17:28,042 DEBUG    MainThread Setting MQTT subchannels: ['ToEmonCMS']
2018-03-14 08:17:28,043 DEBUG    MainThread Setting MQTT pubchannels: ['ToRFM12']
2018-03-14 08:17:28,044 INFO     MainThread Setting MQTT nodevar_format_enable: 1
2018-03-14 08:17:28,045 INFO     MainThread Setting MQTT node_format_enable: 1
2018-03-14 08:17:28,046 INFO     MainThread Setting MQTT nodevar_format_basetopic: emon/
2018-03-14 08:17:28,048 INFO     MainThread Creating EmonHubEmoncmsHTTPInterfacer 'emoncmsorg' 
2018-03-14 08:17:28,052 DEBUG    MainThread Setting emoncmsorg subchannels: ['ToEmonCMS']
2018-03-14 08:17:28,053 DEBUG    MainThread Setting emoncmsorg pubchannels: ['ToRFM12']
2018-03-14 08:17:28,054 INFO     MainThread Setting emoncmsorg url: https://emoncms.org
2018-03-14 08:17:28,055 INFO     MainThread Setting emoncmsorg senddata: 1
2018-03-14 08:17:28,057 WARNING  MainThread Setting emoncmsorg apikey: obscured
2018-03-14 08:17:28,058 INFO     MainThread Setting emoncmsorg sendstatus: 1
2018-03-17 09:46:24,952 DEBUG    MainThread SIGINT received.
2018-03-17 09:46:24,953 INFO     MainThread Exiting hub...
2018-03-17 09:46:25,173 INFO     MainThread Exit completed
2018-03-17 09:46:26,750 INFO     MainThread EmonHub emonHub emon-pi variant v2.1.1
2018-03-17 09:46:26,751 INFO     MainThread Opening hub...
2018-03-17 09:46:26,751 INFO     MainThread Logging level set to DEBUG
2018-03-17 09:46:26,752 INFO     MainThread Creating EmonHubJeeInterfacer 'RFM2Pi' 
2018-03-17 09:46:26,756 DEBUG    MainThread Opening serial port: /dev/ttyAMA0 @ 38400 bits/s
2018-03-17 09:46:28,759 WARNING  MainThread Device communication error - check settings
2018-03-17 09:46:28,760 INFO     MainThread Setting RFM2Pi frequency: 433 (4b)
2018-03-17 09:46:29,763 INFO     MainThread Setting RFM2Pi group: 210 (210g)
2018-03-17 09:46:30,765 INFO     MainThread Setting RFM2Pi quiet: 0 (0q)
2018-03-17 09:46:31,767 INFO     MainThread Setting RFM2Pi baseid: 5 (5i)
2018-03-17 09:46:32,769 INFO     MainThread Setting RFM2Pi calibration: 230V (1p)
2018-03-17 09:46:33,772 DEBUG    MainThread Setting RFM2Pi subchannels: ['ToRFM12']
2018-03-17 09:46:33,773 DEBUG    MainThread Setting RFM2Pi pubchannels: ['ToEmonCMS']
2018-03-17 09:46:33,774 INFO     MainThread Creating EmonHubMqttInterfacer 'MQTT' 
2018-03-17 09:46:33,778 DEBUG    MainThread Setting MQTT subchannels: ['ToEmonCMS']
2018-03-17 09:46:33,779 DEBUG    MainThread Setting MQTT pubchannels: ['ToRFM12']
2018-03-17 09:46:33,779 INFO     MainThread Setting MQTT nodevar_format_enable: 1
2018-03-17 09:46:33,780 INFO     MainThread Setting MQTT node_format_enable: 1
2018-03-17 09:46:33,781 INFO     MainThread Setting MQTT nodevar_format_basetopic: emon/
2018-03-17 09:46:33,782 INFO     MainThread Creating EmonHubEmoncmsHTTPInterfacer 'emoncmsorg' 
2018-03-17 09:46:33,784 DEBUG    MainThread Setting emoncmsorg subchannels: ['ToEmonCMS']
pi@emonpi(ro):~$

Paul,
my confirmation that nothing has changed is based on observations on the LCD screens that I am not seeing anything different than what I originally posted ie nothing that says that there are sensors connected such as the two CT’s, the DS1820B2 or the AC-AC adaptor.
In regards to your update log, I am not really familiar with the how to access the /data and I have checked /var/log/service-runner.log but all I see is a series of “update via service-runner” messages.
Apologies if I don’t understand the messages, but I am not really up on all the aspects of this system - having said that, I pick up most things fairly quickly if given some guidance.

Hi Paul,
Following are the details that I captured during the update - hopefully this will answer your question on confirmation on the ATMega FW update.

Regards,
Dave

Server Information
Emoncms Version low-write 9.8.28 : 2018.01.27
Modules Administration : App v1.1.0 : Backup v1.1.2 : EmonHub Config v1.0.0 : Dashboard v1.1.1 : EventProcesses : Feed : Graph v1.2.0 : Input : postprocess : CoreProcess : Schedule : setup : Time : User : Visualisation : WiFi v1.0.0
Buffer loading…
Writer Daemon is running with sleep 60s
Server OS Linux 4.14.24-v7+
Host emonpi emonpi (127.0.1.1)
Date 2018-03-14 06:47:06 AEDT
Uptime 06:47:06 up 14 min, 1 user, load average: 1.04, 1.04, 0.72
HTTP Server Apache/2.4.10 (Raspbian) HTTP/1.1 CGI/1.1 80
MySQL Version 5.5.59-0+deb8u1
Host localhost (127.0.0.1)
Date 2018-03-14 06:47:05 (UTC 11:00??)
Stats Uptime: 229560 Threads: 3 Questions: 1487 Slow queries: 0 Opens: 58 Flush tables: 1 Open tables: 51 Queries per second avg: 0.006
Redis Version 2.8.17
Host localhost:6379 (127.0.0.1)
Size 7 keys (528.65K)
Uptime 0 days
MQTT Version 1.4.14
Host localhost:1883 (127.0.0.1)
Pi CPU Temp 48.85°C
Release emonSD-26Oct17
File-system Set root file-system temporarily to read-write, (default read-only)
Memory RAM Used: 20.41% Total: 976.77 MB Used: 199.38 MB Free: 777.39 MB
Disk Mount Stats
/ Used: 67.63% Total: 3.33 GB Used: 2.25 GB Free: 938.82 MB
/boot Used: 37.30% Total: 59.95 MB Used: 22.36 MB Free: 37.59 MB
/home/pi/data Used: 0.92% Total: 3.46 GB Used: 32.65 MB Free: 3.25 GB
PHP Version 5.6.33-0+deb8u1 (Zend Version 2.6.0)
Modules apache2handler : bcmath : bz2 : calendar : Core v5.6.33-0+deb8u1 : ctype : curl : date v5.6.33-0+deb8u1 : dba : dio v0.0.4RC4 : dom v20031129 : ereg : exif v1.4 : fileinfo v1.0.5 : filter v0.11.0 : ftp : gettext : hash v1.0 : iconv : json v1.3.6 : libxml : mbstring : mcrypt : mhash : mosquitto v0.3.0 : mysql v1.0 : mysqli v0.1 : openssl : pcre : PDO v1.0.4dev : pdo_mysql v1.0.2 : Phar v2.0.2 : posix : readline v5.6.33-0+deb8u1 : redis v2.2.7 : Reflection : session : shmop : SimpleXML v0.1 : soap : sockets : SPL v0.2 : standard v5.6.33-0+deb8u1 : sysvmsg : sysvsem : sysvshm : tokenizer v0.1 : wddx : xml : xmlreader v0.1 : xmlwriter v0.1 : Zend OPcache v7.0.6-devFE : zip v1.12.5 : zlib v2.0 :

Client Information
HTTP Browser Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko
Screen Resolution 1366 x 768
Window Size 1366 x 643

RFM69Pi is populated with RFM69CW module not RFM12B before running RFM69Pi update: Identifying different RF Modules.

emonPi Update emonBase Update

Download Log

Filesystem is unlocked - Write access
type ' rpi-ro ' to lock
I2C LCD DETECTED Ox27
Starting emonPi Update >
via service-runner-update.sh
Service Runner update script V1.0.0
EUID: 1000
Argument: emonpi
Wed 14 Mar 06:47:39 AEDT 2018
#############################################################

emonSD version: emonSD-26Oct17

emonSD base image check passed...continue update

#############################################################
Filesystem is unlocked - Write access
type ' rpi-ro ' to lock
git pull /home/pi/emonpi
* master
  wifiap
On branch master
Your branch is up-to-date with 'origin/master'.
Untracked files:
  (use "git add ..." to include in what will be committed)

	1
	hardware/emonpi/emonpi2c/

nothing added to commit but untracked files present (use "git add" to track)
Already up-to-date.
git pull /home/pi/RFM2Pi
* master
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
Already up-to-date.
git pull /home/pi/emonhub
  K0den-wibeee_interface
* emon-pi
  hmm01i-syslogging
On branch emon-pi
Your branch is up-to-date with 'origin/emon-pi'.
nothing to commit, working directory clean
Already up-to-date.
git pull /home/pi/oem_openHab
* master
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
Already up-to-date.
git pull /home/pi/usefulscripts
* master
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
Already up-to-date.
git pull /home/pi/huawei-hilink-status
* master
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
Already up-to-date.

Start emonPi Atmega328 firmware update:

=================================
EmonPi update started
=================================

EUID: 1000

Requirement already up-to-date: paho-mqtt in /usr/local/lib/python2.7/dist-packages
Stopping OpenEnergyMonitor emonHub: emonhub has been stopped ok.
Start ATmega328 serial upload using avrdude with latest.hex
Discrete Sampling
avrdude -c arduino -p ATMEGA328P -P /dev/ttyAMA0 -b 115200 -U flash:w:/home/pi/emonpi/firmware/compiled/latest.hex
avrdude-original: Using autoreset DTR on GPIO Pin 7
Starting OpenEnergyMonitor emonHub: emonhub has been started ok.
[email protected] ../node_modules/node-red-node-emoncms


Start emonhub update script:

=================================
EmonPi update started
=================================
Running emonhub automatic node addition script
EUID: 1000
EUID: 1000
[[5]]
Node 5 already present
[[6]]
Node 6 already present
[[7]]
Node 7 already present
[[8]]
Node 8 already present
[[9]]
Node 9 already present
[[10]]
Node 10 already present
[[11]]
Node 11 already present
[[12]]
Node 12 already present
[[13]]
Node 13 already present
[[14]]
Node 14 already present
[[19]]
Node 19 already present
[[20]]
Node 20 already present
[[21]]
Node 21 already present
[[22]]
Node 22 already present
[[23]]
Node 23 already present
[[24]]
Node 24 already present
[[25]]
Node 25 already present
[[26]]
Node 26 already present

Start emoncms update:

=================================
Emoncms update started
Emoncms update script V1.1.1

Wed 14 Mar 06:49:06 AEDT 2018

#############################################################

emonSD version: emonSD-26Oct17

emonSD base image check pass...continue update

#############################################################
EUID: 1000
Checking cron tab for service runner entry...
service runner crontab entry already installed

current settings.php md5: a828cb3e3c9f015e348d86defd1a5d53
Default settings.php md5: a828cb3e3c9f015e348d86defd1a5d53

git pull /var/www/emoncms
  dev-mosquitto-php
  master
* stable
  symlinked_modules
On branch stable
Your branch is up-to-date with 'origin/stable'.
nothing to commit, working directory clean
Already up-to-date.

NEW default settings.php md5: a828cb3e3c9f015e348d86defd1a5d53
settings.php has NOT been user modifed
settings.php not updated


git pull /var/www/emoncms/Modules/app
  9.0
* stable
On branch stable
Your branch is up-to-date with 'origin/stable'.
nothing to commit, working directory clean
Already up-to-date.
Your branch is up-to-date with 'origin/stable'.

git pull /var/www/emoncms/Modules/config
  9.0
* stable
On branch stable
Your branch is up-to-date with 'origin/stable'.
nothing to commit, working directory clean
Already up-to-date.
Your branch is up-to-date with 'origin/stable'.

git pull /var/www/emoncms/Modules/wifi
  9.0
* stable
On branch stable
Your branch is up-to-date with 'origin/stable'.
nothing to commit, working directory clean
Already up-to-date.
Your branch is up-to-date with 'origin/stable'.
git pull /var/www/emoncms/Modules/dashboard
On branch stable
Your branch is up-to-date with 'origin/stable'.
nothing to commit, working directory clean
Already up-to-date.
Your branch is up-to-date with 'origin/stable'.

git pull /var/www/emoncms/Modules/graph
  master
* stable
On branch stable
Your branch is up-to-date with 'origin/stable'.
nothing to commit, working directory clean
Already up-to-date.
Your branch is up-to-date with 'origin/stable'.

git pull /home/pi/postprocess
Your branch is up-to-date with 'remotes/origin/emonpi'.
Already up-to-date.
git pull /home/pi/backup
  master
* stable
On branch stable
Your branch is up-to-date with 'origin/stable'.
nothing to commit, working directory clean
Already up-to-date.
Your branch is up-to-date with 'origin/stable'.

update mqtt_input systemd unit file

Update Emoncms database
[]

Restarting Services...
Restarting OpenEnergyMonitor emonHub: emonhub has been restarted ok.
Log is turned off
Restarting feedwriter

Restarting openhab (via systemctl): openhab.service.

 
Filesystem is unlocked - Write access
type ' rpi-ro ' to lock
I2C LCD DETECTED Ox27
Starting emonPi Update >
via service-runner-update.sh
Service Runner update script V1.0.0
EUID: 1000
Argument: emonpi
Wed 14 Mar 06:47:39 AEDT 2018
#############################################################

emonSD version: emonSD-26Oct17

emonSD base image check passed...continue update

#############################################################
Filesystem is unlocked - Write access
type ' rpi-ro ' to lock
git pull /home/pi/emonpi
* master
  wifiap
On branch master
Your branch is up-to-date with 'origin/master'.
Untracked files:
  (use "git add ..." to include in what will be committed)

	1
	hardware/emonpi/emonpi2c/

nothing added to commit but untracked files present (use "git add" to track)
Already up-to-date.
git pull /home/pi/RFM2Pi
* master
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
Already up-to-date.
git pull /home/pi/emonhub
  K0den-wibeee_interface
* emon-pi
  hmm01i-syslogging
On branch emon-pi
Your branch is up-to-date with 'origin/emon-pi'.
nothing to commit, working directory clean
Already up-to-date.
git pull /home/pi/oem_openHab
* master
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
Already up-to-date.
git pull /home/pi/usefulscripts
* master
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
Already up-to-date.
git pull /home/pi/huawei-hilink-status
* master
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
Already up-to-date.

Start emonPi Atmega328 firmware update:

=================================
EmonPi update started
=================================

EUID: 1000

Requirement already up-to-date: paho-mqtt in /usr/local/lib/python2.7/dist-packages
Stopping OpenEnergyMonitor emonHub: emonhub has been stopped ok.
Start ATmega328 serial upload using avrdude with latest.hex
Discrete Sampling
avrdude -c arduino -p ATMEGA328P -P /dev/ttyAMA0 -b 115200 -U flash:w:/home/pi/emonpi/firmware/compiled/latest.hex
avrdude-original: Using autoreset DTR on GPIO Pin 7
Starting OpenEnergyMonitor emonHub: emonhub has been started ok.
[email protected] ../node_modules/node-red-node-emoncms


Start emonhub update script:

=================================
EmonPi update started
=================================
Running emonhub automatic node addition script
EUID: 1000
EUID: 1000
[[5]]
Node 5 already present
[[6]]
Node 6 already present
[[7]]
Node 7 already present
[[8]]
Node 8 already present
[[9]]
Node 9 already present
[[10]]
Node 10 already present
[[11]]
Node 11 already present
[[12]]
Node 12 already present
[[13]]
Node 13 already present
[[14]]
Node 14 already present
[[19]]
Node 19 already present
[[20]]
Node 20 already present
[[21]]
Node 21 already present
[[22]]
Node 22 already present
[[23]]
Node 23 already present
[[24]]
Node 24 already present
[[25]]
Node 25 already present
[[26]]
Node 26 already present

Start emoncms update:

=================================
Emoncms update started
Emoncms update script V1.1.1

Wed 14 Mar 06:49:06 AEDT 2018

#############################################################

emonSD version: emonSD-26Oct17

emonSD base image check pass...continue update

#############################################################
EUID: 1000
Checking cron tab for service runner entry...
service runner crontab entry already installed

current settings.php md5: a828cb3e3c9f015e348d86defd1a5d53
Default settings.php md5: a828cb3e3c9f015e348d86defd1a5d53

git pull /var/www/emoncms
  dev-mosquitto-php
  master
* stable
  symlinked_modules
On branch stable
Your branch is up-to-date with 'origin/stable'.
nothing to commit, working directory clean
Already up-to-date.

NEW default settings.php md5: a828cb3e3c9f015e348d86defd1a5d53
settings.php has NOT been user modifed
settings.php not updated


git pull /var/www/emoncms/Modules/app
  9.0
* stable
On branch stable
Your branch is up-to-date with 'origin/stable'.
nothing to commit, working directory clean
Already up-to-date.
Your branch is up-to-date with 'origin/stable'.

git pull /var/www/emoncms/Modules/config
  9.0
* stable
On branch stable
Your branch is up-to-date with 'origin/stable'.
nothing to commit, working directory clean
Already up-to-date.
Your branch is up-to-date with 'origin/stable'.

git pull /var/www/emoncms/Modules/wifi
  9.0
* stable
On branch stable
Your branch is up-to-date with 'origin/stable'.
nothing to commit, working directory clean
Already up-to-date.
Your branch is up-to-date with 'origin/stable'.
git pull /var/www/emoncms/Modules/dashboard
On branch stable
Your branch is up-to-date with 'origin/stable'.
nothing to commit, working directory clean
Already up-to-date.
Your branch is up-to-date with 'origin/stable'.

git pull /var/www/emoncms/Modules/graph
  master
* stable
On branch stable
Your branch is up-to-date with 'origin/stable'.
nothing to commit, working directory clean
Already up-to-date.
Your branch is up-to-date with 'origin/stable'.

git pull /home/pi/postprocess
Your branch is up-to-date with 'remotes/origin/emonpi'.
Already up-to-date.
git pull /home/pi/backup
  master
* stable
On branch stable
Your branch is up-to-date with 'origin/stable'.
nothing to commit, working directory clean
Already up-to-date.
Your branch is up-to-date with 'origin/stable'.

update mqtt_input systemd unit file

Update Emoncms database
[]

Restarting Services...
Restarting OpenEnergyMonitor emonHub: emonhub has been restarted ok.
Log is turned off
Restarting feedwriter

Restarting openhab (via systemctl): openhab.service.


set log rotate config owner to root
Restarting Services...


Starting emonPi LCD service..

Filesystem is locked - Read Only access
type ' rpi-rw ' to unlock
Wed 14 Mar 06:50:02 AEDT 2018


...................
emonPi update done

Can you clarify exactly what hardware you have?

I thought we were talking about a “homebrew emonpi” but now you are talking about a “RFM69Pi” I’m not sure what we have here.

You must use the correct “update emonpi” or “update emonbase” button, which one depends on 2 things, what hardware you actually have and whether you want that to be over written or not.

See Update EmonPi Button or Update EmonBase Button?

The logs you provide do not show anything to confirm success or failure of the FW upload, I believe these error might land in another log file called /var/log/service-runner.log if there are any errors, but I cannot be 100% sure.

See Errors not reported in emonpiupdate.log file

If this is a RFM69Pi or indeed an uncased emonPi can you tell us what’s going on with the on-board LED as that may give us some clues to.

Does this homebrew device have a 6pin FTDI header to connect a serial usb programmer? How did you install the original bootloader and sketch? What did you install?

Paul,
To answer your questions:
Hardware:
I have had boards made (Emonpi and LCD) from the gerbers available and assembled both boards. Both boards are the latest revision (Emonpi V1.6 and LCD V1.2).

Note I am using a Raspberry Pi 3 board.
I installed an RFM69 module on the EmonPi board because they were very cheap and just in case I used it down the track.
In regards to the word homebrew in the title, I never used that word and was apparently changed, but if the gerbers were correct, it is definitely not a homebrew system and for all intents and purposes it should be an EmonPi (V1.6) board. It is effectively an uncased EmonPi.
In regards to the onboard LED on the EmonPi board, it is lit and a steady light, and as it connected to D9 on the ATMega 328P chip, I assume it means that there is probably software running to set D9 to light the led (?).
In regards to the board (not a homebrew!) , yes, it does have a 6 pin header but I programmed the ATMega chip using an Arduino Uno using the method described in various articles and using AVRDude. My recollection is that the messages I received did indicate a successful load, but I can’t recall the actual message/s.
The S/W I installed was latest.hex from the Github repository.
I can’t help but think that some of the issues experienced may relate to using an RPi3, but I have no real grounds to base this on, and it is just a hunch.

One other point is that the red led on the RPI3 flashes in a regular pattern and the adjacent green led flashes occasionally.

Hope this information can assist you in resolving the issues, and thanks for your interest.

Regards,
Dave

Although I didn’t change the title myself, I would have to say that is accurate and most informative. The term “homebrew” is word play on the term “homemade” from the world of beer making, to stick with beer, if you got hold of Heineken’s recipe and made your own to the same exacting standards, it would still be “homebrew”. It is not used here as a derogatory term, it simply states the fact it has not come through the usual channels.

This is important because a “homebrew” emonpi may have slight differences in components or build quality of the PCB or assembly. It will not have been inspected or tested by a familiar eye, there are many places that differences can creep in that can be initially ruled out if it was shop sourced, eg we would know that the correct bootloader was installed and that it passed testing after the firmware was installed.

My confusion was not due to the term homebrew but due to the use of both the “emonpi” and “rfm69pi” terms. I now understand it is a emonPi.

I’m still left to assume what method and FW you used. I guess you mean the Uno was used as a parallel programmer using the 2x3pin header on the emonpi board? The “latest.hex” in the Github repository won’t contain a bootloader as it is usually installed via the serial port and that is only made possible by the installation of the bootloader, so for that you most likely need the “latest_bootloader.hex”. Do not worry that it is 2yrs old, the emonpi update will overwrite the FW part once your up and running, it’s the bootloader part that is not included in the “latest.hex” that we need here.

I see no reason to suspect it has anything to do with being a PI 3, all the emonpi’s have been Pi 3 for a substantial time now, only the very first couple of batches were Pi 2.

Moving forward the best thing to do it to reinstall the hex and take note of any output good or bad in case there are any further issues. If you have a usb-serial programmer you could test the emonpi board off the Pi via the 1x6pin header which would help you if you knew you were fitting a board that was confirmed as working.

Paul, the issue of homebrew doesn’t worry me at all, and I just wanted to make it clear that it wasn’t a deviation in design of the original board, and I accept your point about quality control of components etc. Also I do see why there needs to be some differentiation with a commercial product.
I think you are hitting on the issue of why I can’t get it working so I appreciate your efforts in assisting me.

I have reloaded both the bootloader and the EmonPi firmware using an Arduino UNO as the ISP and I think I can see a likely problem and its due to my lack of experience in Arduino programming. I think it possibly relates to the parameters I used for both bootloader and firmware using avrdude.
I see from the responses using avrdude, that I again erased the chip when I loaded the EmonPi firmware and probably removing the bootloader. Would this be the problem, or can you see anything else I may have done wrong?
(BTW, I used an earlier bootloader rather than the latest_bootloader.hex that I wasn’t aware of until your response above).

See below:

Loading Bootloader.hex

C:avrdude -P com1 -b 19200 -c avrisp -p m328P -u -U flash:w:c:\bootloader.hex:i

avrdude: AVR device initialized and ready to accept instructions

Reading : ################################################## : 100% 0.10s

avrdude : Device signature = 0x1e950f
avrdude : NOTE: FLASH memory has been specified, an erase cycle will be performed

           To disable this feature, specify the -D option.
avrdude : erasing chip
avrdude : reading input file "c:bootloader.hex
avrdude : writing flash (32768 bytes)

Writing : #########################################

avrdude : 32768 bytes of flash written
avrdude : verifying flash memory against c:\bootloader.hex
avrdude : load data flash data from input file c:\bootloader.hex
avrdude : input file c:\bootloader.hex contains 32768 bytes
avrdude : reading on-chip flash data:

Reading : #################################################### : 100% 22.47s

avrdude : verifying ...
avrdude : 32768 bytes of flash verified
avrdude done.  Thank you.

Loading Latest.hex

C:avrdude -P com1 -b 19200 -c avrisp -p m328P -u -U flash:w:c:\latest.hex:i

avrdude: AVR device initialized and ready to accept instructions

Reading : ################################################## : 100% 0.1s

avrdude : Device signature = 0x1e950f
avrdude : NOTE: FLASH memory has been specified, an erase cycle will be performed

           To disable this feature, specify the -D option.
avrdude : erasing chip
avrdude : reading input file "c:latest.hex
avrdude : writing flash (19554 bytes)

Writing : #########################################

avrdude : 19554 bytes of flash written
avrdude : verifying flash memory against c:\latest.hex
avrdude : load data flash data from input file c:\latest.hex
avrdude : input file c:\latest.hex contains 19554 bytes
avrdude : reading on-chip flash data:

Reading : #################################################### : 100% 14.41s
avrdude : verifying ...
avrdude : 19554 bytes of flash verified
avrdude done.  Thank you.

Appreciate your guidance on this issue.

Regards,
Dave

Hi Dave

I’m not overly familiar with this but I suspect the issue might be that you are flashing the AVR with a FW that includes a bootloader, then reflashing with a FW with out a bootloader. The erase in between isn’t the issue directly because you should always do a delete cycle to ensure the old FW doesn’t “show though” to the new FW, eg if the second FW was 1k smaller, the last 1k of the old FW would still be thre after reflashing. Not deleting will not retain the bootloader from the first flash.

If the latest.hex is from the emonpi repo’s it is intended to be flashed via the serial upload method provided by the bootloader, it doesn’t have a bootloader because you are using the existing bootloader to upload the non-bootloader FW after the bootloader (first 2k I think).

You just need to flash a bootloader FW via ISP and leave it at that. The emonPi updater will take care of the rest. Alternatively, you can use a serial to USB programmer on the 1x6pin header and install the latest.hex via serial, it you want to test it fully before assembly.

1 Like

Hi Paul,
after much testing I agree with you that the issue is with the FW on the Atmega 328 on the EmonPi board. I think the loading method via the Arduino UNO as the ISP via the ISP1 socket is the issue, so I will try using the serial port. Can you give me some guidance on how I use the serial port i.e. what can I use to download the bootloader hex file and how do I use the reset pin - do I toggle it (which I think I need to do)? BTW, I have looked through the various posts, but have been unable to find anything revelant.

Regards,
Dave

The whole idea of using the serial port is to simplify the uploading of FW making it much more user friendly, so hopefully you won’t need to be playing with the reset line directly unless you choose to try and do this via a Pi’s GPIO that’s not running an emonSD, but even then there is a utility you can install.

This ability to upload FW over serial is provided by the bootloader!

To be able to upload over serial you must first install “the bootloader” using a ISP eg “Arduino UNO as the ISP”

The bootloader has not changed in several years (to my knowledge), the difference between different versions of the emonPi’s bootloader.hex or bootloader_latest.hex etc is not a change to the bootloader but a different FW above the same bootloader. Think of those files as “original_bootloader_with_older_firmware.hex” and “original_bootloader_with_nwer_firmware.hex”.

So when you have successfully installed one of those via ISP (I don’t think it matters which because neither is the latest FW) you will have the bootloader in place to overwrite the older FW via serial.

At this point you can simply use the 6pin FTDI header from here on in.

You can (should you choose) plug in a usb-serial programmer, connect it to a PC and install any sketch via the Arduino IDE, eg Blink.ino or indeed the emonPi src.ino.

However there is no NEED to do that as the emonSD is configured to update the emonpi board FW over serial whenever the emonPi update routine is run.

As long as you have that bootloader in place, you are good, the emonpi updater can take it from there.

If you want to experiment or learn about programming and Arduino (which the emonpi board is essentially) and manually using the reset line you might be better looking at the Arduino forum or there will be literally hundreds of blog posts out there you can read up on it. It is not documented here because you don’t need to that info to use a usb-serial device and the method we use via the Pi’s GPIO serial port uses a utility by Dean Mao called avrdude-rpi, the development of which he documented at http://www.deanmao.com/2012/08/12/fixing-the-dtr-pin/ if you want to know the nitty gritty.

I would recommend just installing the bootloader_latest.hex" via your “Arduino as ISP” then plug in a usb-serial adapter and see if you get any serial output from the emonpi board using the Arduino IDE. Assuming you do, connect it up to the emonpi and try running the emonpi updater.

Hi
I built emonPi from gerber files, too.
i have exact same problem and i programmed using an ISP Programmer and then used update option on emoncms but still no change in behaviour.
still shutdown button doesn’t work and i connected every sensor but none of them are recognized and LCD shows connecting… please wait
i also checked mosquitto MQTT and its active.
what should i do?

Can you please describe the issue you have, giving any detail you can and what you have tried.

If you do indeed “have exact same problem” then the fix is already there for you, otherwise we will need to know more.

Have you power cycled the emonpi since adding the sensors? they are only recognised at start-up (of the emonpi board not the Pi).

That suggests the emonpi board IS working.

Hi Paul,
after a long delay due to family, work and a lot of travel (plus some frustration with lack of progress causing me to give up for a while), I have been working on the “connecting… please wait” issue and this is my progress to date:
You recall that I had boards made using the gerbers provided on Github, which I assume are the same as your commercial boards (same as Amir?). I have been over the boards as much as I can and haven’t found any obvious issue - the boards were made by a company that has produced other boards for me with no issues.
Could there be a small difference in the gerbers between the boards I found on Github and yours?
How can I check? - I realise that you don’t want to do a comparison, but I would be happy to do a comparison if you were able to supply your gerbers. I accept that you may not want to, and this is OK with me.

I have also built a second Emonpi board with just the basic Arduino components and there is no difference in result.
I have also obtained a USBASP and have programmed both boards with the test sketches I have found on the Raspi software and the results are as follows:
Blink_Led - works OK and led blinks 5 secs on/5 secs off

Pi_shutdown_LCD - short press and I get the LCD message Raspberry Pi Booting
Long press and I get the count down 5 to 0 and the LCD shows SHUTDOWN.

DS18B20 Test Sketch - doesn’t work (nothing on LCD).

Pi Shutdown_button_test - doesn’t work (nothing on LCD)

So, from these tests it appears that the EmonPi is able to load software and function, so I don’t now believe it is an EmonPi s/w load issue.

I have also loaded the latest software emonpi Build - EmonSD-13Jun18 and no change in behavior
(didn’t think it would, but tried anyway).
I have also ran the Emonpi update with no obvious issues.
(BTW, printout of the emoncms below - Seems to be connecting to MQTT OK)

View last entries on the logfile:/var/log/emoncms.log

Auto refresh Download Log Copy to clipboard
2018-08-05 05:18:04.246|WARN|phpmqtt_input.php|Not connected, retrying connection
2018-08-05 05:18:04.321|WARN|phpmqtt_input.php|Connecting to MQTT server: Connection Accepted.: code: 0

So, I really don’t know where to go from here, and there is a common issue between myself and Amir’s, and this is we have both had boards made from your Github-published gerbers.
Do you have any other diagnostic software I could try, or what else should we try to overcome the issues? - happy to work with you online or offline (I can Skype at a mutually convenient time if you want to).

Alternatively if there is another Australian reading this post (and preferably lives in Sydney) I could communicate with them, and try to resolve the issues.
Either way, it would be good to close out this issue if others have similar problems down the track.

Paul, in your response to Amir, you said "the fix is already there for you - can you elaborate on what you mean?

As a side issue, I found that the red led on the RPi3 was either flickering or stayed on, and on researching this, I see it relates to a low voltage issue and changing the USB cable for a heavier cable seems to have cured this problem - I don’t think it was the cause but worth including anyway.

Regards,
Dave