Custom sensor nodes

I have the emonbase and emontx setup for for energy monitoring.
I am also setting up home assistant for home automation.
I would like to take advantage of the RF module on the emonbase to receive data from custom (diy) sensor nodes.
Where can I find the rf communications protocol?
Also, is it possible to setup additional categories other than energy and temp? I was thinking of using temp, humidity, motion, etc. I don’t really need to log to the emon database.
Is it possible to write software to listen in on the radio on the emonbase without changing the emonpi software. That way I can just send the data I am interested in to HA via MQTT.
Or would it be easier to get another emon base and use custom software to control it for home automation nodes only? This could be on the HA RPi
I would appreciate any suggestions

Hi Joe,

You can deploy your own custom nodes without modifying any software on the emonBase: it already runs a service called emonHub that will process your custom messages once properly configured.

Have a look at this project as an example: https://github.com/franck102/emon-meter

The protocol is based on the Jeelib RF library: there are quite a few versions floating around, and I’d recommend that you stick with the oem version (see the Readme above).

There is a page about emonHub configuration on the oem site: https://github.com/openenergymonitor/emonhub/blob/emon-pi/configuration.md

W.r.t. catégories you can assign a “tag” to a feed when you create it, I assume this is what you are looking for.

Franck

Thanks a lot Franck. I really appreciate your quick response. I will check out the links.
I knew this would have been done before but I couldn’t find any information

Joe

I am also looking to add another sensor (an ultrasonic water tank level) and looking for some help. I use an emonBase which receives RF from a couple of emontx and emonth units and would like to pick up data from a new node. The new sensor (will) send from an arduino pro micro and 433 MHz sparkfun RFM69 breakout. At the moment I am trying to send some dummy data from this node to the emonBase but without success.
I am using a simple script with RFM69 and SPI libraries, essentially writing a set of integers to the serial port at 38400. My groupID is 210 (as per emonBase) and I’ve setup Node 29 in the emonHub config file to pick up this transmission.
However I’ve never been able to find any hint of a received packet on the emonHub log. I believe the arduino is sending data to the RFM69 transmitter (serial is working) but I’m wondering if the problem is at the emonBase receiving end?
Does anyone have a test script that they can share which might help and debug this?

I’ve not heard of anyone trying this particular combination before.

There’s no intrinsic reason why what you’re doing shouldn’t work. Which library are you using for the RFM69? What might be tripping you up is the JeeLib library that we use isn’t compatible with (say) LowPowerLabs.

I would start by taking one of our demo sketches for the Arduino/emonTx, and keep just the data structure (stuffed with dummy values) and the code to transmit. If that works, build on that.

Also, as I think you realise, emonHub will reject data that doesn’t conform exactly to what it expects. But something should appear in the log if that is set to the right level.

If you have an emonGLCD, I have a “debugger” sketch for that, which shows every valid message received.

Do you realise the emonTx and emonTH can also receive? You could temporarily re-purpose one of those and write a sketch (based on one of the emonGLCD sketches) to examine what was being transmitted.

I’m afraid I can’t help any more without more details.

. . . and just to add another point to what Robert has said above, I noticed the sparkfun “rfm69” breakout uses a RFM69HCW rather than the RFM69CW that we tend to use. This may not be an issue but you need to be sure that is the case, for example, I do not know offhand if JeeLib supports that module as there have been “differences” highlighted in the past but I don’t recall the detail.

Don’t quote me, but I think not. JeeLib is specifically for the JeeNode, and that uses (or used to use) the RFM12B. JeeLib is compatible with the ‘CW’, but the ‘HCW’ uses more registers to control the power amp. This mentions the ‘HCW’, but does not say any more: https://jeelabs.org/book/1522b/.

If, @icenov, you’re up to some low-level programming of the RFM69HCW, get the file “rfm.ino” out of the 3-phase sketch distribution (on the forum, not GitHub) and check the registers that it uses align with the HCW, and add the necessary commands to control the power level. You’ll need data sheets for both the ‘CW’ and the ‘HCW’.
Use that instead of JeeLib.

Thanks @pb66 and @Robert.Wall
The issue might be the library as you suggest - looks like the one suggested for the sparkfun unit is the lowpower labs library RFM69.h.
Unfortunately I don’t have an emonGLCD.
I’ll have a look at the register issues and give it a try at the end of the week as travelling now until Friday.
Would the “Demo Sketch” you mentioned be “emonTH V2 Low Power SI7021 Humidity & Temperature, DS18B20 Temperature & Pulse counting Node Example” in emonth2-3.2.4.zip?

I would suggest something even simpler than that. Try

(You might want to put a delay inside the loop.)

You will need to define the correct data format in emonhub.conf, for help with that either ask again when you know what you want to send, or look here: emonhub/configuration.md at emon-pi · openenergymonitor/emonhub · GitHub

Hi Anthony,

You may want to have a look at this project, I am using the code to send pulse meter data to an emonbase using a pro mini + rfm69 combo:
https://github.com/franck102/emon-meter

As has ben mentioned you are pretty much stuck with the JeeLib library, and what is more there are several forks and you will need to pick the right one.

This thread also has some relevant information:

https://community.openenergymonitor.org/t/unreliable-content-with-rfm69c-and-emonbase/9805/21

Franck

Thanks Franck, I’ll give it a try. I’m still struggling to get 2 RFM69 systems to talk to each other - let alone to OEM. Unfortunately I have 2 different systems - one is the sparkfun pro micro and the other is the Uno. They both have “unique” requirements regarding library support for the rfm69 (and I’m starting to think incompatible…).
Anyway I’ll try your code with the Uno and see if OEM picks up the payload.
Tony

As I understand the situation, Sparkfun promotes the LowPowerLabs library, while we use JeeLib. The message format of JeeLib is incompatible with the inbuilt packet mode of the RFM69 (which is why we and JeeLib need to use it in the RFM12B ‘compatibility’ mode) whereas I understand LowPowerLabs does use the native RM69 packet mode.

The essential difference between the two modes is that compatibility mode requires the processor to handle each byte/character separately, whereas in packet mode, the entire message is handled by the RFM69 and passed to and from the processor in chunks of up to 66 bytes.

Just to update - I gave up trying to get the two different systems to talk to each other, as Robert says they use a different packet mode and it’s beyond my skill set to resolve it. So ended up using 2x Adafruit feather 32u4 RFM69HCW boards, which have the microcontroller and RFM69 on the one board. This works well and I use python and MQTT (on a different rPI) to pass the data into OEM as another input and feed.

Reading on JeeLabs website, I think they too tried their best and couldn’t make JeeLib capable of switching between the two modes. And if they can’t, the prospect for anyone else to do it isn’t good.

It wouldn’t be impossible to switch your OEM sensors etc to use the LowPowerLabs library, but if you’re happy running two parallel systems (any they don’t interact in a bad way), then I wouldn’t change anything.