Well almost; I now have four EmonTx communicating to my emonPi via Raspberry Pi Zeros; I have recreated the Inputs & Feeds etc, just need to re-build my Dashboards and Apps now.
For future reference, I have attached a “How-To for Dummies” that I have cobbled together, in case it help others if they struggle as much as I do.
In hindsight, I found the process as fascinating as it was frustrating, but I have learnt a lot in the process. Words like sketch, Arduino, avrdude and miniterm are now familiar, even if what they do isn’t always …
Looks good. I have just noticed on one of the photos, the internal serial breakout (JP3). You could have put a header on that and connected up so no external cable!
The UART connector is specifically for the programmer, the screw terminals are specifically for I/O, such as the temperature sensor and pulse input.
If you want the nitty-gritty details, take a look at the circuit diagram (ideally, you need to download and install Eagle CAD (free for personal use with the size of PCB we use) then you can see the same track highlighted on the pcb and on the circuit diagram.
@haffle, @Robert.Wall, I think I have worked out why the writing of the firmware from the RPi directly didn’t work. The utility is using Python not Python3.
Thanks @borpin ; pressing the Reset button didn’t kick the Inputs in to life, so I powered the Pi Zero down through the EmonCMS / Admin page, waited a bit then powered both bits down and back on again. But that too has not cleared it.
There is always a chance that it is a physical issue - jumper lead coming dislodged etc, but that seems unlikely as the unit is screwed on to a purlin high up in a rodent / bird / cat free barn in close proximity to an Apple Airport Express.
As far as I can tell, the emonTx sends to the serial port nothing outside the range [0x0a, 0x0d, 0x20-0x7f] and I think those characters lie wholly within the utf-8 character set.
If the baud rate has become wrong for an unknown reason, then I cannot predict how characters within the utf-8 set will be interpreted, but it’s feasible that the result of a wrongly interpreted character could well fall outside the utf-8 character set.
Thanks All. I’m afraid the stacksverflow.com thread is above my knowledge so haven’t changed any code. If this PiZero / emonTx is producing a duff character I wonder why the other three aren’t? They were all set up following the same steps.
Meanwhile, this is the current emonHub output:
2020-11-07 09:37:33,385 INFO MainThread Setting MQTT node_JSON_enable: 1
2020-11-07 09:37:33,397 INFO MainThread Creating EmonHubEmoncmsHTTPInterfacer 'emoncmsorg'
2020-11-07 09:37:33,401 DEBUG MainThread Setting emoncmsorg pubchannels: ['ToRFM12']
2020-11-07 09:37:33,403 DEBUG MainThread Setting emoncmsorg subchannels: ['ToEmonCMS']
2020-11-07 09:37:33,404 WARNING MainThread Setting emoncmsorg apikey: obscured
2020-11-07 09:37:33,406 INFO MainThread Setting emoncmsorg url: https://emoncms.org
2020-11-07 09:37:33,408 INFO MainThread Setting emoncmsorg senddata: 1
2020-11-07 09:37:33,420 INFO MainThread Setting emoncmsorg sendstatus: 1
2020-11-07 09:41:35,600 INFO MainThread Logging level set to INFO
2020-11-07 09:41:40,898 INFO MainThread Logging level set to DEBUG
2020-11-07 09:41:40,913 DEBUG MainThread Setting MQTT timestamped: True
2020-11-07 09:41:58,925 DEBUG MainThread Signal 15 received.
2020-11-07 09:41:59,051 INFO MainThread Exiting hub...
2020-11-07 09:41:59,330 INFO MainThread Exit completed
2020-11-07 09:42:11,951 INFO MainThread EmonHub emonHub (emon-pi variant) v2.1.5
2020-11-07 09:42:11,954 INFO MainThread Opening hub...
2020-11-07 09:42:11,956 INFO MainThread Logging level set to DEBUG
2020-11-07 09:42:11,958 INFO MainThread Creating EmonHubTx3eInterfacer 'SerialTx'
2020-11-07 09:42:11,968 DEBUG MainThread Opening serial port: /dev/ttyAMA0 @ 115200 bits/s
2020-11-07 09:42:11,983 INFO MainThread Creating EmonHubMqttInterfacer 'MQTT'
2020-11-07 09:42:11,989 DEBUG MainThread Setting MQTT timestamped: True
2020-11-07 09:42:12,000 DEBUG MainThread Setting MQTT subchannels: ['ToEmonCMS']
2020-11-07 09:42:12,002 INFO MainThread Setting MQTT node_JSON_enable: 1
2020-11-07 09:42:12,011 INFO MainThread Creating EmonHubEmoncmsHTTPInterfacer 'emoncmsorg'
2020-11-07 09:42:12,014 DEBUG MainThread Setting emoncmsorg pubchannels: ['ToRFM12']
2020-11-07 09:42:12,016 DEBUG MainThread Setting emoncmsorg subchannels: ['ToEmonCMS']
2020-11-07 09:42:12,018 WARNING MainThread Setting emoncmsorg apikey: obscured
2020-11-07 09:42:12,040 INFO MainThread Setting emoncmsorg url: https://emoncms.org
2020-11-07 09:42:12,042 INFO MainThread Setting emoncmsorg senddata: 1
2020-11-07 09:42:12,044 INFO MainThread Setting emoncmsorg sendstatus: 1
I am able to interact with the emonHub (& emonCMS etc) fine, so comms at a certain level are working, but the emonHub log suggests that the process(es) just get stuck after a short period following a soft Re-Start. No data has arrived on my emonPi’s emonCMS.
I may have missed something, but it is; I have just logged back in and the EmonHub log of the PiZero in question is still the same as earlier today (see above). Clicking Restart brings up the same return.
2020-11-07 09:42:12,042 INFO MainThread Setting emoncmsorg senddata: 1
2020-11-07 09:42:12,044 INFO MainThread Setting emoncmsorg sendstatus: 1
2020-11-07 14:19:05,296 DEBUG MainThread Signal 15 received.
2020-11-07 14:19:05,607 INFO MainThread Exiting hub...
2020-11-07 14:19:05,745 INFO MainThread Exit completed
2020-11-07 14:19:17,963 INFO MainThread EmonHub emonHub (emon-pi variant) v2.1.5
2020-11-07 14:19:17,966 INFO MainThread Opening hub...
2020-11-07 14:19:17,968 INFO MainThread Logging level set to DEBUG
2020-11-07 14:19:17,971 INFO MainThread Creating EmonHubTx3eInterfacer 'SerialTx'
2020-11-07 14:19:17,976 DEBUG MainThread Opening serial port: /dev/ttyAMA0 @ 115200 bits/s
2020-11-07 14:19:17,995 INFO MainThread Creating EmonHubMqttInterfacer 'MQTT'
2020-11-07 14:19:18,009 DEBUG MainThread Setting MQTT timestamped: True
2020-11-07 14:19:18,011 DEBUG MainThread Setting MQTT subchannels: ['ToEmonCMS']
2020-11-07 14:19:18,013 INFO MainThread Setting MQTT node_JSON_enable: 1
2020-11-07 14:19:18,021 INFO MainThread Creating EmonHubEmoncmsHTTPInterfacer 'emoncmsorg'
2020-11-07 14:19:18,025 DEBUG MainThread Setting emoncmsorg pubchannels: ['ToRFM12']
2020-11-07 14:19:18,027 DEBUG MainThread Setting emoncmsorg subchannels: ['ToEmonCMS']
2020-11-07 14:19:18,028 WARNING MainThread Setting emoncmsorg apikey: obscured
2020-11-07 14:19:18,051 INFO MainThread Setting emoncmsorg url: https://emoncms.org
2020-11-07 14:19:18,052 INFO MainThread Setting emoncmsorg senddata: 1
2020-11-07 14:19:18,054 INFO MainThread Setting emoncmsorg sendstatus: 1
LOG LEVEL: DEBUG
OK, hands up, I hadn’t realised this (or at least hadn’t internalised it!), as I had assumed (yes, I know, I know) that the two devices communicated via the Rx & Tx pins (and to a lesser extent the RST pin). But I know now
I will unplug the emonTx & PiZero & open the case and re-check the wires etc. The only thing that is different to the other PiZero’s that might be causing interference is the (un-insulated) corrugated tin roof that it is near; I will bring it down from the purlin and see if that helps.
sudo journalctl -f
This brings up the following (and then “loops” the last few lines). Not sure why it is unable to resolve host emonTxPiZero1 as is shows that name at the cursor prompt. But then this is again at the edge of my knowledge.
pi@emonTxPiZero1:~ $ sudo journalctl -f
sudo: unable to resolve host emonTxPiZero1: No address associated with hostname
-- Logs begin at Sat 2020-11-07 11:20:12 GMT. --
Nov 07 14:33:01 emonTxPiZero1 systemd[1]: emonPiLCD.service: Succeeded.
Nov 07 14:33:01 emonTxPiZero1 systemd[1]: emonPiLCD.service: Service RestartSec=100ms expired, scheduling restart.
Nov 07 14:33:01 emonTxPiZero1 systemd[1]: emonPiLCD.service: Scheduled restart job, restart counter is at 32335.
Nov 07 14:33:01 emonTxPiZero1 systemd[1]: Stopped emonPi LCD driver.
Nov 07 14:33:01 emonTxPiZero1 systemd[1]: Starting emonPi LCD driver...
Nov 07 14:33:01 emonTxPiZero1 systemd[1]: Started emonPi LCD driver.
Nov 07 14:33:02 emonTxPiZero1 sudo[31786]: pi : unable to resolve host emonTxPiZero1
Nov 07 14:33:02 emonTxPiZero1 sudo[31786]: pi : problem with defaults entries ; TTY=pts/0 ; PWD=/home/pi ; USER=root ;
Nov 07 14:33:02 emonTxPiZero1 sudo[31786]: pi : TTY=pts/0 ; PWD=/home/pi ; USER=root ; COMMAND=/bin/journalctl -f
Nov 07 14:33:02 emonTxPiZero1 sudo[31786]: pam_unix(sudo:session): session opened for user root by pi(uid=0)
Nov 07 14:33:08 emonTxPiZero1 python3[31783]: emonPiLCD logging to: /var/log/emonpilcd/emonpilcd.log
Nov 07 14:33:08 emonTxPiZero1 python3[31783]: I2C LCD NOT DETECTED on either 0x['27', '3f'] ...exiting LCD script
Nov 07 14:33:08 emonTxPiZero1 systemd[1]: emonPiLCD.service: Succeeded.
Nov 07 14:33:08 emonTxPiZero1 systemd[1]: emonPiLCD.service: Service RestartSec=100ms expired, scheduling restart.
Nov 07 14:33:08 emonTxPiZero1 systemd[1]: emonPiLCD.service: Scheduled restart job, restart counter is at 32336.
Nov 07 14:33:08 emonTxPiZero1 systemd[1]: Stopped emonPi LCD driver.
Nov 07 14:33:08 emonTxPiZero1 systemd[1]: Starting emonPi LCD driver...
Nov 07 14:33:09 emonTxPiZero1 systemd[1]: Started emonPi LCD driver.
Nov 07 14:33:14 emonTxPiZero1 python3[31810]: emonPiLCD logging to: /var/log/emonpilcd/emonpilcd.log
Nov 07 14:33:14 emonTxPiZero1 python3[31810]: I2C LCD NOT DETECTED on either 0x['27', '3f'] ...exiting LCD script
Nov 07 14:33:14 emonTxPiZero1 systemd[1]: emonPiLCD.service: Succeeded.
Nov 07 14:33:15 emonTxPiZero1 systemd[1]: emonPiLCD.service: Service RestartSec=100ms expired, scheduling restart.
Nov 07 14:33:15 emonTxPiZero1 systemd[1]: emonPiLCD.service: Scheduled restart job, restart counter is at 32337.
Nov 07 14:33:15 emonTxPiZero1 systemd[1]: Stopped emonPi LCD driver.
Nov 07 14:33:15 emonTxPiZero1 systemd[1]: Starting emonPi LCD driver...
Nov 07 14:33:15 emonTxPiZero1 systemd[1]: Started emonPi LCD driver.
Nov 07 14:33:20 emonTxPiZero1 python3[31831]: emonPiLCD logging to: /var/log/emonpilcd/emonpilcd.log
Nov 07 14:33:20 emonTxPiZero1 python3[31831]: I2C LCD NOT DETECTED on either 0x['27', '3f'] ...exiting LCD script
Nov 07 14:33:21 emonTxPiZero1 systemd[1]: emonPiLCD.service: Succeeded.
Nov 07 14:33:21 emonTxPiZero1 systemd[1]: emonPiLCD.service: Service RestartSec=100ms expired, scheduling restart.
Nov 07 14:33:21 emonTxPiZero1 systemd[1]: emonPiLCD.service: Scheduled restart job, restart counter is at 32338.
Nov 07 14:33:21 emonTxPiZero1 systemd[1]: Stopped emonPi LCD driver.
Nov 07 14:33:21 emonTxPiZero1 systemd[1]: Starting emonPi LCD driver...
Nov 07 14:33:21 emonTxPiZero1 systemd[1]: Started emonPi LCD driver.
Nov 07 14:33:27 emonTxPiZero1 python3[31850]: emonPiLCD logging to: /var/log/emonpilcd/emonpilcd.log
Nov 07 14:33:27 emonTxPiZero1 python3[31850]: I2C LCD NOT DETECTED on either 0x['27', '3f'] ...exiting LCD script
Nov 07 14:33:28 emonTxPiZero1 systemd[1]: emonPiLCD.service: Succeeded.
Nov 07 14:33:28 emonTxPiZero1 systemd[1]: emonPiLCD.service: Service RestartSec=100ms expired, scheduling restart.
Nov 07 14:33:28 emonTxPiZero1 systemd[1]: emonPiLCD.service: Scheduled restart job, restart counter is at 32339.
Nov 07 14:33:28 emonTxPiZero1 systemd[1]: Stopped emonPi LCD driver.
Nov 07 14:33:28 emonTxPiZero1 systemd[1]: Starting emonPi LCD driver...
Nov 07 14:33:28 emonTxPiZero1 systemd[1]: Started emonPi LCD driver.
Nov 07 14:33:34 emonTxPiZero1 python3[31871]: emonPiLCD logging to: /var/log/emonpilcd/emonpilcd.log
Nov 07 14:33:34 emonTxPiZero1 python3[31871]: I2C LCD NOT DETECTED on either 0x['27', '3f'] ...exiting LCD script
Nov 07 14:33:34 emonTxPiZero1 systemd[1]: emonPiLCD.service: Succeeded.
Nov 07 14:33:35 emonTxPiZero1 systemd[1]: emonPiLCD.service: Service RestartSec=100ms expired, scheduling restart.
Nov 07 14:33:35 emonTxPiZero1 systemd[1]: emonPiLCD.service: Scheduled restart job, restart counter is at 32340.
Nov 07 14:33:35 emonTxPiZero1 systemd[1]: Stopped emonPi LCD driver.
Nov 07 14:33:35 emonTxPiZero1 systemd[1]: Starting emonPi LCD driver...
Nov 07 14:33:35 emonTxPiZero1 systemd[1]: Started emonPi LCD driver.