This document describes a project to design and implement a single-phase smart energy meter capable of detecting power quality events. A group of 4 electrical engineering students developed the meter under faculty guidance. The meter measures supply voltage and current, calculates power parameters, and displays/transmits readings. It uses current and voltage sensors, a microcontroller, and other circuits to acquire data and detect events like voltage variations. The project involved designing sensing circuits, implementing calculations in code, and testing the hardware and software functionality of the smart meter.
1. 1
Design and Implementation of Single Phase Energy meter
with Power quality event detection capability
A minor project report
Submitted in partial fulfilment of the requirements for the degree of
BACHELOR OF TECHNOLOGY in
ELECTRICAL and ELECTRONICS ENGINEERING
By
G. Venkatesh Kamath 14EE117
Pranav M 14EE232
Rakesh S Bali 14EE233
Samudhbhav Prabhu S. 14EE238
Under the guidance of
Prof. K. Panduranga Vittal
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
NATIONAL INSTITUTE OF TECHNOLOGY KARNATAKA
SURATHKAL, MANGALORE - 575025
NOVEMBER 2016
2. 2
DECLARATION
We hereby declare that the Project Work Report entitled Design and
implementation of Single Phase Energy meter with power quality event
detection capability which is being submitted to the National Institute of
Technology Karnataka, Surathkal for the award of the Degree of Bachelor of
Technology in Electrical and Electronics Engineering is a bonafide report of the
research work carried out by us. The material contained in this report has not been
submitted to any other University or Institution for the award of any degree.
(1) G. Venkatesh Kamath (14EE117)
(2) Pranav. M (14EE232)
(3) Rakesh. S. Bali (14EE233)
(4) Samudhbhav Prabhu. S (14EE238)
Department of Electrical and Electronics Engineering
Place: NITK, Surathkal
Date: 21-11-2016
3. 3
CERTIFICATE
This is to certify that the B.Tech. Project Work Report entitled Design and
implementation of Single Phase Energy meter with power quality event
detection capability submitted by:
(1) G. Venkatesh Kamath (14EE117)
(2) Pranav. M (14EE232)
(3) Rakesh. S. Bali (14EE233)
(4) Samudhbhav Prabhu. S (14EE238)
as the record of the work carried out by them, is accepted as the B.Tech. Project
Work Report submission in partial fulfilment of the requirements for the award of
degree of Bachelor of Technology in Electrical and Electronics Engineering.
Signature of the guide
Date:
4. 4
Acknowledgement
As this project opened us to the world of technology in the 21st
century, we would
fail in our duty if we do not thank all the people who made it possible.
We express our gratitude and sincere thanks to our supervisor, Prof. K. P. Vittal,
for his constant motivation and support during the course of our project. We truly
appreciate and value his esteemed guidance and encouragement from the
beginning of our project.
We are also thankful to Mr. Prakash Pawar, a research scholar who has guided us
through the course of this project. His co-operation and assistance in our project
were invaluable.
We would also like to thank our H.O.D. Dr. Vinatha U & all lab maintenance staff
for providing us assistance in various hardware and software problems encountered
during course of our project.
We express our sincere gratitude to all those hands which aided us directly or
indirectly in completing the project successfully.
Group members
5. 5
Abstract
Efficient power consumption and savings has become a major issue these days as
the need for power is increasing day by day. Domestic energy consumer is
unaware of his power usage, means to save it, and also sometimes finds ways to
steal power without paying for it. One more issue is that service provider can’t
predict the power consumption of a specific consumer or a specific area which can
further be used to analyse the load changes of the same.
This has increased the emphasis on the need for accurate and economic methods of
power measurement. The goal of providing such data is to optimize and reduce
their power consumption. The Energy Meter proposed here deals with the
measurement of voltage, current, computation of active power, and energy being
consumed by a consumer and display the information to the consumer and then
send the power and energy being consumed to the computer using Zigbee.
In the designed circuit, these quantities are measured using Arduino. The
measured values are displayed on the LCD screen. Then a Zigbee is interfaced
between the Microcontroller and the PC. Hall Effect Current Sensor ACS712 is
used to measure the current signal and opamp circuit is used to scale down the
supply voltage which can then be sensed by the microcontroller.
Keywords- Hall Effect Sensor, Microcontroller, Smart Energy meter, Arduino,
Zigbee, LCD, Consumer, Energy, Power, Frequency, Phase, Power factor, Total
Harmonic distortion.
6. 6
INDEX
Serial No. Contents Page No.
1
2
3
4
5
6
7
8
9
10
Abstract
Preamble
Principle of Operation
Problem solving methodology
4.1 Voltage sensing
4.2 Current sensing
Calculations
Flowchart
Simulation
Hardware implementation
Future scope
References
5
7
8
9
9
13
18
20
21
23
26
27
7. 7
Preamble
A microcontroller based smart energy meter with data logging capacity is
designed. The electronic meter which consists of a voltage sensing circuit and a
current sensor (ACS712) is used to measure the supply voltage and load current
respectively.
The sampled and digitised values can be used to compute the RMS values of
voltage and current, average power and energy consumption. Subsequently Power
quality parameters may be detected such as Voltage magnitude variations, Voltage
Dips, Power factor, Phase, frequency, Total Harmonic Distortion etc. To achieve
better accuracy a dedicated processor can be used to increase the sampling rate.
Further communication modes with peripherals can be improved for better
performance.
Thus a smart energy meter with the goal of providing such data so as to optimize
and reduce the power consumption is designed and this project of ours is currently
making its way to the world and will certainly reign the world someday.
8. 8
PRINCIPLE OF OPERATION
The system is an amalgamation of different units. The units are described below.
AC voltage (0-230V)
L N
PC
Fig. 1 Block diagram of Energy Meter
A. Data acquisition unit
Acquires the data and processes it as per the requirements so as to suit the
controller. Here we have an analog data which we convert into the digital form.
Again care should be taken to check the ADC requirements so that the data is
faithfully sampled. The block consists of Hall Effect sensor (current sensor), and
level shifter circuits.
B. Data manipulation unit
Performs calculations using the sensed data, i.e. voltage and current to get
parameters like power and energy being consumed, and also various other
parameters such as Power factor, Phase, Frequency, Voltage variation &THD.
Current
sensor
Load
Voltage
sensing
Arduino
ATmega328p Xbee
Tx
Xbee
Rx
LCD
display
9. 9
METHODOLOGY TO MEASURE ENERGY
A. Interfacing analog front end
The analog front end is the part, which interfaces with the high voltage lines.
It conditions high voltages and high currents down to a level which can be
measured directly by the ADC of the microcontroller.
Voltage front end
Supply voltage is first downsized using opamp circuit.
Voltage Scaling: Vout = G × Vin 0<G<∞
Here Vout is the scaled version of Vin.
Why Voltage Scaling?
Since the AC supply voltage is 230V rms, we can’t directly give the input to
microcontroller because microcontrollers can only read voltages from 0-5V. If
input voltage to the microcontroller exceeds 5V it may get damaged. So there
comes the role of voltage scaling.
10. 10
We have estimated some values –
Vin < 360 V peak (254.56 V RMS)
G = 1/200
Vout < 1.8 V
Offset Voltage = 1.8 V (Because microcontroller can’t read negative voltages)
Voltage Sensing: The scaled down voltage is given to one of the analog pins of the
microcontroller (A0-A5) also called ADC pins which senses the voltage.
Scaling circuit using differential amplifier:
Why differential amplifier?
Noise that is common to the power supplies also appears as a common-mode
voltage. Because differential amplifiers reject common-mode voltages, the
system is more immune to external noise.
If differential mode is not used, short circuit may occur. Differential mode isolates
neutral and ground and thereby prevents this problem.
11. 11
Derivation -
Vout = Va + Vb
During positive half cycle -
Va = - (RF / R1 ) × Vin
During negative half cycle -
Vb = Vin × (1+RF/R1) × (R4 / (R4+R2)) ;
Applying superposition law -
Here R4 = RF and R2 = R1
Vout = Vin × (RF/R1)
So we choose RF = 20kΩ and R1 = 2MΩ
Required G = 1/200;
Graphical view of Voltage Scaling
12. 12
Output has been observed in the oscilloscope and virtual terminal as shown in
figure and the results match satisfactorily with the theoretical calculations.
Expected output signal was – sine wave 3.3 Pk-Pk with 1.8V DC offset.
Expected Power was – Vrms * Irms
Vrms = 230 V; Irms = 1 A; P = 230*1 = 230 W
13. 13
Current sensing:
Line current is first downsized using ACS712T 30A current sensor module Fig 1.
Since the sensor output will have a DC offset of 2.5V, a separate circuit for offset
is not required. The sensitivity of the sensor is 66mV/A. For example if 2A line
current flows, the output will be 132mV pk-pk sine wave with 2.5V DC offset.
Now, this output is directly given to ADC input terminal of Arduino through
analog pins.
Fig 1. Fig.2
For current sensing we use current sensor named ACS712.
It is connected in series with the load. The circuitry is shown in Fig. 2
A current sensor is a device that detects electric current (AC or DC) in a wire, and
generates a signal proportional to it.
Vout = K × Iin
K is found out from the ACS712 data sheet to be 66 mV/A.
Final output voltage (Vout) is given to the analog pin A1 of the microcontroller.
Accuracy class of current sensor:
The ACS712 current sensor Provides up to 3000 VRMS galvanic isolation. The
low-profile, small form factor packages are ideal for reducing PCB area over sense
resistor op-amp or bulky current transformer configurations. The low resistance
internal conductor allows for sensing up to 30 A continuous current, providing
typical output error of 1.5%. Hence the class of accuracy of ACS712 is 1.5.
14. 14
Sensor output voltage v/s input current for different values of bias voltage Vcc.
DATA SHEET OF ACS712 CURRENT SENSOR
15. 15
Zero crossing detector:
The sensed voltage is fed to the zero crossing detector. Whenever the input signal is
greater than zero, the output is +15 V and when it’s less than zero it is 0V. The
purpose of using zero crossing detector circuit is primarily for finding the
frequency. Another use is to measure the phase difference between the voltage and
current signal. It is also used for accurate sampling of both the voltage and current
i.e. to sample exactly one cycle of input signal. Hence we are using two zero
crossing detector circuits in total, one for voltage and the other for current. The
output is then sent to Arduino.
16. 16
Zero Crossing Detector for Calculating Frequency
Arduino:
The micro-controller is the most important part of our energy meter. All the
necessary calculations such as finding the rms values of voltage and current,
average power, apparent power, phase, frequency, energy, THD etc. are performed
through microcontroller. At every rising edge of the output of zero crossing
detector circuit, interrupts are generated in the micro-controller. The scaled down
voltage and current signal fed to the analog channels are sampled and then the rms
value is found. Based on the generated interrupts, we find the phase angle and
frequency using the timer.
Datasheet of ATMEL ATMEGA328PPN:
8 Bit Microcontroller, Low Power High Performance, ATmega, 20 MHz, 32 KB, 2 KB, 28
Pins, DIP
17. 17
Specifications:
CPU Speed 20MHz
Program Memory Size 32KB
RAM Memory Size 2KB
No. of Pins 28Pins
MCU Case Style DIP
No. of I/O's 23I/O's
Embedded Interface Type I2C, SPI, USART
Supply Voltage Min
Supply Voltage Max
1.8V
5.5V
Temperature Range: 40°C to 85°C
Speed Grade: 0 - 4MHz@1.8 - 5.5V, 0 - 10MHz@2.7 - 5.5.V, 0
- 20MHz @ 4.5 - 5.5V
Power Consumption at 1MHz, 1.8V, 25 C Active Mode: 0.2mA
Power-down Mode: 0.1μA
Power-save Mode: 0.75μA (Including 32kHz
RTC)
Interfacing Arduino with LCD
The LCDs have a parallel interface, meaning that the microcontroller has to
manipulate several interface pins at once to control the display. The Hitachi-
compatible LCDs can be controlled in two modes: 4-bit or 8-bit. The 4-bit mode
requires seven I/O pins from the Arduino, while the 8-bit mode requires 11 pins.
For displaying text on the screen, you can do almost everything in 4-bit mode.
Below example shows how to control a 2x16 LCD in 4-bit mode.
18. 18
CALCULATIONS:
Voltage and current values are sampled for a certain time and calculations for
RMS Voltage Vrms (Volts), Average power Pavg (Watts), Apparent power Papp
(watts), Energy consumed (kWh) and power factor pf are done using following
equations, where N indicates the number of sampled values.
The results voltage sensing and current sensing circuits with the zero crossing
detectors to measure frequency and phase when interfaced with Arduino gave
satisfactory results as shown below. After finding the phase from zero crossing
detector, apparent power is calculated. The voltage variation is then calculated as a
percentage difference taking 230V as reference. Energy and THD are further
computed.
TOTAL HARMONIC DISTORTION:
Harmonics in the electric power system combine with the fundamental
frequency to create distortion. The level of distortion is directly related to the
frequencies and amplitudes of the harmonic current. The contribution of all
harmonic frequency currents to the fundamental current is known as “Total
Harmonic Distortion” or THD.
Ideal Sine Wave Distorted waveform
19. 19
Harmonics have frequencies that are integer multiples of the waveform’s
fundamental frequency. For example, given a 50Hz fundamental waveform, the
2nd, 3rd, 4th and 5th
harmonic components will be at 100Hz, 150Hz, 200Hz and
250Hz respectively. Thus, harmonic distortion is the degree to which a waveform
deviates from its pure sinusoidal values as a result of the summation of all these
harmonic elements.
Total harmonic distortion, or THD, is the summation of all harmonic components
of the voltage or current waveform compared against the fundamental component
of the voltage or current wave:
i.e THD= [√(Vrms
2
-V1
2
)/ V1]*100 %
where,
V1 is the rms value of fundamental frequency component of voltage waveform,
V2,V3, …Vn are the rms values of harmonic components of voltage waveform.
20. 20
FLOWCHART
START
Initialize variables
Flag1
Sample voltage
Sample current
If
Flag1==1
Flag1=0; Flag2=0
If
Flag2==1
11
T1=read Timer
Flag1
T2=read Timer
Flag1
Find phase using T2-T1
Calculate 𝑽 𝒓𝒎𝒔, 𝑰 𝒓𝒎𝒔, 𝑷 𝒂𝒗𝒈 , 𝑷 𝒂𝒑𝒑,
voltage variation ,THD
Find energy in cumulative fashion
Interrupt service
routine
If voltage
rising edge
! flag1
If current
rising edge
Interrupt service
routine
! flag2
21. 21
SIMULATION:
Schematic of simulation in Proteus 8 professional
The sensing and zero crossing detector circuits are as depicted in the schematic.
The input voltage is scaled down and level shifted by 1.8V DC offset using opamp
circuit. Since the input voltage will be around 326V pk-pk and the scaling factor is
1/200, the output of opamp will be 3.3V pk-pk AC signal with a DC offset of 1.8V.
This is given to A0 pin of the Arduino. Since we are using ACS712 current sensor,
the output of the sensor will be having a DC offset of 2.5V and hence a separate
opamp circuitry to provide a DC offset will not be necessary. The scaled down
output of current sensor, which will be a positive and less than 5V, is given directly
to analog pin A1. The outputs of voltage and current zero crossing detectors are
given to interrupt pins 1 and 2 of the Arduino respectively. With the help of
interrupts, the Arduino can detect the time between two successive rising edges of
voltage (using timers) and then calculate frequency. Also, by knowing the time
between voltage and the next current rising edge, the corresponding phase
difference between voltage and current can be estimated.
22. 22
The scaled down voltage (channel A) and current (channel B) waveforms,
voltage zero crossing detector output (channel C) and current zero crossing
detector output (channel D) waveforms were observed through digital oscilloscope
and the results were satisfactory.
Simulation result
24. 24
Scaled down voltage waveform
with 1.8V DC offset
Here + pin of LM358 is given to
ground and – pin is given to
scaled sinusoidal wave.
Output of the Zero Crossing Detector
25. 25
As stated before, all the results such as rms values of voltage and current, average and apparent
power, phase, frequency, voltage variation, Total harmonic distortion and energy are displayed
on the PC when the entire circuit is interfaced with Arduino. The results that appeared on the
screen after interfacing are shown below:
Analysing the observed values and output found from microcontroller:
Vrms = 220 V (found out from multimeter across rheostat)
Load R = 375 Ω (Rheostat of 400Ω and 1.7A)
Irms = Vrms/R
= 220/375
= 0.5867 A
Apparent Power = Vrms*Irms
= 220 * 0.5867
= 129.0667 W
Power Factor = cos(ɸ) = 1
Average Power = Vrms * Irms * cos(ɸ)
= 129.0667
Voltage Variation (%) = (230-220)/2.30
= 4 %
THD= √(Vrms
2
-Vf
2
)*100/Vf
26. 26
Future Scope:
A data transmission unit can be added. The power, energy and other parameters
measured at the consumer end along with customer id will be then sent to the
service provider via Zigbee for further analysis. On the service provider end,
received data is fed to database using serial communication (RS232) through hyper
terminal.
Interfacing Arduino with Zigbee module
Zigbee based wireless communication subsystem is responsible for receiving
and transferring data. Zigbee wireless open standard technology is being selected
as the energy management and efficiency technology of choice in terms of
reliability and timing. Microcontroller is playing a major role in how energy is
priced and used. Remote monitoring and manipulation is achieved through this
Zigbee module as shown below.
Interfacing Zigbee module with computer
To interact with service provider, receiver end Zigbee module is interfaced
with computer to communicate serially using RS232 through hyper terminal. The
data received is then updated to a file and safely saved in the computer.
27. 27
References:
A. Ahlem, M. Hfaiedh and H. Amira, "Design and implementation of
single phase intelligent Energy meter using a microcontroller
interfaced to PC," Sciences and Techniques of Automatic Control and
Computer Engineering (STA), 2014 15th International Conference on,
Hammamet, 2014, pp. 191-195.
Ameen M. Gargoom, Nesimi Ertugrul and Wen. L. Soong,
“Automatic Classification and Characterization of Power Quality
Events”, IEEE Transactions on Power Delivery, Vol. 23, No. 4, pp.
2417-2425, October 2008.