Read Your Main Power Electricity Meter (ESP8266, WiFi, MQTT and Openhab)

by Wim3d in Circuits > Sensors

35862 Views, 65 Favorites, 0 Comments

Read Your Main Power Electricity Meter (ESP8266, WiFi, MQTT and Openhab)

Main power meter

In this Instructable you find out how I read my Main Electricity Power use of my house and publish it via an ESP8266, Wifi, MQTT in my Openhab Home Automation.

I have a 'smart meter' ISKRA Type MT372, however it has no easy possiblility to export the data. Therefore I used the LED pulses to read the current Power, the LED pulses 1000 times for 1 kW/h.

Principle Scheme

Meter.png
scheme_photo.png
IMG_20180106_220435.jpg
IMG_20180113_214045.jpg
IMG_20180107_142700.jpg
Scheme2.PNG

The pulses are detected by an ESP8266. However, you need a good and clear '0' and '1'. The pulses are quite weak so I needed some suitable electronic components.

Phototransistor

A photoresistor is not fast enough to detect the short and weak pulses of red light. Based on this Youtube video I choose a phototransistor. By adding a 2M Ohm resistor I could reach about 2V.

Comparator

However, to ensure a clear '0' and '1' I choose to add a LM293 comparator. By connecting a 0.6 V to Vin and the phototransistor the Vref, I got a positive signal in the dark, and a negative signal at the pulse. The appropiate voltages were found by using potentiometers for the Vin and the Vref voltage. With the comparator, I used a 300K resistor.

By using a pull-up resistor on the output, I could get an output difference of almost 3.3V.

The output is shown at the oscillope screen.

ESP8266

The ESP8266 detects the low voltage when there is a pulse. It sends the output data to my MQTT broker. The data is received by:
- Openhab2
- Node-red via which the data is uploaded to Thingspeak

Components

The main components I used:

- 3DU5C Phototransistor (see video for explanation)

- LM293 Comparator

- ESP-01

- several resistors

- prototype PCB

- Buck converter. I use my router power supply of 12V and found out that a LM1117 is not very efficient and gets quite hot.

- ABS box

Programming

Scheme3.PNG
measurement scheme.png
IMG_20180116_214252.jpg
IMG_20180116_214241.jpg

The program is published on my Github: https://github.com/Wim3d/Main_power_meter

See the scheme for the outline of the program and the method the power is calculated.

I program my ESP-01 via a modified USB-programmer. I soldered a button switch between RST and GND forn an easy reset and a slide switch between GPIO0 and GND to boot in in flash mode.

Assembling

IMG_20180114_103232.jpg
IMG_20180113_211220.jpg
IMG_20180113_221034.jpg
IMG_20180113_215024.jpg
IMG_20180114_120737.jpg
Wiring scheme.PNG

Al the parts are soldered to a prototype PCB.

See the pictures and the scheme for explanation.

Blue LED: the blue LED is attached to the output signal of the LM293 comparator an lights independent from the ESP8266.
If there is no pulse (dark), the voltage output from the phototransistor circuit is low, therefore Vref < Vin (steady voltage of 0,6V) and the output of the LM293 is high, no current flows to VCC and the blue LED is OFF.

If there is a pulse (light), the output from the phototransistor circuit is higher (ca. 1.5V) therefore Vref ? Vin (steady voltage of 0.6V) and the output of the LM293 is low, so current flows from VCC and the blue LED is ON.

Green LED: the green LED is attached to GPIO0 of the ESP8266 and pulses if the ESP8266 has detected a good pulse.

Mounting to the Electricity Meter

IMG_20180114_105849.jpg
IMG_20180113_210334.jpg
IMG_20180114_104950.jpg
IMG_20180114_120807_4.jpg

I used some sticky putty for posters to mount the PCB in the box and the box to the meter, not to damage the meter. It is important to drill a hole at the exact position of the LED. Bend the phototransistor pointing down to the LED.

Powering Up

IMG_20180114_103212.jpg
IMG_20180114_103218.jpg
IMG_20180114_103249.jpg
IMG_20180114_103226.jpg
IMG_20180114_130740.jpg
Main power meter
Openhab.PNG

I used some more sticky putty to prevent ambient light shining into the phototransistor as I opened the case in daylight. Drill a small hole in the lid to see the LEDs blink (not on the photos).

Read the values in Openhab to get these cool graphs!