Running JeeLib Classic and LowPowerLab Simultaneously

I am glad to see the new Open Energy Monitor hardware uses the LowPowerLab radio library. It is great.

I’ve been running devices with both libraries for a few years now, and I thought it might be a good time to post about how I do it.

They key is to use a Moteino USB in addition to the RFM69Pi/RFM69SPI.

Moteinos are the creation of Felix Ruso from LowPowerLab. All about Moteino | LowPowerLab

Advantages of Moteino USB over other similar devices.

  • Moteino USB doesn’t need the GPIO header, which is often already occupied by the RFM69Pi/SPI.
  • Moteinos can be ordered with the RFM69CW transceiver, unlike other small Arduino-like USB devices such as Ardiuno Micro.
  • Moteinos can make additional bridges to emonHub with any of its other available transceiver options. (Including LoRa!)

The JeeNode classic looks like it would also work, but I haven’t tried it. The JeeLabs Shop - JeeLink Classic (digitalsmarties.net).

A Moteino USB can run the RFM69Pi firmware compiled for Arduino Uno boards. That firmware is available in the RFM2Pi repository. RFM2Pi/firmware/RFM69CW_RF_Demo_ATmega328/RFM69CW_RF12_Demo_ATmega328/src at master · openenergymonitor/RFM2Pi (github.com)

It boils down to two steps.

  1. Use the Arduino IDE to flash the Moteino USB with this firmware.

  2. Add the following entry to emonHub (emonCMS > Setup > emonHub > Edit Config) in the [interfacers] section in addition to the [[RFM2Pi]] entry.

[[MoteinoUSB]]
  Type = EmonHubJeeInterfacer
  [[[init_settings]]]
    com_port = /dev/ttyUSB0
    com_baud = 38400
  [[[runtimesettings]]]
    pubchannels = ToEmonCMS,
    subchannels = ToRFM12,

Note that ttyUSB0 is typical for me, but your mileage may vary if you have other USB devices attached to your emonBase/emonPi.

I’ve also flipped this around and used the Moteino to listen to the LowPowerLab-based radios, while an RFM69Pi listens to the JeeLibClassic radios. I’ll post about that soon.

2 Likes

Here’s how to go the other way – emonBase with RFM69Pi running the JeeLib Classic radio library while a Moteino USB runs the LowPowerLab radio library.

The quick summary is that on the RFM69Pi you run the JeeLib firmware, while on the Moteino USB you run the LPL emonBase firmware. That firmware can be found in the emonBase_rfm69pi_LPL repository.

In the repo are the two source files.

Put these together in a directory named emonBase_rfm69pi_LPL to use with Arduino’s IDE. Compile and flash the firmware to the Moteino USB, then plug it into your emonBase or emonPi.

The interfacer entry for emonHub configuration is the same as above.

[[MoteinoUSB]]
  Type = EmonHubJeeInterfacer
  [[[init_settings]]]
    com_port = /dev/ttyUSB0
    com_baud = 38400
  [[[runtimesettings]]]
    pubchannels = ToEmonCMS,
    subchannels = ToRFM12,

I learned a number of things when I was trying this out.

First, the Firmware update utility in emonCMS Admin > Update > Update Firmware Only is great. Nice work, OEM team!

This Firmware update utility works really well to switch your RFM69Pi between the JeeLib Classic and LPL firmware.

The Firmware update utility doesn’t currently work to update the firmware in an attached USB device such as a Moteino. There are two reasons for this.

  1. The RFM69Pi update script is hardcoded to work with the GPIO. There’s a clever script that overrides the reset to use GPIO pin 7 on the Pi.
  2. The firmware used by the script is a binary that is compiled for RFM69Pi with its 8mhz internal clock. That’s not an Arduino-compatible board like the Moteino USB, so the .hex firmware is not compatible, even though the source sketch is. So as things stand, the way I would suggest you flash the Moteino firmware is to plug it into your Arduino IDE.

If you want to get the source code from the same place the firmware update script is grabbing it, you can look in /opt/openenergymonitor/EmonScripts/firmware_available.json and find the corresponding repository in the “download_url”.

1 Like

Thanks for sharing @brandock!

1 Like