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.
Details
This project runs Arduino based code to upload data every 20s to Thingspeak.
The final assembled system is now complete and available on Tindie.
Components
1×
NodeMCU
ESP8266 USB enabled dev board
1×
ADS1115 breakout
16bit D/S ADC
1×
XP Power 5V
DC-DC Buck converter high efficiency
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.
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.
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?
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.
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.
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.
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.