Building a Home Energy Monitor with ESP-12E & CT Sensors

A system to control the energy usage and monitoring the current of the 3-Phase AC load of your home in real time.

This system helps you to remotely monitor the used energy for each of the three-phases.
You can also monitor the three-phase line for unbalanced voltage consumption and also ideally equally distribute the load with the consumption over the 3 phases.

The most important components are obviously the ESP-12E microcontroller, 74HC4051 Multiplexer and the 3 x CT sensor (Current Transformer).

I’m using the AC current transformer to measure the AC current indirectly and finally, monitor the data by using Blynk app.


  • ESP-12E microcontroller + 74HC4051 Multiplexer
  • 3 x CT Sensors AC current transformer which has an AC output. (You can use any standard current transformer)
    (This sensors clamp over the main cable and transforms the magnetic field around the cable into a ac voltage.)
  • Blynk Server & Blynk app builder
    (This tool allows you to make apps for your projects by using various widgets. It is available for Android and iOS platforms.)

Software Used:

  • Arduino IDE
  • Blynk Mobile App (for Android or iOS)
  • Libraries: EmonLib, BlynkSimpleEsp32, NTPClient, Time



 Here's the wiring and circuit diagram

Here’s the wiring and circuit diagram


So as we know the ESP-12E has only one single analog input, with an input range of 0 – 1.0V.

ESP-12E and Multiplexer module

ESP-12E with Multiplexer module

The ESP-12E ADC (analog to digital converter) has a resolution of 10 bits.
That’s mean the analog input measures varying voltage levels between 0V to 1.0V.
The measured voltage will assigned to a value between 0 and 1023bits, in which 0V corresponds to 0, and 1.0V corresponds to 1023bits.
To measure the 3 phases we need 3 ADC input. So I’m increasing the number of analog inputs to three by using a 74HC4051 multiplexer.

With the 74HC4051 we can connect up to 8 analog devices to the single analog pin on the ESP-12E (It uses 3 digital pins for addressing, from which two of them will cover my purpose).

The AC current transformer which I’m using has 2000 windings and can measure up to 28 Amps.
We are supposed to adjust the output of the CT in connection with a burden resistor so that the AC output voltage is exactly 1V sine wave.
The formulas Here and the Tool for calculating burden resistor size  helped me in my case.
So for example for a CT with 2000 windings and a burden resistor of 25Ω  I measured a max primary current of about 28A. (35Ω for 20Amps).

Burden Resistor (ohms) = (AREF * CT TURNS) / (2√2 * max primary current)
The value of burden resistor depends on the maximum primary current that we want to measure.
It should be calculated for ESP-12E so that the maximum of the CT output AC voltage is exactly 1V.
Calculating a Suitable Burden Resistor Size for ESP-12E

Burden Resistor and voltage divider for ESP-12E

Burden resistor for maximum primary current of about 28Amps is 25Ω and for 20A is 35.35Ω.

3 phase current transformer

3 phase current transformer

For Burden resistor I used a 100Ω potentiometer and trimming the resistance into 25Ω.

For voltage divider I used a 10kΩ resistor with a 2kΩ potentiometer and trimed the resistance so that the voltage divider took the 3.3V down to 0.5V as a middle point for the 1V ADC range.

Vin = 3.3v
Vout = 0.5v

Voltage Divider Resistor:
R2 = 10kΩ, R1 = 1.785kΩ
Capacitor  = 30µF

The 74HC4051 is an analog multiplexer. This device is a single 8-channel multiplexer. It has three binary control inputs (S0, S1, and S2) which can be controlled by 3 GPIO pins; 14, 12 and 13.
The three binary signals select 1 of 8 channels and connect it to the output (Z).

S0 – Arduino GPIO14
S1  – Arduino GPIO12
S2 – Ground

You are welcome to download or review the program code (Home Energy Monitor) from here.

The video shows my module and their components.

A short video to show the ESP board

Blynk Smartphone

To visualize the data, I created a simple Blynk app by using blynk mobile visual interface.




See more website here...

  • Advertise Here
  • Advertise Here
  • Advertise Here
  • Advertise Here