emonTx & LoRa

Hi all, I wondered if there was a known implementation of using LoRa for either emonTx (or emonPi) using LoRa modules to transmit sensor readings over longer distances. I’ve found a peppering of older posts relating to Lora over the past four years but involve v. specific situations or more complex/advanced LoRaWan projects.

I have a particular use case where our village would like to obtain and publish energy/solar data from multiple, remote community buildings within 300m radius. A powered emonTx + RFM95 combination would seem perfect for the job but checking if there was a working example of an elegant approach somewhere before i embark on this adventure (with inevitably less elegant code). I understand the emonTx RFM69 processes things differently and uses different libraries so not an obvious solution to switch out?

The receiving end seems more straightforward being a Lora receiver converting to MQTT or posting to emonCMS directly.

Grateful for any thoughts, ideas, misadventures shared. Ta

Hello @thedawnbefore it’s not something that we have developed yet and I don’t think I’ve seen anything else on here that would provide a working example. I’d be interested in hearing how you get on though, would it require some clever processing of the emontx data to reduce the data rate? Perhaps just sending kWh elapsed at longer intervals rather than 10s power data?

Thanks @TrystanLea, that’s a helpful steer. I’m still diving into LoRa basics but understand the transmission rate would need to be reduced considerably over a conventional OEM setup.

I had imagined transmission every 5 minutes might be sufficient (even longer) as the purpose is more for community information, engagement and evaluating long-term ROI of some grant-funded solar projects (and eventual EVSE frequency/occupancy) but would be grateful for any thoughts re: transmission rate. I will probably start with this issue.

Yes that sounds good, I have through that for applications like this maybe just recording half hourly kWh consumption would be sufficient, it would be enough for evaluation against variable tariffs. It would be really neat to be able to record a full history of half hourly kWh consumption on some form of memory attached or integrated in a modified emontx like hardware, together with a local real-time clock for accurate allocation. That data could then be uploaded via WiFi or something like LoraWan. It would be particularly useful for projects that we are involved with such as EnergyLocal, but being already stretched with quite a few different things, its’ not something we’ve got on to working on yet.

If you’re going to use emonLibCM, that has been tested, as the documentation states, up to a reporting period of 5 mins. For periods greater than that, the concern would be overflow of the variables that accumulate the values as part of the averaging process, which clearly depends on the power levels experienced.

You might be interested in this https://eandt.theiet.org/content/articles/2021/11/european-scientists-bounce-first-ever-lora-message-off-the-moon/ but when you read it carefully, a little bit of cheating was involved :wink:

I’d be wary of using any library with emonLibCM, because you might find it steals processing time and prevents emonLibCM from sampling correctly - this is why, with the RFM69CW that has a data buffer on-board, we can’t use the ‘classic’ JeeLib (which does not use the buffer). If you have 3-phase supplies, it’s almost guaranteed that the 3-phase sketch will lose lock unless you can fill the data buffer at your leisure and hand off actual transmission of the message to the radio module itself.

1 Like

Interesting idea, agree half hourly would likely be sufficient.

Re. EnergyLocal… what a brilliant initiative. I’ll certainly pass this on

Thanks for the heads up on this, well noted.

I worked out a way to repeat RFM69Pi serial data into a LoRa transceiver to bridge long distances to an emonBase/emonHub/emonPi.

My father is using Open Energy Monitor to monitor a heat pump in his new machine shop. There’s no internet access in the shop, so he was taking his laptop out there periodically and downloading the emonCMS data via browser. I wanted to set up a relay for him so that the Pi base station could be in his house. It would go: OEM sensors in shop → Moteino with RFM69CW in the shop<----->Moteino with LoRa in the shop<-----> Moteino with LoRa in the house —> OEM base station. I think of this as a “relay”, but maybe the better word is “bridge”.

scheme

It works! The shop is about 70 meters from the house with some other building in between. The packets are arriving as expected in the house for over a month now.map

I did this using three Moteinos.

Moteino 1: RFM69 radio receiving packets and repeating them via serial, similar to the receiver used with the Pi Gateway (or in this case, more similar to RFM69Pi from OEM).
Moteino 2: LoRa radio. Listens to serial packets and repeats them via the radio.
Moteino 3: LoRa radio. Receives packets via LoRa and repeats them via serial. Essentially an RFM2Pi.

I found it easiest to wire the serial connection between Moteino 1 and Moteino 2 by flipping the former belly-up (radio side up). I used right angle headers and some protoboard.

There are three sketches needed.

Moteino 1: RFM69Pi2Serial. RFM69Pi receiver to serial. I used the RFM69Pi firmware sketch and modified the serial baud from 38400 to 115200.
Moteino 2: Serial2LoRa. Serial to LoRa. I used the rf95_client example in the RadioHead Examples folder and changed the outbound “Hello World” in the example to the serial input.
Moteino 3: RF95LoRa2Pi. LoRa to Pi gateay. I used the RFM69Pi firmware sketch again, but replaced the JeeLib radio library with the RH library.

2 Likes

NICE work!

The question “how do I get data from a remote sensor” comes up more often than one would think.

Thanks for sharing your take on a solution.

1 Like

What prevented you from using a direct serial connection from the emonTx to Moteino 2?

The shop has quite a few temperature sensors other than the emonTx, all communicating via RFM69CW radios. So Moteino 1 hears from all the sensors, not just emonTx.

I should update the image of the three Moteinos with some sensors around it to make that clearer.

1 Like

Seems a pretty good reason!
(But I didn’t know about those - put it down to a crystal ball failure.)