Resurrecting an old emonbase and emontx problems

Okay, It’s been a long time here and I had this old setup I used about 5ish years ago that I’m trying to get working again. At the moment I have no inputs.

I have:
emonTX v3
Raspberry pi 2 with RFM12B v2.5.3

Initially I accidentally installed the 30oct18 image and updated which I think stuffed up the RFM with 69 sketch. I did something I found on the forums which I think flashed it back but I don’t know how to check.

This is where I’m at with no inputs still:
emonTx red flashing light every 10ish seconds
RFM12B green flashing light every 10ish seconds.
Gone back to 26oct17 image

It looks to me like 9600 baud is correct, it’s been set in home/pi/emonhub/conf/emonhub.conf as per the below but it doesn’t seem to run at that and I get the error in the var/log/emonhub.log saying it is at 38400

I’m completely lost with this and I think I’m just blundering around crapping on things so any help would be appreciated. hopefully I’ve given enough info.

Josh

minicom -b38400 -D/dev/ttyAMA0 doesn’t work
minicom -b9600 -D/dev/ttyAMA0 does work and shows this when I enter v and every 10 seconds it looks like an input?

0v

Available commands:
123 x - Toggle configuration change protection, 1=Unlocked
i - set node ID (standard node ids are 1…26)
b - set MHz band (4 = 433, 8 = 868, 9 = 915)
g - set network group (RFM12 only allows 212, 0 = any)
c - set collect mode (advanced, normally 0)
…, a - send data packet to node , with ack
…, s - send data packet to node , no ack
l - turn activity LED on DIG8 on or off
Current configuration:
69 i5 g210 @ 433 MHz Lock: 1

10 0 0 205 254 33 0 50 0 83 91 0 0
10 0 0 204 254 29 0 50 0 32 91 0 0
10 0 0 216 254 30 0 50 0 72 91 0 0
10 0 0 201 254 31 0 49 0 71 91 0 0

emoncms log:

2020-09-21 10:41:11.626|WARN|phpmqtt_input.php|Starting MQTT Input script
2020-09-21 10:41:11.945|ERROR|phpmqtt_input.php|Cannot connect to MYSQL database:Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)
2020-09-21 10:41:13.941|ERROR|feedwriter.php|Can’t connect to database:Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)
2020-09-21 10:42:19.164|WARN|phpmqtt_input.php|Starting MQTT Input script
2020-09-21 10:42:21.616|WARN|phpmqtt_input.php|Subscribing to: emon/#
2020-09-21 10:42:21.617|WARN|phpmqtt_input.php|Not connected, retrying connection
2020-09-21 10:42:21.618|WARN|phpmqtt_input.php|Connecting to MQTT server: Connection Accepted.: code: 0
2020-09-21 10:42:21.630|WARN|phpmqtt_input.php|Subscribed to topic: emon/#
2020-09-21 10:42:35.422|WARN|phpmqtt_input.php|Starting MQTT Input script
2020-09-21 10:42:37.819|WARN|phpmqtt_input.php|Subscribing to: emon/#
2020-09-21 10:42:37.821|WARN|phpmqtt_input.php|Not connected, retrying connection
2020-09-21 10:42:37.822|WARN|phpmqtt_input.php|Connecting to MQTT server: Connection Accepted.: code: 0
2020-09-21 10:42:37.829|WARN|phpmqtt_input.php|Subscribed to topic: emon/#

home/pi/emonhub/conf/emonhub.conf

> #######################################################################
> #######################      emonhub.conf     #########################
> #######################################################################
> 
> ## **LEGACY CONFIG: For use with 17thJune2015 emonPi/emonBase image and older **
> ## (check image version by looking for file in /boot)
> ## Uses old CSV MQTT topic structure compatible with Emoncms Nodes
> ## Does not use MQTT server authentication
> 
> ### emonHub configuration file, for info see documentation:
> ### /github.com/openenergymonitor/emonhub/blob/emon-pi/configuration.md
> #######################################################################
> #######################    emonHub  settings    #######################
> #######################################################################
> 
> [hub]
> ### loglevel must be one of DEBUG, INFO, WARNING, ERROR, and CRITICAL
> loglevel = DEBUG #(default:WARNING)
> ### Uncomment this to also send to syslog
> # use_syslog = yes
> 
> #######################################################################
> #######################       Interfacers       #######################
> #######################################################################
> 
> [interfacers]
> ### This interfacer manages the RFM12Pi/RFM69Pi/emonPi module
> [[RFM2Pi]]
>     Type = EmonHubJeeInterfacer
>     [[[init_settings]]]
>         com_port = /dev/ttyAMA0
>         com_baud = 9600                      # 9600 for old RFM12Pi modules
>     [[[runtimesettings]]]
>         pubchannels = ToEmonCMS,
>         subchannels = ToRFM12,
> 
>         group = 210
>         frequency = 433
>         baseid = 5                              # emonPi / emonBase nodeID
>         quiet = true                            # Report incomplete RF packets (                                                                                                            no implemented on emonPi)
>         calibration = 230V                      # (UK/EU: 230V, US: 110V)
>         # interval =  0                         # Interval to transmit time to e                                                                                                            monGLCD (seconds)
> 
> [[MQTT]]
> 
>     Type = EmonHubMqttInterfacer
>     [[[init_settings]]]
>         mqtt_host = 127.0.0.1
>         mqtt_port = 1883
>         mqtt_user = ''
>         mqtt_passwd = ''
> 
>     [[[runtimesettings]]]
>         pubchannels = ToRFM12,
>         subchannels = ToEmonCMS,
> 
>         # emonhub/rx/10/values format
>         # Use with emoncms Nodes module
>         node_format_enable = 1
>         node_format_basetopic = emonhub/
> 
>         # emon/emontx/power1 format - use with Emoncms MQTT input
>         # http://github.com/emoncms/emoncms/blob/master/docs/RaspberryPi/MQTT.md
>         nodevar_format_enable = 1
>         nodevar_format_basetopic = emon/
> 

/var/log/emonhub.log

2020-09-21 10:39:46,341 INFO MainThread EmonHub emonHub emon-pi variant v2.1.2
2020-09-21 10:39:46,344 INFO MainThread Opening hub…
2020-09-21 10:39:46,356 INFO MainThread Logging level set to DEBUG
2020-09-21 10:39:46,359 INFO MainThread Creating EmonHubJeeInterfacer ‘RFM2Pi’
2020-09-21 10:39:46,388 DEBUG MainThread Opening serial port: /dev/ttyAMA0 @ 38400 bits/s
2020-09-21 10:39:48,399 WARNING MainThread Device communication error - check settings
2020-09-21 10:39:48,402 INFO MainThread Setting RFM2Pi frequency: 433 (4b)
2020-09-21 10:39:49,406 INFO MainThread Setting RFM2Pi group: 210 (210g)
2020-09-21 10:39:50,410 INFO MainThread Setting RFM2Pi quiet: 0 (0q)
2020-09-21 10:39:51,414 INFO MainThread Setting RFM2Pi baseid: 5 (5i)
2020-09-21 10:39:52,419 INFO MainThread Setting RFM2Pi calibration: 230V (1p)
2020-09-21 10:39:53,423 DEBUG MainThread Setting RFM2Pi subchannels: [‘ToRFM12’]
2020-09-21 10:39:53,425 DEBUG MainThread Setting RFM2Pi pubchannels: [‘ToEmonCMS’]
2020-09-21 10:39:53,568 INFO MainThread Creating EmonHubMqttInterfacer ‘MQTT’
2020-09-21 10:39:53,759 DEBUG MainThread Setting MQTT subchannels: [‘ToEmonCMS’]
2020-09-21 10:39:53,857 DEBUG MainThread Setting MQTT pubchannels: [‘ToRFM12’]
2020-09-21 10:39:53,859 INFO MainThread Setting MQTT nodevar_format_enable: 1
2020-09-21 10:39:53,862 INFO MainThread Setting MQTT node_format_enable: 1
2020-09-21 10:39:53,864 INFO MainThread Setting MQTT nodevar_format_basetopic: emon/
2020-09-21 10:39:53,964 INFO MainThread Creating EmonHubEmoncmsHTTPInterfacer ‘emoncmsorg’
2020-09-21 10:39:53,999 DEBUG MainThread Setting emoncmsorg subchannels: [‘ToEmonCMS’]
2020-09-21 10:39:54,002 DEBUG MainThread Setting emoncmsorg pubchannels: [‘ToRFM12’]
2020-09-21 10:39:54,004 INFO MainThread Setting emoncmsorg url: https://emoncms.org
2020-09-21 10:39:54,100 INFO MainThread Setting emoncmsorg senddata: 1
2020-09-21 10:39:54,102 WARNING MainThread Setting emoncmsorg apikey: obscured
2020-09-21 10:39:54,105 INFO MainThread Setting emoncmsorg sendstatus: 1
2020-09-21 10:41:58,285 DEBUG MainThread SIGINT received.
2020-09-21 10:41:58,287 INFO MainThread Exiting hub…
2020-09-21 10:41:58,567 INFO MainThread Exit completed
2020-09-21 10:42:18,751 INFO MainThread EmonHub emonHub emon-pi variant v2.1.2
2020-09-21 10:42:18,753 INFO MainThread Opening hub…
2020-09-21 10:42:18,756 INFO MainThread Logging level set to DEBUG
2020-09-21 10:42:18,789 INFO MainThread Creating EmonHubJeeInterfacer ‘RFM2Pi’
2020-09-21 10:42:18,839 DEBUG MainThread Opening serial port: /dev/ttyAMA0 @ 38400 bits/s
2020-09-21 10:42:20,844 WARNING MainThread Device communication error - check settings
2020-09-21 10:42:20,847 INFO MainThread Setting RFM2Pi frequency: 433 (4b)
2020-09-21 10:42:21,856 INFO MainThread Setting RFM2Pi group: 210 (210g)
2020-09-21 10:42:22,859 INFO MainThread Setting RFM2Pi quiet: 0 (0q)
2020-09-21 10:42:23,863 INFO MainThread Setting RFM2Pi baseid: 5 (5i)
2020-09-21 10:42:24,867 INFO MainThread Setting RFM2Pi calibration: 230V (1p)
2020-09-21 10:42:25,872 DEBUG MainThread Setting RFM2Pi subchannels: [‘ToRFM12’]
2020-09-21 10:42:25,874 DEBUG MainThread Setting RFM2Pi pubchannels: [‘ToEmonCMS’]
2020-09-21 10:42:25,895 INFO MainThread Creating EmonHubMqttInterfacer ‘MQTT’
2020-09-21 10:42:25,926 DEBUG MainThread Setting MQTT subchannels: [‘ToEmonCMS’]
2020-09-21 10:42:25,959 DEBUG MainThread Setting MQTT pubchannels: [‘ToRFM12’]
2020-09-21 10:42:25,984 INFO MainThread Setting MQTT nodevar_format_enable: 1
2020-09-21 10:42:25,986 INFO MainThread Setting MQTT node_format_enable: 1
2020-09-21 10:42:26,039 INFO MainThread Setting MQTT nodevar_format_basetopic: emon/
2020-09-21 10:42:26,052 INFO MainThread Creating EmonHubEmoncmsHTTPInterfacer ‘emoncmsorg’
2020-09-21 10:42:26,057 DEBUG MainThread Setting emoncmsorg subchannels: [‘ToEmonCMS’]
2020-09-21 10:42:26,080 DEBUG MainThread Setting emoncmsorg pubchannels: [‘ToRFM12’]
2020-09-21 10:42:26,083 INFO MainThread Setting emoncmsorg url: https://emoncms.org
2020-09-21 10:42:26,085 INFO MainThread Setting emoncmsorg senddata: 1
2020-09-21 10:42:26,087 WARNING MainThread Setting emoncmsorg apikey: obscured
2020-09-21 10:42:26,109 INFO MainThread Setting emoncmsorg sendstatus: 1
2020-09-21 10:49:46,532 DEBUG MainThread SIGINT received.
2020-09-21 10:49:46,534 INFO MainThread Exiting hub…
2020-09-21 10:49:46,578 INFO MainThread Exit completed

pi@emonpi(ro):emonhub$ avrdude -v -c arduino -p ATMEGA328P -P /dev/ttyAMA0 -b 38400

avrdude-original: Version 6.1, compiled on Jul 7 2015 at 10:29:47
Copyright (c) 2000-2005 Brian Dean,
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          : 38400

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.01s

avrdude-original: Device signature = 0x1e950f
avrdude-original: safemode: lfuse reads as 0
avrdude-original: safemode: hfuse reads as 0
avrdude-original: safemode: efuse reads as 0

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

Welcome to the forum, Joshua.

I have a similar RPi 2B, but although I have RFM12Pi expansion board on it, that is actually equipped with a RFM69CW.

My colleague Brian will most likely suggest you start on a new SD card - it’s painful converting the downloaded image to fit on a 8 GB, but easy to expand the image to use a 32 GB, if that’s easier to get than the recommended 16 GB.

The Jul20 image works on my Pi 2B, if you have a genuine RFM12B radio module on your expansion board, then you will indeed need to re-upload the software for that, because although the two radios are hardware-compatible, the software is completely different.

A couple of other “gotcha’s” to beware of: programming the ATMega 328P on the expansion board always happens at 38400 baud, even though once flashed, it expects to communicate serially with the Pi at a completely different baud rate.

So the command to flash its software is
avrdude -v -c arduino -p ATMEGA328P -P /dev/ttyAMA0 -b 38400 -U flash:w:[file]
where [file] I think, for your RFM12B, will be /opt/openenergymonitor/RFM2Pi/firmware/old/Pre_compiled_ATtiny84_RF12_Demo_hex/ATtiny84_RF12_Demo.cpp.hex

(Note, files have been moved around since any instructions you probably read were written.)

When you come to emonhub.conf, the serial baud rate you need in here

>         com_port = /dev/ttyAMA0
>         com_baud = 9600                      # 9600 for old RFM12Pi modules

will be that which is set in the sketch you flashed into the expansion board. That’s likely to be 9600, but 38400 and 57600 have also been used. It’s wrong when you see the second of two lines:

2020-09-21 10:42:18,839 DEBUG MainThread Opening serial port: /dev/ttyAMA0 @ 38400 bits/s
2020-09-21 10:42:20,844 WARNING MainThread Device communication error - check settings

You don’t need to restart the Pi, only emonHub, when you change that. And that’s the speed you need to communicate using minicom -D /dev/ttyAMA0 -b 38400

Which is what was first tried

But failed. I’m not convinced the initial update does not simply assume it is an emonPi, so older hardware might well get a bad upload.

@Joshua_Pond, I suggest getting good info out of minicom (or miniterm) is a good starting point. Remember to stop the emonhub service before connecting that way (sudo systemctl stop emonhub.service).

Thanks all for the help but I got it going with the dumbest thing.
I’ve been editing home/pi/emonhub/conf/emonhub.conf as mentioned in my first post when I should have been editing home/pi/data/emonhub.conf

I’m now getting inputs and I’m happy I didn’t have to throw out old hardware!
Thanks, Josh

Next task is to move to the new image!

And risk losing it all !!!
Maybe for another time when I’m game.

Thanks anyway, it gave me the push I needed.

Josh

Plenty of evidence to say that won’t happen…

That’s why I suggested a new SD card - then you still have all the old data on the old card, which you can then extract via the backup mechanism and restore to the new card.

1 Like