I am running emonSD-17Oct19, and I have been trying to modify the emonpi firmware to send powerfactor and current values.
However when I build and flash using platformio on the Raspberry PI, my emonTH devices input stop reporting their values, and no traffic for them is seen in EmonHUB.
To rule out the changes I have made, I tried downloading a clean copy of the source from github and building / flashing that and get the same result.
If i flash a copy of latest.hex that I took before starting everything works as expected.
Trying to replicate here I seem to be having trouble uploading the firmware with platformio on the emonpi. But I have been able to successfuly compile and then upload using avrdude.
cd /opt/openenergymonitor/emonpi/firmware
pio run
sudo service emonhub stop
avrdude -v -c arduino -p ATMEGA328P -P /dev/ttyAMA0 -b 115200 -U flash:w:/opt/openenergymonitor/emonpi/firmware/.pio/build/emonpi/firmware.hex
sudo service emonhub start
The emonTH and emontx devices here then appear as normal in the input list.
Logs from the plaformio build and avr-dude upload below, and emonhub.log attached showing that the data from RF remote nodes stops coming in, around 11:30 am this morning when doing a test.
Everything appears to build and upload with no errors, I am getting data coming in from the emonpi it’s self, but not from any of the 433MHz devices.
./compile.sh
./compile.sh: line 6: rpi-rw: command not found
Warning! `env_default` configuration option in section [platformio] is deprecated and will be removed in the next release! Please use `default_envs` instead
Processing emonpi (platform: atmelavr; framework: arduino; board: emonpi)
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/emonpi.html
PLATFORM: Atmel AVR 1.15.0 > OpenEnergyMonitor emonPi
HARDWARE: ATMEGA328P 16MHz, 2KB RAM, 30KB Flash
PACKAGES: toolchain-atmelavr 1.50400.190710 (5.4.0), framework-arduinoavr 4.1.2
Converting src.ino
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 15 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <DallasTemperature> 3.7.7
| |-- <OneWire> 2.3.5
|-- <EmonLib> 1.1.0
|-- <LiquidCrystal_I2C>
| |-- <Wire> 1.0
|-- <jeelib> #f097c00
|-- <arduino-onewire-DS2438> #a7ec6ac
| |-- <OneWire> 2.3.5
|-- <OneWire> 2.3.5
|-- <Wire> 1.0
Building in release mode
Compiling .pio/build/emonpi/src/src.ino.cpp.o
Linking .pio/build/emonpi/firmware.elf
Checking size .pio/build/emonpi/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
DATA: [===== ] 52.7% (used 1079 bytes from 2048 bytes)
PROGRAM: [====== ] 60.2% (used 18482 bytes from 30720 bytes)
=============================================================== [SUCCESS] Took 17.18 seconds ===============================================================
Environment Status Duration
------------- -------- ------------
emonpi SUCCESS 00:00:17.182
direct-upload IGNORED
emonpi_deploy IGNORED
================================================================ 1 succeeded in 00:00:17.182 ===============================================================
./update
avrdude-original: Version 6.3-20171130
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "/etc/avrdude.conf"
User configuration file is "/root/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : /dev/ttyAMA0
Using Programmer : arduino
Overriding Baud Rate : 115200
avrdude-original: Using autoreset DTR on GPIO Pin 7
AVR Part : ATmega328P
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC2
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 20 4 0 no 1024 4 0 3600 3600 0xff 0xff
flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff
lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
Programmer Type : Arduino
Description : Arduino
Hardware Version: 3
Firmware Version: 4.4
Vtarget : 0.3 V
Varef : 0.3 V
Oscillator : 28.800 kHz
SCK period : 3.3 us
avrdude-original: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude-original: Device signature = 0x1e950f (probably m328p)
avrdude-original: safemode: lfuse reads as 0
avrdude-original: safemode: hfuse reads as 0
avrdude-original: safemode: efuse reads as 0
avrdude-original: NOTE: "flash" memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude-original: erasing chip
avrdude-original: reading input file "/opt/openenergymonitor/emonpi/firmware/compiled/latest.hex"
avrdude-original: input file /opt/openenergymonitor/emonpi/firmware/compiled/latest.hex auto detected as Intel Hex
avrdude-original: writing flash (18482 bytes):
Writing | ################################################## | 100% 2.64s
avrdude-original: 18482 bytes of flash written
avrdude-original: verifying flash memory against /opt/openenergymonitor/emonpi/firmware/compiled/latest.hex:
avrdude-original: load data flash data from input file /opt/openenergymonitor/emonpi/firmware/compiled/latest.hex:
avrdude-original: input file /opt/openenergymonitor/emonpi/firmware/compiled/latest.hex auto detected as Intel Hex
avrdude-original: input file /opt/openenergymonitor/emonpi/firmware/compiled/latest.hex contains 18482 bytes
avrdude-original: reading on-chip flash data:
Reading | ################################################## | 100% 1.95s
avrdude-original: verifying ...
avrdude-original: 18482 bytes of flash verified
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.
All my devices are 433MHz, Group 210 and work with the default firmware shipped with the EmonPi. From the src.ino I am building these parameters are set.
byte RF_freq=RF12_433MHZ; // Frequency of RF69CW module can be RF12_433MHZ, RF12_868MHZ or RF12_915MHZ. You should us$
byte nodeID = 5; // emonpi node ID
int networkGroup = 210;
emonhub.service - emonHub service description
Loaded: loaded (/opt/openenergymonitor/emonhub/service/emonhub.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2019-11-12 12:15:29 GMT; 3min 13s ago
Process: 6694 ExecStartPre=/bin/mkdir -p /var/log/emonhub/ (code=exited, status=0/SUCCESS)
Process: 6695 ExecStartPre=/bin/chgrp -R emonhub /var/log/emonhub/ (code=exited, status=0/SUCCESS)
Process: 6696 ExecStartPre=/bin/chmod 775 /var/log/emonhub/ (code=exited, status=0/SUCCESS)
Main PID: 6697 (python)
Tasks: 4 (limit: 2319)
Memory: 12.7M
CGroup: /system.slice/emonhub.service
└─6697 python /usr/local/bin/emonhub/emonhub.py --config-file=/etc/emonhub/emonhub.conf --logfile=/var/log/emonhub/emonhub.log
Nov 12 12:17:50 emonpi emonhub.py[6697]: self.stream.flush()
Nov 12 12:17:50 emonpi emonhub.py[6697]: IOError: [Errno 28] No space left on device
Nov 12 12:17:50 emonpi emonhub.py[6697]: Logged from file EmonHubMqttInterfacer.py, line 121
Nov 12 12:17:50 emonpi emonhub.py[6697]: Traceback (most recent call last):
Nov 12 12:17:50 emonpi emonhub.py[6697]: File "/usr/lib/python2.7/logging/__init__.py", line 892, in mit
Nov 12 12:17:50 emonpi emonhub.py[6697]: self.flush()
Nov 12 12:17:50 emonpi emonhub.py[6697]: File "/usr/lib/python2.7/logging/__init__.py", line 852, in flush
Nov 12 12:17:50 emonpi emonhub.py[6697]: self.stream.flush()
Nov 12 12:17:50 emonpi emonhub.py[6697]: IOError: [Errno 28] No space left on device
Nov 12 12:17:50 emonpi emonhub.py[6697]: Logged from file EmonHubMqttInterfacer.py, line 152
[12:28:15] pi@emonpi:/opt/openenergymonitor/emonpi/firmware/compiled$ ls -lh /var/log/emoncms/
total 612K
-rw-rw-r-- 1 root root 345K Nov 12 12:24 apache2-error.log
-rw-rw-rw- 1 pi pi 248K Nov 12 12:26 emoncms.log
-rw-rw-rw- 1 pi pi 3.0K Nov 10 19:18 emonpiupdate.log
-rw-rw-r-- 1 pi pi 0 Nov 10 19:17 emonupdate.log
-rw-r--r-- 1 pi pi 2.3K Oct 29 23:58 exportbackup.log
-rw-rw-r-- 1 root root 137 Nov 12 12:30 wificheck.log
-rw-rw-r-- 1 pi pi 598 Nov 9 21:42 wifiscan.log
[12:34:40] pi@emonpi:/opt/openenergymonitor/emonpi/firmware/compiled$ ls -lh /var/log/emonhub/
total 328K
-rw-r--r-- 1 emonhub emonhub 325K Nov 12 12:36 emonhub.log
Ive had a manual clearout of the log files, and have tried my build firmware and no longer get the disk space errors when checking the status of the emonhub service. But still nothing coming back from the RF nodes.
One thing ive noticed is that I am bulding an unmodified src 2.9.0 and get a hex file of 52005 bytes, but the one shipped with the emonSD image is 50332 bytes, as is the prebult 2.9.0 on github.
Unfortunatley I didnt make a note of logfiles etc… I’ll keep an eye on the /var/log space over the next few days and see how it grows… It’s not growing particularly fast now…
@borpin Many thanks for your input… @TrystanLea Im guessing what I’ve learned is that the firmware is running otherwise I wouldnt be getting the data from the emonpi node… So there is something funny about my build and the RF config… Could this be a dependency (incorrect version) issue?