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




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

About: I like to combine electronics like Arduino's, ESP8266 etc with 3D designing and 3D printing.

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.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Principle Scheme

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.


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.


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.


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

Step 2: 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

Step 3: Programming

The program is published on my Github:

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.

Step 4: Assembling

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.

Step 5: Mounting to the Electricity Meter

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.

Step 6: Powering Up

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!

Arduino Contest 2017

Participated in the
Arduino Contest 2017

Be the First to Share


    • Backyard Contest

      Backyard Contest
    • Silly Hats Speed Challenge

      Silly Hats Speed Challenge
    • Finish It Already Speed Challenge

      Finish It Already Speed Challenge

    6 Discussions


    7 months ago

    Only a short hint: You have a "Smart Meter". Look at the upper right area and you find a round metal plate with two holes in the middle. These are IR-Diodes. One for receiving and one for sending. Use a smartphone and make a visio to see, if the right one is sending every second. I have a similar power meter and the right one is sending a full "SML-Datagram" with consumption, voltage, current, and may more. And you can use a magent to mount a IR-LED.
    Have a look at the tasmota firmware. (german: maybe you can simply use it with a transistor to read all data instead of counting flashes :-)



    Reply 7 months ago

    Thanks for the tip. I checked this, but found out that in my version of the power meter the IR communication is not implemented, apparently it is quite a basic version, only with holes, bu no IR-LEDs. In the mean time I got a newer power meter, so I can not review this point. My newer power meter has more advanced communication, but also this blinking red LED, which I use again.


    2 years ago

    Nice one!

    Edit needed.. change your text where you called the phototransistor a photoresistor? (in 6 places). It's an important difference. I know. I tried to use a photoresistor to make a tachometer but it's too slow to handle that job.


    Reply 2 years ago

    Thanks a lot for pointing at these errors. That is exactly why I used a phototransistor.


    2 years ago

    Fantastic idea! I'd been thinking about trying to sniff the wireless data. This is much better. Well done.


    Reply 2 years ago

    Thank you!