Fork this with Git

Smart Meter Bridge

Reading SML power meter data transmitted via LoRa
Project started on July 06, 2024.

Recent activity on GitHub:

...back to Smart Home overview

A while ago my power net company installed new smart power meters, specifically the Iskra MT681. It has a standardized infrared interface to get some data from it. There are different designs available to attach a microcontroller, both open-source and commercial. I've gone the lazy route and bought one from eBay.

IR TTL Reader with magnetic base

Unfortunately the meter is mounted in the basemet of my apartment building, too far for any WiFi signals. So I decided to try out LoRa to transmit the data, using two Heltec LoRa32 dev boards.

LoRa SML transmitter, outside
LoRa SML transmitter, inside

The interface to the meter is an infrared UART with 9600 8N1. Over this port it sends messages in a format called SML. To decode these I'm using sml_parser.

LoRa SML receiver

To get useful data from the meter you have to unlock it with a PIN from the net provider. Without this PIN you only get the current energy count in kWh, the same number you can see on the display. After unlocking all data, you get the energy count in 1/10th Wh, so much finer resolution. And you also get the current power in W.

Testing the transmitter
Readout of SML messages

For the LoRa PHY I'm using RadioLib, which already comes integrated into the unofficial Heltec LoRa 32 library.

I'm doing lots of deep sleep on the transmitter side, to safe as much battery capacity as possible. And I had to use the watchdog in the ESP32 and also do an auto-reset when no messages have been received after a while. So somewhere the code hangs, sometimes. But with these hacks in place it seems to work well.

The code is integrated into my ESP-Env project and repo.

Example of my power usage
Battery usage of the LoRa transmitter

Here you can see a normal weekend for me, going to bed at 4:30 in the morning, and waking up at around 13:00. The spike with 1.3kW is heating water for coffee. The other power readings come from tasmota sockets or my NAS UPS.

Also the battery usage of the LoRa transmitter is very low. I will update when I have to recharge them for the first time.