Home / Home made Projects / Arduino Projects / Arduino based power meter using Emon Library

Arduino based power meter using Emon Library

This article assist the user to construct home made Arduino based power meter. The connection diagram is explained in detail. Code required for this project is presented in the end. For verification, the power meter is tested in Proteus software and the findings are discussed.

Introduction to power meter

It is a measuring device, which is used to measure power in electrical power system. Power has usually two types. One is called active power which is measured in watts. The other is called reactive power which is measured in VARS. Available devices to measure power are called watt meters beccause they measure only active power. However in this article an Arduino based power meter is presented which can measure active power, reactive power and real power simultaneously.

Power cannot be measured directly. It is not a simple task. Power is the product of current and voltage in the system. Therefore to measure power, it is needed to sense both current and voltage in the system and find their product. Further to find active (watts) and reactive power (VARS), the phase difference between voltage and current is required, which is normally a cumbersome job. However this article adopts a very simple method to measure all three types of powers using readily availble emon library.

If current = I

Voltage = V

Real or apparent power (VA)  

Active power (watts) 

Reactive power (Vars)

Where Φ is phase angle between voltage and current. The relationship between real, active and reactive power is shown in the following equation.

So by measuring current, voltage and phase difference between the two quantities, all types of powers can be calculated.

Arduino based Power meter

Arduino is user friendly controller which is used extensively in control and automation now days. Arduino is used in a number of projects to accomplish complex tasks in easy and economical way. It has a variety of built in functions however there is no provision to measure power directly. It can only measure analogue or digital voltage. Therefore some extra components and circuitry is needed with Arduino controller to measure power.

Schematic

Following components are used to construct power meter

  • LCD (16×4)
  • Arduino (UNO R3)
  • Current transformer, CT (for high current circuits)
  • potential transformer PT (for high voltage circuits)
  • Power supply.
  • Capacitor

Above components are connected as shown.

Schematic for arduino based power meter

Since Arduino takes positive voltage as analogue inputs (without negative portion) so a biasing arrangement is used. It 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 power factor, 16 bit LCD is interfaced with Arduino. It is also possible to display the power factor on PC. It can be done via serial communication. To understand serial communication please refers to my article serial communication between PIC and PC.

Transformer (TR2) symbolizes CT and TR1 indicating PT.  To cater for 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.  Step down 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.Transformer settings

Simulation results

To test our designed power meter, a test bed is selected as shown below. It consists of a current source representing current of actual circuit and a voltage source representing voltage of real system. To verify our results, readily available wattmeter in Proteus software is employed to verify results of our designed power meter.

Initially the designed power meter is tested for resistive load only. To mimic resistive circuit, no phase difference is given between current and voltage. This can be done by putting 0 in time delay slot of current source settings as shown below.

resistive load settings

The results of first condition is shown

power meter result 1

It can be seen that apparent power is equal to the active power. The reactive power is shown as zero.  It is because the load is only resistive which consumes only active power. The slight error is due to the burden resistance.
Now Arduino based power meter will be checked for the inductive circuit in which the current lags behind voltage by some angle. To simulate this situation, a delay should be given to the current in terms of time. Also for the Proteus built in wattmeter, the angle should be specified in terms of degrees as well for correct reading. It is done as shown below.inductive load settings

The simulation is run for condition when current lags voltage by 30ᵒ. For frequency of 50Hz, the time delay corresponding to angle of 30ᵒ is 0.00167s which is given in current settings block.

power meter results 2

It can be seen from the above figure that values shown by power meter are almost same as wattmeter of the Proteus. The slight difference between the readings is due to the burden resistance of the CT.

The above circuit can also be used to show power factor with very slight modification. It is explained in article, Arduino based power factor meter.

Code 

The code for Arduino based power factor meter is written in C/C++ language and compiled in Arduino IDE compiler.

Advantage of this design is its simplest programming. It does not involve complicated algorithm and long programs unlike other controller based power meter.  It uses a readily available library available at https://github.com/openenergymonitor/EmonLib . This library allows determination of different electrical quantities which includes power factor using few instructions.

#include “EmonLib.h” // Include
EnergyMonitor emon1; // Create an instance
#include <LiquidCrystal.h> // include LCD the library:
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup()
{
  Serial.begin(9600);
  lcd.begin(20, 4);   // 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.
}
void loop()
{
  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 powerFactor= emon1.powerFactor; //extract Power Factor into Variable
  float supplyVoltag = emon1.Vrms; //extract Vrms into Variable
  float Irms = emon1.Irms; //extract Irms into Variable
//displaying the values
lcd.setCursor(5,0);
lcd.print(“Watt Meter”);
lcd.setCursor(0,1);
lcd.print(“(kW)=”);
lcd.print(realPower/1000);
lcd.setCursor(0,2);
lcd.print(“(KVA)=”);
lcd.print(apparentPower/1000);
lcd.setCursor(0,3);
lcd.print(“(KVAR)=”);
lcd.print((sqrt((apparentPower*apparentPower)-(realPower*realPower)))/1000);
}

If you have any questions please ask in comments. Share it with your friends if you like it.

About Syed Noman ud din

Syed Noman ud din is an Electrical Engineer and working in Industry from last 3 years. He writes technical articles for electrical and electronic engineers. He has also published several research publications in renowned international journals.

Check Also

Arduino based energy monitor with Emonlib library

In this article we will discuss the design of Arduino based energy monitor. How to …

3 comments

  1. This information was very useful. Thanks a lot!

  2. Hi there, I have a question, suppose I’ve constructed the entire circuit, as shown in the schematic, except the sources of both transformers on the left side, now if I want to measure the power factor of an AC motor, where exactly do the two terminals go?
    How and where do I connect my load? Is it the 100k ohm resistor on the left side? Or is it the the sources of the transformers, please help this is really confusing me.

    • Thanks for the comment.
      You cannot measure directly. You will require abit of adjustments.
      You will have to use CT and PT because motor current and voltage will be high.
      IF you can find out PT with the same ratio as in the given project than output of PT will replace connections of TR1. If the ratio is different, you may require abit of adjustments in the resistors values. Keep in the mind the limit of arduino inputs range.
      The secondary of CT connected on Motor will replace connections of TR2 however burden resistor need to be removed.

Leave a Reply

Your email address will not be published. Required fields are marked *

*