close-circle
Close
0%
0%

NodeMCU Energy Monitor

IoT ESP8266 (NodeMCU) Shield for Real Power Measurements

Similar projects worth following
close
A NodeMCU shield to measure Real Power by sampling Voltage and Current from the mains. The current is sampled through a clip-on current transducer and the voltage is sampled through an isolation transformer. The voltage sampling circuitry is also used to power the system.

I wanted to have a custom wifi connected solution to sample my energy usage without the need for an extra microcontroller. I looked at existing Arduino + nRF/RFM based solutions. While they had lower power usage and could run off batteries they needed a custom base station for web connectivity.

NodeMCU provides both the microcontroller and wifi functionality. The shortage of ADC channels on the ESP8266 is circumvented by the use of the ADS1115. No extra power supply is needed since the AC waveform used for sampling is rectified and used to power the system. Once installed the system will run until it breaks.

This project runs Arduino based code to upload data every 20s to Thingspeak.

The final assembled system is now complete and available on Tindie.

  • 1 × NodeMCU ESP8266 USB enabled dev board
  • 1 × ADS1115 breakout 16bit D/S ADC
  • 1 × XP Power 5V DC-DC Buck converter high efficiency
  • 1 × YHDC Current Sensor 100A - 10mA transducer
  • 1 × YHDC 12V Transformer Voltage sensor

  • 1
    Step 1

    Wiring up the circuit

    This basic version is for apparent power only. To keep component count low and the circuit as simple as possible the ADS1115 is used in differential mode eliminating the need for bias resistors. The hard part is getting a licensed electrician to wire up the clamp on current sensor to the main wire coming into the premises. Since we have only 1 channel we are going to monitor overall power rather than power per circuit. Follow the Fritzing diagram below to wire up the prototype on a breadboard. Powering the NodeMCU near the switchboard might be an issue as well, so I installed a DIN rail power socket, this will come in handy for real power measurement later on.

  • 2
    Step 2

    Programming the NodeMCU

    I chose to use the Arduino IDE to program the NodeMCU due to the easy availability of relevant libraries and my personal familiarity with the platform. You can get started quite easily using the latest incarnation of the Arduino IDE and the instructions here. The code running on it for basic apparent power is available here.

    This is adapted from the great Emonlib source.
  • 3
    Step 3

    Connecting to Thingspeak

    Connecting to Thingspeak makes it easy to plot the current and save the data being gathered continuously. Create an account and fill in the API key in the Arduino sketch above.

View all 5 instructions

Enjoy this project?

Share

Discussions

kwhiteusc wrote 08/01/2016 at 20:22 point

Looks very nice.  I'm attempting to gather all the devices, but I'm running into problems finding it all.  Is there a part list with more details/part numbers that I'm missing?  

Ah, just saw the tindle.  Ok!

  Are you sure? yes | no

Luke wrote 04/13/2016 at 12:05 point

Hi, Thanks for this project.

I have implemented your code to upload data on emoncms but I would like to know how to properly calibrate the voltage and current readings. I have tried to calibrate the value by trial and error but would like to know what formulas you used to find those values.

  Are you sure? yes | no

Tisham Dhar wrote 01/07/2016 at 13:01 point

Thanks a lot for the positive comment really appreciated. I currently use Thingspeak for data upload and storage. One of my customers for the PCB is using his own server with MQTT. The whole scheme offers a lot of flexibility and choice in how you monitor the energy usage. With the OTA upgrade options for ESP8266 you can also change your mind after setting it up the first time.

  Are you sure? yes | no

seancurtin wrote 11/06/2015 at 10:01 point

Looks really good. I'm very interested in this project. I'd love to see more detail. Is all the data being stored on the device or on a separate server? Or is it just a live monitoring solution with no historic data? What are you presenting to a user, if you're running a web server on the esp8266?? Keep up the great work.

  Are you sure? yes | no

Tisham Dhar wrote 01/17/2017 at 03:42 point

Sorry for the late reply. Data is being uploaded to thingspeak with 20s interval which is their per channel rate limit (more like 16seconds I think). Now that it is a paid service I am considering logging to local microSD and allowing extraction via a web interface/API.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates