Home power consumption monitoring using ESP32

Home power consumption monitoring using ESP32
Home Energy Monitoring Grafana Dashboard

Its always fun to collect data around you and understand your needs better. When it comes to power consumption, end of the month bill gives us a pretty good view, but I wanted to make it slightly interesting. I wanted to collect power consumption every second in my house and see how the data looks like.

Components used:

  1. ESP WROOM 32 MCU Module - (Robu.in)
  2. SCT-013-030 Non-invasive AC Current Sensor Clamp Sensor - (Robu.in)
  3. 100k Ohm resistors - 2 pieces
  4. 10uF capacitor - 1 piece
  5. 3.5mm jack female connector - 1 piece

Wiring diagram:

The wiring diagram were taken mostly from this article and OpenEnergyMonitor project. The wiring diagram is same as the standard ones mentioned in these websites. I just didn't want to copy or redo the same as the other articles are already explaining these things at the best.

ESP32 Energy Monitor Circuit
ESP32 Energy Monitor Circuit

As you can clearly see, my soldering skills are not that great. :-)

Software:

With not much changes in the hardware, I did a lot of research on making the software better. Especially with ESP32 having issues in accuracy with its ADC controller, I spent a lot of time making it better.
I used the open source Emon library and added a look up table for my ESP32 ADC which gives a very good results in accurately measuring the analog input. As it is well known each ESP32 needs to be calibrated for ADC. While the recently manufactured ESP32 are calibrated at factory, I still didn't find it quite accurate in my case. So I calibrated and generated a look up table for my chip. The calibration code is available here.

The entire code is available here: ESP32 Home energy monitoring

The ESP32 sketch works as a prometheus exporter making it easy to log the data easily in timeseries. Prometheus also has been my personal favourite in terms of resource usage.

Finally the data is available in Grafana. As I already have a Raspberry Pi running in my house for various other things, I added Prometheus and Grafana for monitoring the energy consumption as well.

Final packing:

ESP32 + SCT-13-030 CT sensor for home power monitoring
Harishankar

Harishankar

An ordinary human with huge passion towards electronics design from childhood. Later seduced by computer programming & became software architect by profession.