One of my side-projects is messing around with energy (electricity) metering and demand management. This needs real-time data, and after looking at a number of options I decided to roll my own...

While there are a number of ways to interrogate a smart meter (e.g. ZigBee, Serial and Optical ports), I wanted an option that is cheap, non-invasive, hacker-friendly, and 'permissionless'. Zigbee is not cheap, not hacker-friendly, and requires multiple permissions (including a Zigbee production cert and utility device authorisation). Optical ports vary by meter and are usually password-protected. Many meters do not have serial ports.

I concluded that the best option was to read the smart meter's consumption LED, and set to work and pulled a little system together that I call 'meterman'.

Image

I have found it to work well for my purposes, and it is also being used for a research trial by Melbourne University at 18 homes. I have no plans to productise it. (Something like an open-source equivalent of a hard-wired Wattwatchers auditor or to a lesser extent a Zigbee smart energy gateway would be better in most cases.)

The basic approach is to read pulses from the smart meter's consumption indicator LED, count these within a set interval (e.g. 15s), and periodically communicate these via a radio message to a server running on a Raspberry Pi. The server maintains a database of readings, and exposes a REST API that allows these to be interrogated, allows data to be adjusted, monitors node health, and provides basic charting.

The main components are:

  • One or more MeterNodes, transmitting energy consumption at set intervals using sub-GHz packet radio (RFM69 @ 434/868/915MHz). The meternode has a companion 'Puck' with a photoresistor for reading pulses on one side, and a red indicator LED on the other. The photoresistor is placed over the smart meter's 'consumption' LED.
Image Image
  • A Gateway, being a Raspberry Pi 'Hat' that bridges the RFM69 network to a Raspberry Pi's UART Serial interface. This could be used as a generic RFM69 to Pi gateway/bridge.
Image
  • A Server that runs on the Pi, maintains energy consumption data, and provides access to this and other operational data through an API.

The meternode and the gateway use cheap 328P MCUs. Firmware is written in C. The meterman server is written in Python, using flask for the REST API, Sqlite as a database, and Bokeh for charting (with a touch of pandas).

A more detailed write-up, PCB designs, and code are on github - MeterNode, Gateway, Server.