Introduction: How to Read Out an Electricity Meter Via Arduino

Often it would be interesting to know the current power consumption or total power consumption of your home to limit your costs for electricity and protect the enviroment. This is not really problem, because mostly you will find a smart digital electricity meter in your installation cabinet. Here in Germany you will find in this case often the DZ541 by Holley Tech from China in your cabinet. This meter is equipped with an optical infrared interface and a RS485 interface to distribute the collected data via the so called SML protocol. In this project we will use the RS485 interface to connect an Arduino to the meter and read out the values for total power consumption and real power.

Step 1: RS485 Connection

To connect the Arduino to the meter via RS485 I've used our Arduino RS485 shield with isolated interface.
The terminals for RS485 of the meter are protected by a plastic cover. This cover is usually locked by a seal. Do not open this cover by yourself. It can be dangerous and a broken seal can be the reason of a lot of trouble with your energy supplier. The best way is to ask an electrician for help. He can connect the cable to the RS485 terminals of the meter and recover the seal.

Now you can connect the A and B terminals of the meter with the A and B terminals of the shield.

Step 2: Jumper and DIP Switch Setting

The RS485 shield is equipped with some jumpers and DIP switches for configuration. Please set the DIP switches in the following way: SW1 - ON, OFF, OFF, OFF (receiver always on) SW2 - OFF, OFF, ON, ON (RS485 mode) SW3 - ON, OFF, OFF, OFF (terminating resistor on) Only two jumper have to been set: JP1 to 5V for Arduino UNO and a second jumper on position RX - 2

Step 3: Code

We are using the UART for debugging and programming. The meter is connected via port D2 and a software UART via 9600 Baud (8N1). The meter is continousely sending the data. The program is looking for special byte sequences in the data stream to find the interesting data packages. For other meters it's may needed to edit the byte sequences or distance between the byte (header) sequences and the interesting data. The decoded values for total power consumption and real power will be displayed in the terminal window of the Arduino IDE.