Tracking Electric Power
In Part 1 of this article series, George began describing an MCU-based system he built to monitor his household energy. Here, he continues that discussion, this time focusing on the electrical power tracking module.
To continue with the description of my energy monitoring system, we’ll now contemplate the electrical power tracking module. But I’d like to remind you once again: I challenged myself to build the system with as many components I already had in my component bins as possible to prove that engineers are a creative bunch and, as the saying goes, “can cook a meal from water.”
To track the electrical energy consumption, you need to know the voltage and the current. Multiplying the two variables you obtain the immediate power P = V × I. Then, by integrating the immediate power over time we’ll get the total energy consumed, most often expressed in kilowatt-hours (kW-hours).
In another project—before I embarked on the design of the energy monitoring system—I tracked my household voltage. Surprisingly, after several months, I found it to be quite steady, specifically 120 ±1.5 VAC—kudos to our power company. As a consequence, the power grid voltage in my area could be considered a constant. Therefore, only the current requires tracking.
Not having to monitor the voltage saves the additional hardware, power consumption and cost. For applications where the line voltage variation is a problem, a dual RMS-to-DC converter almost identical to the one shown in the schematic could be used. Input current transformers would have to be replaced with voltage transformers. In addition to the extra hardware cost and power consumption one would also have to re-think the allocation of the I/O pins in order to stay with Arduino. And, obviously, the software would require modification as well.
The current measurement is performed by two 200 A split-core current transformers , one on each phase conductor as seen in Figure 1. This task requires that you are in the proximity of lethal electrical power. Even though installation of split core transformers is non-invasive—and you don’t have to come in contact with live wires—there is no such thing as being too careful. Even for this simple and quick clamping of the transformers to the insulated power wires, I still turned off the main switch/power interrupter seen in the middle of Figure 1. And note that even turning off the breaker in the middle of Figure 1 doesn’t de-energize the black wires on which the current transformers are actually being installed. Be safe! I didn’t turn the power back on until all the distribution panel covers were safely back in place and affixed by their screws.
Before the transformers are clamped on the wires and the power turned on, make sure the burden resistors are connected to the current transformer leads. I soldered them close to the transformers and covered with heat-shrinkable tubing. Without the burden resistors in place, the open circuit secondary voltage could be fairly high—the manufacturer does not specify and I didn’t test it. It could damage your electronics and perhaps even cause injury.
The current transformers are rated for 200 ARMS (root mean square) with transformation ratio 1:6,000. Therefore, a 200 ARMS primary current flow generates a secondary current of 33.33 mARMS with ±0.5% accuracy and better than 0.2% linearity. This results in approximately 3.3 VRMS or 4.71 VPEAK across the 100 Ω burden resistor.
The current flow is sampled once every second by an interrupt-driven function. The software calculates and maintains its running average. The current average value together with a time stamp and all the other data is written into the log residing on an SD card once every hour on the hour. Once every few months I import the log into an Excel worksheet and create a graph from it. For annual assessment, logging the values once every hour results in 8,760 samples per year (8,784 in leap years), providing sufficient granularity for the data evaluation.
I will address the real-time clock (RTC)in Part 3 of this article series next month (August). The RTC is an integral part of the logger shield. It does not provide for the standard and daylight saving time changes, but it isn’t difficult to write software functions to perform the appropriate changes to the monitoring log. I did it on another project, but it’s an unnecessary complication for this energy monitoring system. I run the monitor on the standard time the year round.
THE CURRENT RMS VALUE
To determine the RMS current, I chose not to use the software approach as William Wachsmann did in his project (Circuit Cellar 327 and 328, October and November 2017 ) because it is too computationally intensive and more than likely Arduino Pro-Mini couldn’t handle it. As I stated earlier, minimizing the power consumption of the monitor was one essential design goal of this project and Arduino Pro-Mini draws significantly less current while providing sufficient I/O resources than most of similar devices, mainly due to the absence of the serial to USB interface.
To get the current RMS value there are dedicated ICs available for the conversion, but they would be an overkill for this project. Similarly, those—and other circuits I considered using—were unsuitable for running off solar power, requiring bipolar or relatively high voltage unipolar supply. However, establishing the RMS value of a sinusoidal voltage or current for digital processing is easy. The RMS value of the transformed current generates RMS voltage across the burden resistor. By rectifying and integrating this voltage you obtain its peak DC voltage value which can be digitized.
Because the utility power is a fairly low distortion sinewave, conversions between its different expressions—that is RMS, peak and average values—can just be performed mathematically. The RMS output voltage of the current transformer loaded by the burden resistor is calculated as:
Figure 2 is the schematic diagram of the circuit converting the input RMS voltage to a corresponding peak DC voltage. The peak voltage equals:
The rectified input VRMS is integrated by the storage capacitors C3 and C4 respectively and digitized by the 10-bit Arduino ADC (analog-to-digital converter). For the purpose of establishing the immediate power, the RMS magnitude is calculated from the digitized peak DC voltage by multiplying it by 0.707 (that is 1/√2).
A 200 ARMS primary current flowing through the current transformer will generate 3.33 VRMS or 4.71 VPEAK across burden resistors R3 and R4. The Microchip dual rail-to-rail op amp MCP6002 is the active element in the rectifier. Though called rail-to-rail, its usable range at 5 V supply voltage is up to about 4.5 V before some non-linearities are introduced. This can be gleaned from Figure 3, showing the output DC voltage versus the primary RMS current. Resistor dividers R5/R7 and R6/R8 respectively are inserted to attenuate the input AC signal to ensure the output voltage caused by 200 A primary current remains in the linear region.
Diodes D1 through D4 are Schottky diodes due to their low forward voltage drop. D1 and D2 clamp the reverse polarity that would otherwise appear on the op amps’ non-inverting nodes to approximately 0.25 V—well within the specification limits. D3 and D4 rectify the AC input, charging capacitors C3 and C4 to the AC peak voltage. Due to the high open loop gain of the op amps (>112 dB or approximately 400,000) and the strong negative feedback, the circuit compensates for the forward voltage drop of the Schottky diodes and rectifies the input AC signal down to 0 V input.
Figure 3 shows the relationship between the RMS current and the output DC voltage to be digitized. Because, as explained above, I reduced the input AC voltage such that the output at 200 ARMS primary current does not exceed 4.5 V, there is a bit of a headroom—though not very linear—extending up to 220 ARMS. As you can see from Figure 3, the peak DC output voltage is linear up to about 210 ARMS current, although I would expect the circuit breaker to disconnect before such current flow magnitude is reached.
I was concerned about the rectifiers’ response to the low current flow where the AC input voltage is less than the Schottky diodes’ forward voltage drop. How is the linearity of the rectified output affected? The response is plotted in Figure 4 as the blue line.
When compared with the ideal red line, there seems to be just a tiny error below 2 A and around 8 A, although it could probably be due to the measurement error. That said, let’s keep this error in perspective. At 10-bit digitization the theoretical system resolution is about 200 mARMS, corresponding to 24 W. The current transformers have 1% tolerance, the resistors 0.1%. At any rate, a low load error is insignificant considering that such a low current would be a rather unusual continuous situation for any household.
Having compared my records with my utility power daily readings available from the Internet I found no adjustments or calibration to be needed. We’ll conclude this project next month in Part 3.
For detailed article references and additional resources go to:
Microchip Technology | www.microchip.com
PUBLISHED IN CIRCUIT CELLAR MAGAZINE • JULY 2019 #348 – Get a PDF of the IssueSponsor this Article