New emonSD release: emonSD-30Oct18 (Raspbian Stretch Pi3B+ compatible) šŸŽ‰

Yes ā€˜emonpi updateā€™ is the best method in both instances. The emonbase update updates the firmware on the rflink (I think - not an emonpi user).

Take a backup first :smile: - there are a number of threads on baking up / exporting data.

My crib notes say:

Update EmonPi Button or Update EmonBase Button? - #15 by pb66

And in rather more detail (all courtesy of @pb66)

Updating emonPi sketch:
If you do want to change the firmware, itā€™s best to compile the Arduino sketch on your PC then transfer the .hex to the emonPi and upload directly from the RaspberryPi using avrdude. Emonhub will need to be stopped to free up the serial port. See example script to upload .hex emonpi/update at master Ā· openenergymonitor/emonpi Ā· GitHub

#!/bin/bash
sudo service emonhub stop
avrdude -v -c arduino -p ATMEGA328P -P /dev/ttyAMA0 -b 115200 -U flash:w:/home/pi/emonpi/firmware/compiled/latest.hex
sudo service emonhub start

Not updating the emonPi sketch:
EmonPi AC-AC input - #13 by pb66
ā€œIf you use the ā€œupdate RFM69Piā€ button rather than the ā€œupdate emonPiā€ button it will update in exactly the same way but when it tries to upload the firmware at the wrong upload baud it will fail and the existing firmware will remain intact. This works as the 16MHz emonPi has a different bootloader to all the 8MHz RFM2Pi type devices.ā€

If you have an emonPi with a totally stock sketch you are best using ā€œupdate emonpiā€ to keep up to date.
If you have an emonPi with a modified sketch you are best using ā€œupdate emonbaseā€ to avoid overwriting.
If you have an emonBase and you know your RFM2Pi or RFM69Pi is rfm69 based and has a totally stock sketch you are best using ā€œupdate emonBaseā€ to keep it updated
If you have an emonBase with a rfm69 based RFM2Pi or RFM69Pi running a modified sketch OR if you have a rfm12 based RFM2Pi OR you are unsure what RFM2Pi you have you should use ā€œupdate emonpiā€ to avoid over-writing the firmware.
Aside from the firmware differences, there is no difference, both buttons fully update the emonSD used in both the emonPi and emonBases. There is no emonHub update button, emonhub is updated along with emoncms and other softwares in that same emonSD update.

2 Likes

Thanks for your advices. Buying a new card is probably a safer solution.

1 Like

This was discussed in great length already, and thereā€™s a link to the discussion in Glynā€™s first post in this thread. Have a read through that discussion - the argument has already been lost :wink:

Iā€™ve not been able to revive a couple of inputs - i.e. those from Robinā€™s Mk2 pv diverter. The standard emontx and emonth nodes have been picked up and are updating, but not these additional ones. The imported backup file has these nodes (basically node ā€˜12ā€™ and ā€˜13ā€™) listed in inputs, but null values. The log file shows an error:

2018-11-14 00:44:16.296|ERROR|phpmqtt_input.php|ErrorException: Undefined index: nodeid in /var/www/emoncms/Modules/input/input_model.php:206

but Iā€™m on the edge of my knowledge hereā€¦do I need to edit the script on the diverter (which I presume is still transmitting the data with the same format) or do I need to try and find these nodes in the php script?

3 posts were split to a new topic: Getting started with energy monitoring using RasPi + CT sensors

Fixed it - basically needed to edit the emonHub config nodes and delete the old ones :smile:

2 Likes

Thanks everyone. I did a full backup for everything in keep in case of trouble, butā€¦

The backup/SDcard2018/import works fine.

The one issue which might be nothing is that I the ā€˜averdudeā€™ I updated.

At the end of the procedure it saidā€¦

=============================================
avrdude-original: safemode: lfuse reads as 0
avrdude-original: safemode: hfuse reads as 0
avrdude-original: safemode: efuse reads as 0
avrdude-original: safemode: Fuses OK (E:00, H:00, L:00)
strace: |autoreset: Broken pipe
strace: |autoreset: Broken pipe
strace: |autoreset: Broken pipe
strace: |autoreset: Broken pipe
strace: |autoreset: Broken pipe

avrdude-original done. Thank you.

strace: |autoreset: Broken pipe

Is that just then drop the connection? In which case nothing to worried aboutā€¦

Thanks for everyone for the adviceā€¦

I think that error just means that the firmware upload tool could not connect to the emonpi board, did you share the details of your system? Is it an emonpi?

Thatā€™s nothing to worry about. The FW updated successfully this strace error happens when avrdude finishes. Itā€™s due to our modified avrdude with ā€œauto resetā€ to auto toggle a GPIO pin on a RasPi to reset the AVR controller.:

I did try and track this message down in the past but didnā€™t manage to fix it. Agree it would be best if the error wasnā€™t there! But nothing to worry about.

1 Like

I have just reboot my emonpi and i am getting:

Canā€™t connect to database, please verify credentials/configuration in settings.php
Error message: Connection refused

in the log file I am seeing

Nov 18 21:48:52 emonpi systemd[1]: Started Emoncms MQTT Input Script.
Nov 18 21:48:52 emonpi mqtt_input[11753]: PHP Fatal error:  Uncaught ErrorException: mysqli::__construct(): (HY00$
Nov 18 21:48:52 emonpi mqtt_input[11753]: Stack trace:
Nov 18 21:48:52 emonpi mqtt_input[11753]: #0 [internal function]: exceptions_error_handler(2, 'mysqli::__const...$
Nov 18 21:48:52 emonpi mqtt_input[11753]: #1 /var/www/emoncms/scripts/phpmqtt_input.php(61): mysqli->__construct($
Nov 18 21:48:52 emonpi mqtt_input[11753]: #2 {main}
Nov 18 21:48:52 emonpi mqtt_input[11753]:   thrown in /var/www/emoncms/scripts/phpmqtt_input.php on line 61
Nov 18 21:48:52 emonpi mqtt_input[11753]: Fatal error: Uncaught ErrorException: mysqli::__construct(): (HY000/200$
Nov 18 21:48:52 emonpi mqtt_input[11753]: Stack trace:
Nov 18 21:48:52 emonpi mqtt_input[11753]: #0 [internal function]: exceptions_error_handler(2, 'mysqli::__const...$
Nov 18 21:48:52 emonpi mqtt_input[11753]: #1 /var/www/emoncms/scripts/phpmqtt_input.php(61): mysqli->__construct($
Nov 18 21:48:52 emonpi mqtt_input[11753]: #2 {main}
Nov 18 21:48:52 emonpi mqtt_input[11753]:   thrown in /var/www/emoncms/scripts/phpmqtt_input.php on line 61

Glyn

Thanks for the info. I may have missed it but how do I get the new card into the pi?

If you are referring to the emonPi, you will need to open up the enclosure and insert the SD card into the RaspberryPi. See this overview video showing the inside of the emonPi:

Glyn,

New Micro SD arrived today (16GB ? iso 8GB). Sorry for this silly question, just want to make sure. I assume I do a backup. Remove the old SD then insert the new SD and then do an ā€œImport Backupā€.

Regards
John

The base emonSD image is 8GB, we have expanded the data partition to fill the 16GB card. One of the main reasons for this is at 16GB cards are now cheaper and easier to source than 8GB! Economics of scale I guess. No harm in having more storage space.

Correct, before you remove the old card update your old emonPi then run an export using the backup module. Once done, download the compressed backup file.

Then once your up and running with the new image perform an import.

See full instructions here:

https://guide.openenergymonitor.org/setup/import

I also have old hardware:

  • Pi Model B gen 1 EmonHub with old RFM12B radio runing emonSD-07Nov16 image
  • EmonTX v3 with old firmware

The emonSD-30Oct18 image didnā€™t boot on the old Pi 1, but I booted it on a Pi 3 where I was able to make the changes to /boot/config.txt suggested (three items to comment out) and it booted okay to login. I reverted emonhub.conf to 9600 baud for the radio, then I got stuck as Iā€™m not able to pick up my feeds. Itā€™s not a big deal ā€“ Iā€™m well overdue to update my hardware, Iā€™ll go back to emonSD-07Nov16 until I figure it out.

2018-12-02 18:35:12,539 INFO MainThread EmonHub emonHub emon-pi variant v2.1.1
2018-12-02 18:35:12,543 INFO MainThread Opening hubā€¦
2018-12-02 18:35:12,579 INFO MainThread Logging level set to DEBUG
2018-12-02 18:35:12,583 INFO MainThread Creating EmonHubJeeInterfacer ā€˜RFM2Piā€™
2018-12-02 18:35:12,649 DEBUG MainThread Opening serial port: /dev/ttyAMA0 @ 9600 bits/s
2018-12-02 18:35:14,656 WARNING MainThread Device communication error - check settings
2018-12-02 18:35:14,661 INFO MainThread Setting RFM2Pi frequency: 433 (4b)
2018-12-02 18:35:15,666 INFO MainThread Setting RFM2Pi group: 210 (210g)
2018-12-02 18:35:16,671 INFO MainThread Setting RFM2Pi quiet: 0 (0q)

Mm it sounds like emonHub cannot communite with your RFM12B. Was the your RFM12B connected?

Could you try and see if you can view serial data directly from the modue using minicom:

sudo service emonhub stop
minicom -D /dev/ttyAMA0 -b9600

To exit minicom use [CTRL + A] then [X] then select yes

Glyn

I can confirm I have emonSD-30Oct18 running well with old hardware:

emonBase

  • RFM12Pi v2.6 with RFM12B
  • Raspberry Pi 1 model B

emonTX v3.2 (RFM12B)

It took me some time to figure out the radio connection. Minicom used as advised would return garbarge. I thought I had a hardware problem, but the Green light on the RFM12B was flashing regularly suggesting it was working. I played around and changed the baud rate on minicom to 38400 and it worked. I went back to my emonhub.conf, and changed the baud from 9600 (where its been for 4yrs!) to 38400, and it came back to life.

I canā€™t really explain. In my messing around, I did reflash the firmware on the RFM12B:

sudo avrdude -v -p atmega328p -c arduino -P /dev/ttyAMA0 -b 38400 -U flash:w:/home/pi/RFM2Pi/firmware/RFM69CW_RF_Demo_ATmega328/RFM12_Demo_ATmega328.cpp.hex:i

anyway, all working :smile:

2018-12-09T00:00:00Z

2 Likes

I noticed no US based download repo. I might be able to host for you if interested.

That would be great, thanks. Please post a link to your mirror and I will add it to the download page.