In this article we will discuss the design of Arduino based energy monitor. How to use readily available emonLib library in energy monitor. Which components are used in Arduino based energy monitor. Schematic diagram, simulation results and code are also explained in this article.
Energy monitoring is a technique which can be used to figure out how much energy a device, a residence or an office is consuming. It’s a very useful method to keep the track of the power consumed by the appliances at any place. It can be used to find out the capacity of the things being operated and can help to find optimal solutions to consume electrical energy in a much more efficient way. It is being said the:
“You can’t manage what you don’t measure!”
What is an energy monitor?
It’s a device used to monitor the various parameters of the electrical energy being consumed at residences or offices. It is not required to connect different expensive meters to measure the how much electoral energy is consumed by device or in a building. A single energy monitor can provide all the valuable information which can help to monitor the energy consumption. The quantities which are shown by energy monitor are real power, apparent power, power factor, the supplied voltage and the current.
Modeling of CT in Proteus
In order to use the energy for high power circuits, Current transformer must be used between energy monitor and circuit. CT is of the components which can vary the reading of simulation from actual reading is the Current Transformer (CT). Because it has the burden which can alter the current being sensed. CT is not provided in Proteus library , therefore in the following section the simulation of CT is being explained in detail which would help to reduce the error between actual reading and simulation.
Calculating a suitable burden resistor size
If it is a voltage output CT you can skip this step and leave out the burden resistor, as the burden resistor is built into the CT.
1) Choose the current range you want to measure
2) Convert maximum RMS current to peak-current by multiplying by √2.
Primary peak-current = RMS current × √2 = 100 A × 1.414 = 141.4A
3) Divide the peak-current by the number of turns in the CT to give the peak-current in the secondary coil.
Suppose the CT has 2000 turns, so the secondary peak current will be:
Secondary peak-current = Primary peak-current / no. of turns = 141.4 A / 2000 = 0.0707A
4) To maximize measurement resolution, the voltage across the burden resistor at peak-current should be equal to one-half of the Arduino analog reference voltage. (AREF / 2)
If you’re using an Arduino running at 5V: AREF / 2 will be 2.5 Volts. So the ideal burden resistance will be:
Ideal burden resistance = (AREF/2) / Secondary peak-current = 2.5 V / 0.0707 A = 35.4 Ω
35 Ω is not a common resistor value. The nearest values either side of 35 Ω are 39 and 33 Ω. Always choose the smaller value, or the maximum load current will create a voltage higher than AREF.
Here are the same calculations a compact form:
Burden Resistor (ohms) = (AREF * CT TURNS) / (2√2 * max primary current)
Note: Calculations have been provided here courtesy of openenergymonitor.org
Interfacing AC-AC adaptor with Arduino:
Following components are used to construct Arduino based energy monitor
- LCD (16×4)
- Arduino (UNO R3)
- Current transformer, CT (for high current circuits)
- potential transformer PT (for high voltage circuits)
- Power supply.
Above components are connected as shown.
Analogue inputs of Arduino only works with positive voltage while the actual singal oscillates around zero between positive and neagitve values. So to enable Arduino to read normal 5V analogue signal, a biasing arrangement is required which can add 2.5V DC to the signal. This arrangement consists of two resistors of 470kΩ and a capacitor of 10uF. Two resistors serve as a voltage divider to add 2.5V DC to the input while capacitor provides low impedance for high frequency components
To display the readings of Arduino based energy monitor, LCD is interfaced with Arduino. To view results on PC screen, data can be sent to PC via USB port using serial communication.
Transformer (TR2) symbolizes CT and TR1 indicating PT. To accommodate the burden of CT, 1.5Ω resistance is connected across transformer. Voltage of circuit is given to TR2 while current will be given to TR1. To enable the deivce to be used in high voltage high current circuits, current and voltages need to be stepped down. So the voltage stepdown ratio of PT (TR1) is 0.05 while that of CT (TR2) is 0.006. The settings of both transformers are shown in the following figures.
To test the working of Arduino based energy monitor, it is simulated in ISIS Proteus with different input voltages and currents. To verify our results, voltmeter, ammeter and two wattmeter are connected with the inputs. The values displayed by Arduino based energy monitor on LCD screen can be cross checked with the values displayed by the meters connected.
Initially in phase current and voltages are applied and the result is shown in the figure. In phase current and voltage means implies to the resistive load in real situations.
It can be seen that all the values shown by energy monitor are almost equal to the values shown by the meters. The slight difference in current is due to the burden on CT.
The power factor shown by energy monitor is 1. From the ratios of power, the power factor can be calculated as
p.f = cos(Φ) = KW/KVA = 0.31/0.31 = 1
So the value of monitor is verified by the values of the wattmeters.
Now to simulate for the inductive load, a time delay must be given to the current. For 30ᵒ phase delay, a time of 0.0016 is entered in current source settings as shown.
The simulation result is shown
To verify the power factor, the same method mentioned as above can be used.
p.f = cos(Φ) = KW/KVA = 0.27/0.31 = 0.87
The value shown by monitor is 0.86 so it verifies our results.
Arduino based energy monitor uses “emonLib library” which is freely available at OpenEnergyMonitor.org. Library can be downloaded from the following link
|#include “EmonLib.h”||// Include Emon Library|
|EnergyMonitor emon1;||// Create an instance|
|// include LCD the library:|
|// initialize the library with the numbers of the interface pins|
|LiquidCrystal lcd(12, 11, 5, 4, 3, 2);|
|Serial.begin(9600);||// set up the LCD’s number of columns and rows:|
|emon1.voltage(2, 234.26, 1.7);||// Voltage: input pin, calibration, phase_shift|
|emon1.current(1, 111.1);||// Current: input pin, calibration.|
|emon1.calcVI(20,2000);||// Calculate all. No.of half wavelengths (crossings), time-out|
|emon1.serialprint();||// Print out all variables (realpower, apparent power, Vrms, Irms, power factor)|
|unsigned int long timemillis=millis();||//keeping the track of the time since the device is switched ON|
|unsigned int long time=timemillis/1000;|
|float realPower = emon1.realPower;||//extract Real Power into variable|
|float apparentPower = emon1.apparentPower;||//extract Apparent Power into variable|
|float powe//extract Apparent Power into variable rFactor = emon1.powerFactor;||//extract Power Factor into Variable|
|float supplyVoltage = emon1.Vrms;||//extract Irms into Variable|
|float Irms = emon1.Irms;|
|//displaying the values|
If you have any questions please ask in comments. Share with your friends if you like it.