Microcontroller projects

SmartyReader®: Reading encrypted Luxembourgish smartmeter data

last updated: 2021-10-10 (created 2017-08-16)

The SmartyReader® gets the data from P1 interface and sends it to your network per WiFi or Ethernet. You can also use LoRa or LoRaWAN.

As the SmartyReader family grows :). Here the different links:

SmartyReader: Reading Luxembourgish smartmeter data from P1 interface

The Original using a WEMOS/LOLIN D1 mini pro (ESP8266) and communicating via MQTT over WiFi. It is also possible to use an ESP32.


SmartyReader⁵: Reading 5 or 6 Luxembourgish smartmeter (P1 interface)

A Teensy 3.6 is used (6 Uarts!!) to read and publish up to 6 smartmeter over MQTT. It is connected via Ethernet to your network (WiFi possible!).


SmartyReader LED: Reading LEDs with the Creative-Lab IoT-board

The consumption or production can be read on the blinking LED of the smartmeter. A tandem Teensy 2.0 - WEMOS/LOLIN D1 mini pro (ESP8266) gets the data and publishes over MQTT via WiFi.


Intro to smartmeters

Because of the EU Energy Efficiency Directive from 2012 the gas and electricity Distribution System Operators (DSO) in Luxembourg replaced there gas and energy meters with smartmeters (named smarty :(). Besides gas and electricity metering, the system is open for other metering data like water and district heat (M-Bus).
The French group Sagemcom delivered the smartmeters. The model is the T210-D. All meters have to be read by one national central system, operated by a common operator. This is an economic group of interest (G.I.E.) of the 7 Luxembourgian gas and electricity DSO‘s named Luxmetering G.I.E.
Luxmetering is getting the data from 4 registers for active, reactive, import and export energy (1/4h) and the 3 registers for gas, water & heat (1 h) over Power Line Communication (PLC). The smartmeters have also alarms and logs for quality of electrical energy supply (voltage, outages,...) and fraud detection, and calendar functions for the 2 external relays (home applications).

smarty smarty2

The customer wants to get his data and this is possible by reading the blinking LED of the smartmeter. This can be done quite easily by using e.g. the IoT-board.

A better possibility is the 10 second data from the smartmeter P1 port (RJ12 connector under the green lid). The P1 data output communication protocol and format is specified in the Dutch Smart Meter Requirements v5.0.2 . The solution deployed in Luxembourg includes an additional security layer standard that is conform to the IDIS package 2.0 requirement. The encryption layer is based on DLMS security suite 0 algorithm: AES128-GCM. More information can be found in this document.

P1 port

P1 hardware

The P1 port connector is a 6 pole RJ12.

More details in the Dutch Smart Meter Requirements.


As stated the communication on P1 port is encrypted with AES128-GCM (Galois Counter Mode). Each meter has its own 16 byte encryption key. Ask your DSO or Luxmetering for your key. With the key we need the cypher text, 17 byte Additional Authenticated Data (AAD), a 12 byte Initialization Vector (IV) and a 12 byte GCM Tag. The AAD is fix: 0x3000112233445566778899AABBCCDDEEFF. The other data is extracted from the serial stream.


The Initialization Vector (12 byte) consists of the system title (8 byte) and the frame counter (4 byte). The GCM Tag is found at the end of the stream.

More information on AES128-GCM can be found on http://weigu.lu/tutorials/sensors2bus/04_encryption/index.html.

IoT and MQTT

The MQTT-protocol is a publisher/subscriber protocol and it is quite simple to implement this protocol on microcontrollers like the LOLIN D1 mini Pro board (ESP8266). The smartmeter data is published by the LOLIN board over Wifi. It is necessary to run a message server (broker) to distribute the data. I use for this mosquitto on a raspberry pi. The LOLIN board publishes the data and the same raspberry pi with the broker or another computer subscribes to the data and generates p. ex. a graphic.

For testing and debugging you can use the cool MQTT.FX software. It's a JavaFX based MQTT Client based on Eclipse Paho an very comfortable for testing purpose. Downloads on http://www.mqttfx.org.


An alternative software is mqtt-spy.

More information on MQTT can be found on http://weigu.lu/tutorials/sensors2bus/06_mqtt/index.html.