My static website generator using poole https://www.xythobuz.de
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

lora_sml.md 3.2KB

title: Smart Meter Bridge description: Reading SML power meter data transmitted via LoRa parent: smarthome position: 150 git: https://git.xythobuz.de/thomas/esp-env github: https://github.com/xythobuz/esp-env date: 2024-07-06

comments: true

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.

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.

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.

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.

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.

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.