emonBase can't connect to RFM69 module

I had posted this earlier as “can’t open serial port”, but I have since confirmed that I can connect to the serial port by plugging in a zigbee dongle just to test. The log file shows a successful connection.

However, I cannot connect to the RFM59 module. Suspecting that the module might be defective, I swapped the module from a working emonBase and emonHub still shows as unable to connect. In searching other posts, I saw a reference to changing the baud rate, so I tried 38400 and still no luck.

The latest emonHub log is shown below.

Not sure where to look next and appreciate any suggestions.

Thanks,

Gordon

2024-10-19 07:40:41,357 INFO     MainThread EmonHub v2.6.15
2024-10-19 07:40:41,358 INFO     MainThread Opening hub...
2024-10-19 07:40:41,358 INFO     MainThread Running as user: pi
2024-10-19 07:40:41,359 INFO     MainThread Logging level set to DEBUG
2024-10-19 07:40:41,359 INFO     MainThread Creating EmonHubOEMInterfacer 'EmonPi2'
2024-10-19 07:40:41,360 DEBUG    MainThread Opening serial port: /dev/ttyAMA0 @ 115200 bits/s
2024-10-19 07:40:41,361 INFO     MainThread Creating EmonHubOEMInterfacer 'USB0'
2024-10-19 07:40:41,370 DEBUG    MainThread Opening serial port: /dev/ttyUSB0 @ 115200 bits/s
2024-10-19 07:40:41,371 INFO     MainThread Creating EmonHubRFM69LPLInterfacer 'SPI'
2024-10-19 07:40:41,402 INFO     MainThread Creating RFM69 LowPowerLabs interfacer
2024-10-19 07:40:41,403 INFO     MainThread RFM69 node_id = 5
2024-10-19 07:40:41,403 INFO     MainThread RFM69 network_id = 210
2024-10-19 07:40:41,403 INFO     MainThread RFM69 interruptPin = 22
2024-10-19 07:40:41,403 INFO     MainThread RFM69 resetPin = 24
2024-10-19 07:40:41,404 INFO     MainThread RFM69 selPin = 16
2024-10-19 07:40:41,404 INFO     MainThread Starting radio setup
2024-10-19 07:40:42,105 ERROR    MainThread Could not connect to RFM69 module
2024-10-19 07:40:42,105 DEBUG    MainThread Setting SPI pubchannels: ['ToEmonCMS']
2024-10-19 07:40:42,106 INFO     MainThread Creating EmonHubMqttInterfacer 'MQTT'
2024-10-19 07:40:42,107 DEBUG    MainThread Setting MQTT pubchannels: ['ToRFM12']
2024-10-19 07:40:42,107 DEBUG    MainThread Setting MQTT subchannels: ['ToEmonCMS']
2024-10-19 07:40:42,107 INFO     MainThread Setting MQTT node_format_enable: 0
2024-10-19 07:40:42,107 INFO     MainThread Setting MQTT nodevar_format_enable: 1
2024-10-19 07:40:42,108 INFO     MainThread Setting MQTT nodevar_format_basetopic: emon/
2024-10-19 07:40:42,108 INFO     MainThread Setting MQTT node_JSON_enable: 0
2024-10-19 07:40:42,108 INFO     MainThread Creating EmonHubEmoncmsHTTPInterfacer 'emoncmsorg'
2024-10-19 07:40:42,109 DEBUG    MainThread Setting emoncmsorg interval: 30
2024-10-19 07:40:42,109 DEBUG    MainThread Setting emoncmsorg pubchannels: ['ToRFM12']
2024-10-19 07:40:42,109 DEBUG    MainThread Setting emoncmsorg subchannels: ['ToEmonCMS']
2024-10-19 07:40:42,109 WARNING  MainThread Setting emoncmsorg apikey: obscured
2024-10-19 07:40:42,110 INFO     MainThread Setting emoncmsorg url: https://emoncms.org
2024-10-19 07:40:42,110 INFO     MainThread Setting emoncmsorg senddata: 1
2024-10-19 07:40:42,110 INFO     MainThread Setting emoncmsorg sendstatus: 0
2024-10-19 07:40:42,110 INFO     MainThread Setting emoncmsorg sendnames: 1
2024-10-19 07:40:42,110 INFO     MainThread Setting emoncmsorg compress: 0
2024-10-19 07:40:42,111 INFO     MainThread Creating EmonHubDS18B20Interfacer 'DS18B20'
2024-10-19 07:40:42,129 INFO     MainThread Setting DS18B20 read_interval: 10
2024-10-19 07:40:42,130 INFO     MainThread Setting DS18B20 nodename: sensors
2024-10-19 07:40:42,130 INFO     MainThread Setting DS18B20 ids: 
2024-10-19 07:40:42,130 INFO     MainThread Setting DS18B20 names: 
2024-10-19 07:40:42,130 DEBUG    MainThread Setting DS18B20 pubchannels: ['ToEmonCMS']
2024-10-19 07:40:42,131 DEBUG    MainThread Automatic configuration of nodes enabled
Log Level: DEBUG 

Hello @grod55

Is your RFM69 module the original RFM69Pi emonBase with RFM69Pi (ATmega328) — OpenEnergyMonitor 0.0.1 documentation module? If so the data from this should be being picked up by the EmonHubOEMInterfacer interfacer, not the EmonHubRFM69LPLInterfacer which is there to communicate with the more recent SPI connected RFM69 module e.g New: emonBase with RFM69 SPI (Direct) — OpenEnergyMonitor 0.0.1 documentation.

You will need to set the baud rate of the EmonHubOEMInterfacer to 38400.

The second thing to check if the above does not work is that the firmware running on your RFM69Pi module might be the JeeLib Classic firmware and if your nodes are running newer LowPowerLabs firmware the data wont come through. You can change the firmware on the RFM69Pi from the Admin > Update page.

Not sure how to tell, but this chip looks to be the same as the one shown on the OEM store.
RFM

I changed the baud rate to 38400 - no change. I then updated the firmware - no change.

Here is my emonHub configuration. Note, I have tried the baud rate at 115200 as well.

[hub]
    ### loglevel must be one of DEBUG, INFO, WARNING, ERROR, and CRITICAL
    loglevel = DEBUG
    autoconf = 1
### Uncomment this to also send to syslog
# use_syslog = yes
#######################################################################
#######################       Interfacers       #######################
#######################################################################

[interfacers]
    ### This interfacer manages the RFM12Pi/RFM69Pi/emonPi module
    [[EmonPi2]]
        Type = EmonHubOEMInterfacer
        [[[init_settings]]]
            com_port = /dev/ttyAMA0
            com_baud = 38400
        [[[runtimesettings]]]
            pubchannels = ToEmonCMS,
            subchannels = ToRFM12,
    
    [[USB0]]
        Type = EmonHubOEMInterfacer
        [[[init_settings]]]
            com_port = /dev/ttyUSB0
            com_baud = 38400
        [[[runtimesettings]]]
            pubchannels = ToEmonCMS,
            subchannels = ToRFM12,
            nodename = emonTx4
    
    [[SPI]]
        Type = EmonHubRFM69LPLInterfacer
        [[[init_settings]]]
            nodeid = 5
            networkID = 210
            resetPin = 24
            selPin = 16
        [[[runtimesettings]]]
            pubchannels = ToEmonCMS,

It’s the same chip/module, the difference is in the board that it sits on. It does look like the base board is green which suggests the SPI version, is that correct? Is the pin placement on the RaspberryPi header correct?

I verified the pin placement, which matches the picture you sent (7 pins back from the ethernet port).

image

Also, I went back and checked the invoice and purchased the emonBase 433Mhz (RFM69SPI).

Worth checking that SPI is enabled. If you run lsmod | grep spi_ you should see spi_bcm2### (### is some number) if it’s enabled.

If not, you can either use raspi-config to do it, or run sudo echo "dtparam=spi=on" >> /boot/config.txt and then reboot.

Hi Angus,

thanks for the suggestion. I ran lsmod | grep spi_ and got the response.

spi_bcm2835 24576 0

So, it looks like SPI is enabled.

@TrystanLea when I downloaded the latest version of emonCMS onto an SD card, the card had RaspberryPi OS on it already - should I have started with a blank SD card? I used BalenaEtcher to put the image onto the SD card assuming it would erase anything already on the SD card.

Trying to think of what else it could be.

1 Like

@grod55 From the photo and post above, it looks like you are using the RFM69SPI module in your emonbase.

Background

1) There are two main radio protocols used. They are not compatible.
The older one is called Jeelabs Classic format.
The newer one is called LPL (Low Power Labs) radio format.

2) There are two radio modules for the emonBase.
The older module has a RFM69 radio module and an atmega 328 controller. It talks to the Pi via the Pi AMA0 serial port. The atmega 328 controller can be programmed to receive either LPL or Jeelabs protocol. The atmega 328 firmware can be changed from the Admin > Update page.
The newer module just uses the RFM69 radio module, and talks to the Pi via the Pi SPI port. The decoding of the radio format is done in the Pi. As far as I know the SPI decoder in emonHub is only for the LPL protocol? @TrystanLea ?

From post #3, your emonHub configuration includes

### This interfacer manages the RFM12Pi/RFM69Pi/emonPi module
    [[EmonPi2]]
        Type = EmonHubOEMInterfacer
        [[[init_settings]]]
            com_port = /dev/ttyAMA0
            com_baud = 38400
        [[[runtimesettings]]]
            pubchannels = ToEmonCMS,
            subchannels = ToRFM12,

I don’t think is necessary as it is for the serial RFM69 module.

Your emonHub configuration includes the correct interface for the RFM69SPI module which is:

 [[SPI]]
        Type = EmonHubRFM69LPLInterfacer
        [[[init_settings]]]
            nodeid = 5
            networkID = 210
            resetPin = 24
            selPin = 16
        [[[runtimesettings]]]
            pubchannels = ToEmonCMS,

However, the SPI interfacer looks like it will only work with radios using the LPL (Low Power Labs) radio format.

If your emonTHs are older and using the JeeLib Classic radio format, then either

  1. You would need a SPI interfacer that understood the JeeLib Classic radio format. I don’t know if one exists?

  2. Or you would have to update the firmware in all your emonTHs to the version using the LPL (Low Power Labs) radio format.

Note: I don’t have an emonTH!

Hope this helps! Apologies in advance for any errors!

Thanks @rupert

Apologies, the combination of default config being for the emonPi2 and unclear documentation on what the pin settings should be for the emonBase rather than the emonPi2 is not helping here. On the emonBase the configuration should be:

 [[SPI]]
        Type = EmonHubRFM69LPLInterfacer
        [[[init_settings]]]
            nodeid = 5
            networkID = 210
            selPin = 26
        [[[runtimesettings]]]
            pubchannels = ToEmonCMS,

or omitting selPin also works as this defaults to 26:

 [[SPI]]
        Type = EmonHubRFM69LPLInterfacer
        [[[init_settings]]]
            nodeid = 5
            networkID = 210
        [[[runtimesettings]]]
            pubchannels = ToEmonCMS,

On the emonPi2 the configuration should be:

 [[SPI]]
        Type = EmonHubRFM69LPLInterfacer
        [[[init_settings]]]
            nodeid = 5
            networkID = 210
            resetPin = 24
            selPin = 16
        [[[runtimesettings]]]
            pubchannels = ToEmonCMS,

I have added a note to the default emonhub.conf used on the emonSD image to mention this:
https://github.com/openenergymonitor/emonhub/blob/master/conf/emonpi2.default.emonhub.conf#L46

It’s probably about time that we issue a new image update soon, with this and other changes such as the latest version of the sync module.

1 Like

I have also updated the example config in the docs to be explicit about this pin setting, the example had the pin setting selPin = 26 omitted which works as that’s the default value but I think it’s clearer if the documentation specifies the pin as it was the first place I checked to remind myself what the pin should be… https://docs.openenergymonitor.org/emonbase/rfm69-spi.html

1 Like

Thanks @TrystanLea for the update on the pin numbers for the configuration.

Just to be clear, is the hardware RFM69SPI module plus the

[[SPI]]
        Type = EmonHubRFM69LPLInterfacer

interfacer only capable of receiving LPL (Low Power Labs) radio format?

In other words, that it cannot receive JeeLib Classic radio format?

If @grod55 has older emonTHs using the JeeLib Classic radio format, this may explain why he doesn’t receive any data from them.

That worked! Changed the pin to 26, the radio connected and all the nodes showed up.

thanks,

Gordon

3 Likes

Hi Rupert,
my radio is the newer version and all my emonTHs are the new version as well. Thanks for your assistance.

Yes this is correct, and thankyou for all of your help @rupert !

This will need thorough testing (especially with older kit) as I think changes to various python packages and also to PHP could make this task interesting.

Perhaps move to a venv setup?

1 Like