You are on page 1of 58

ARDUINO ENERGY MEASUREMENT

A Project report on submitted in partial fulfillment of the requirements for


the award of the degree of
BACHELOR OF TECHNOLOGY
IN
ELECTRICAL AND ELECTRONICS ENGINEERING


By
P.SUDHARANI (09241A02B1)
A.DIVYA (09241A0265)
V.HARSHITA (09241A0269)


Under the guidance of
P. SRI VIDYA DEVI
Assistant Professor




Department of Electrical and Electronics Engineering
GOKARAJU RANGARAJU INSTITUTE OF
ENGINEERING & TECHNOLOGY, BACHUPALLY,
HYDERABAD-500090
2009-2013


GOKARAJU RANGARAJU INSTITUTE OF ENGINEERING &
TECHNOLOGY
HYDERABAD, ANDHRA PRADESH
DEPARTMENT OF ELECTRICAL & ELECTRONICS ENGINEERING




C E R T I F I C A T E

This is to certify that the project report entitled ARDUINO ENERGY
MEASUREMENTthat is being submitted by P.SUDHARANI (09241A02B1) A.DIVYA
(09241A0265) V.HARSHITA (09241A0269) in partial fulfillment for the award of the Degree
of Bachelor of Technology in Electrical and Electronics Engineering to the J awaharlal Nehru
Technological University is a record of bonafide work carried out by him under my guidance and
supervision. The results embodied in this project report have not been submitted to any other
University or Institute for the award of any graduation degree.








HOD,EEE Internal guide
(Mr.P.M.Sarma) (Mrs.P.SriVidyaDevi)
Professor ,EEE Assistant Professor,EEE

External Examiner





ACKNOWLEDGEMENT
This is to place on record our appreciation and deep gratitude to the persons without
whose support this project would never see the light of day.
We wish to express our propound sense of gratitude to Mr. P. S. Raju, Director,
G.R.I.E.T for his guidance, encouragement, and for all facilities to complete this project.
We also express our sincere thanks to Mr.P.M. Sarma, Head of the Department,
Electrical and Electronics Engineering, G.R.I.E.T for extending his help.
We have immense pleasure in expressing our thanks and deep sense of gratitude to
our guide Ms. P. SriVidyaDevi, Assistant Professor, Department of Electrical and
Electronics Engineering, G.R.I.E.T for her guidance throughout this project.
We express our gratitude to Mr. E. Venkateshwarlu, Associate Professor,
Department of Electrical and Electronics Engineering, Coordinator, G.R.I.E.T for his
valuable recommendations and for accepting this project report.
We also express my sincere thanks to Mr.M.Chakravarthy,Associate Proffesor for
his help.
Finally we express our sincere gratitude to all the members of faculty and our friends
who contributed their valuable advice and helped to complete the project successfully







P.SUDHARANI (09241A02B1)
A.DIVYA (09241A0265)
V.HARSHITA (09241A0269)



ABSTRACT
The project Energy Measurement using Arduino, aims to determine utilization of
energy.The arduino based power measurement aims to measure power consumption with
higher resolution and consumes lesser power.
Power is rate of expending energy. For d.c circuits and purely resistive a.c circuits,
power is product of voltage and current. For reactive a.c circuits the product of r.m.s values
of voltage and current is termed as apparent power (VA). Real power is the actual power
consumed by the load. The ratio of real power and apparent power in a circuit is called power
factor. Its a practical measure of efficiency.
Arduino is an open-source single board microcontroller, descendant of the
opensource wiring platform designed to make the process of using electronics in multi
disciplinary projects. It is an electronics prototyping platform based on flexible and easy to
use hardware cum software. Arduino uno, a microcontroller board based on the ATmega328
is used in this project.
By using instrument transformers, the current and voltage are reduced to safe values
which are given to offset VI data acquisition, whose outputs serve as inputs to the arduino.
Programming is done in arduino software and the system is interfaced to the arduino kit to
measure energy.









i

CONTENTS
ABSTRACT
LIST OF FIGURES.iv
CHAPTER 1:INTRODUCTION
1.1Introduction...1
1.2overview....2
1.3 Organisation of thesis..2
CHAPTER 2:ENERGY AND POWER
2.1Energy...3
2.1.1 Forms of energy..3
2.1.2 Potentialenergy...3
2.1.3 kinetic energy..3
2.1.4 Sources of energy ...4
2.2 Power...4
2.2.1Types of power measurement..5
2.2.2 DC power....5
2.2.3 AC power........5
2.3 Types of power....6
2.3.1 Active power..6
2.3.2 Reactive power ..6
2.3.3 Apparant power......7
2.3.4 Power factor...7
2.4 Types of power measurement......7
2.4.1 Method1:Powertriangle.8
2.4.2 Method 2: Time delay....8
2.4.3 Method 3:Using Multisim..8
2.4.4 3-Volt meter Method..9
2.4.5 3-Ammeter Method......10
CHAPTER 3:SYSTEM DESIGN
3.1Introduction ..13
3.2 Physical characteristics..14
3.2.1 Hardware...15
ii

3.2.2 Pin description...16
3.3 Communication..............17
3.4 Microcontroller..............................18
3.5 Software....................................................18
3.5.1 Softwares used.19
3.5.2 Arduino Sketch.................................19
3.5.3 Processing Sketch.20
3.5.4 Meguno Link.................23
3.5.5 Load Circuit .....23
3.5.6 Components Required...........................24
3.6 Regulated DC Power supply..24
3.6.1 Components Required...25
3.7 Offset circuit......25
3.7.1 components Required........27
3.8 Block diagram......28
CHAPTER 4:SIMULATION RESULTS
4.1 For Single Load.30
4.2 For Two Loads..31
4.3 For Three Loads.33
4.4 For Variable Loads35
CHAPTER 5:CONCLUSION
5.1 Conclusion 37
5.2 Scope for future work37
REFERENCES
APPENDIX





iii

LIST OF FIGURES
Figure 2.1 Power output in multisim..8
Figure 2.2 3-voltmeter circuit .................................................................................................... 9
Figure 2.3 phasor diagram ....................................................................................................... 10
Figure 2.4 3-ammeter ............................................................................................................... 11
Figure 2.5 Phasor diagram...11
Figure 3.1 Arduino ................................................................................................................... 13
Figure 3.2 Detailed pin diagram.. ........................................................................................... .15
Figure 3.3 Pin mapping18
Figure 3.4 Arduino sketch20
Figure 3.5 Processin sketch..22
Figure 3.6 Megunolink sketch..23
Figure 3.7 Load circuit.23
Figure 3.8 DC Power supply internal cicuit.24
Figure 3.9 Hardware design of DC Power supply circuit ...25
Figure 3.10 Offset circuit ......................................................................................................... 26
Figure 3.11 Offset design.....26
Figure 3.12 Multisim output .................................................................................................... 27
Figure 3.13 Block diagram ...................................................................................................... 28
Figure 3.14 circuit connection ................................................................................................. 29
Figure 4.1 Power output in com window for first load ............................................................ 30
Figure 4.2 graph for power output in meguno link .................................................................. 30
Figure 4.3 Graph for energy output in meguno ....................................................................... 31
Figure 4.4 Graph for power output in processing window ...................................................... 31
Figure 4.5 Com window output for two loads ......................................................................... 32
Figure 4.6 Power output in meguno link ................................................................................. 32
Figure 4.7 Output in processing ............................................................................................... 33
Figure 4.8 Energy graph in meguno link ................................................................................. 33
Figure 4.9 Com window output for three loads ....................................................................... 34
Figure 4.10 Power output in meguno link ............................................................................... 34
Figure 4.11 Output in meguno ................................................................................................. 35
Figure 4.12 Energy output in meguno link .............................................................................. 35

iv

Figure 4.13 Power output in meguno link ............................................................................... 36
Figure 4.14 Output in meguno.36

v


CHAPTER 1
INTRODUCTION
1.1 INTRODUCTION:
The project Enegy Measurement using Arduino, aims to determine energy consumption. The
amount of energy used (or supplied) depends on the power and the time for which it is
used.Energy is the product of power and time. There are many forms of energy, but they all fall
into two categories such as potential,kinetic.
Power is the rate at which work is done (work/time). It is also the rate at which energy is
generated or used.For dc systems, power is expressed in watts and power measurement is carried
out using dc voltage and dc current .For ac systems,the determination of power is more complex.
The voltage and current in an a.c circuit periodically change in direction (alternating current). In a
purely resistive circuit, the voltageand current change direction at the same time (in phase). Power
measurements are made by measuring the RMS current and voltage.
The demand for power has increased exponentially over the last century. This has increased
the emphasis on the performance and efficiency of supplies used in everyday electronics as well
as sophisticated electronic and communication systems.
Arduino is an open-source single board microcontroller, descendant of the open-source wiring
platform designed to make the process of using electronics inmultidisciplinaryprojects. It is an
electronics prototyping platform based on flexible and easy to use hardware cum
software.Arduinouno, a microcontroller board based on the ATmega328 is used in this project.
By using instrument transformers, the current and voltage are reduced to safe values which
are given to offset VI data acquisition, whose outputs serve as inputs to the arduino.
Programming is done in arduino software and the system is interfaced to the arduino kit to
measure energy.
.




1


1.2 OVERVIEW:
The Current transformer and voltage transformer are connected across the resistive
loads.The voltage offset and current offsets are power up by DC Regulted power supply.The
voltage and current are step down to required values by using potential transformer and current
transformer.The outputs which are obtained from voltage and current conditioning cards are
given to the analog pins of Arduino.Power and energy are calculated by using current and
voltage as inputs.The obtained output will be seen by interfacing Arduino with laptop.By using
meguno software the obtained output displayed graphically.

1.3 ORGANISATION OF THESIS
Chapter 1 deals with introduction part and also gives the brief overview of the project.
Chapter 2 presents the basic knowledge regarding energy and various types of
energy,sources of energy and also the power, components of power, power factor, power
measurement and different types of power measurement.
Chapter 3 deals with the hardware and software part of the project .Energy measurement
using Arduino.Hardware part consists of offset cards, regulated dc supply, load circuit and
arduino hardware.The software part consists of programming parts of Arduino, Processing
and Megunolink softwares
chapter 4 contains the simulation results of three loads using Arduino, Processing and
Megunolink softwares and also simulation results for varying loads are shown using
Processing and Megunolink softwares.
Chapter 5 describes the conclusion of the project and scope for future work, which describes
the various methods to extend the project in future.







2


CHAPTER 2
ENERGY AND POWER
2.1 ENERGY:
The amount of energy used (or supplied) depends on the power and the time for which it is
used.Energy makes change; it does things for us. It moves cars along the road and boats over the
water. It bakes a cake in the oven and keeps ice frozen in the freezer. It plays our favorite songs
on the radio and lights our homes. Energy makes our bodies grow and allows our minds to think.
Scientists define energy as the ability to do work.
2.1.1 Forms of Energy:
Energy is found in different forms, such as light, heat, sound, and motion. There are many
forms of energy, but they can all be put into two categories: potential and kinetic.
2.1.2 Potential Energy:
Potential energy is stored energy and the energy of position, or gravitational energy. There are
several forms of potential energy.
Chemical energy is energy stored in the bonds of atoms and molecules. It is the energy that holds
these particles together. Biomass, petroleum, natural gas, and propane are examples ofstored
chemical energy.
Stored mechanical energy is energy stored in objects by the application of a force. Compressed
springs and stretched rubber bands are examples of stored mechanical energy.
Nuclear energy is energy stored in the nucleus of an atom; it is the energy that holds the nucleus
together. The energy can be released when the nuclei are combined or split apart. Nuclear power
plants split the nuclei of uranium atoms in a process called fission. The sun combines the nuclei
of hydrogen atoms in a process called fusion.
Gravitational energy is the energy of position or place. A rock resting at the top of a hill contains
gravitational potential energy.Hydropower, such as water in a reservoir behind a dam, is an
example of gravitational potential energy.
2.1.3 Kinetic Energy:
Kinetic energy is motion; it is the motion of waves, electrons, atoms,molecules, substances, and
objects.
Electrical energy is the movement of electrons. Everything is made of tiny particles called atoms.
Atoms are made of even smaller particles called electrons, protons, and neutrons. Applying a
3


force can make some of the electrons move. Electrons moving through a wire is called circuit
electricity. Lightning is another example of electrical energy.
Radiant energy is electromagnetic energy that travels in transverse waves. Radiant energy
includes visible light, x-rays, gamma rays, and radio waves. Solar energy is an example of radiant
energy.
Thermal energy, or heat, is the internal energy in substances; it is the vibration and movement of
the atoms and molecules within substances. The more thermal energy in a substance, the faster
the atoms and molecules vibrate and move. Geothermal energy is an example of thermal energy.
Motion energy is the movement of objects and substances from one place to another. Objects and
substances move when a force is applied according to Newtons Laws of Motion. Wind is an
example of motion energy.
Sound energy is the movement of energy through substance longitudinal
(compression/rarefaction) waves. Sound is produced when a force causes an object or substance
to vibrate; the energy is transferred through the substance in a longitudinal wave.
2.1.4 Sources of Energy:
We use many different energy sources to do work for us. They are classified into two groups
renewable and nonrenewable. In the United States, most of our energy comes from
Nonrenewable energy sources. Coal, petroleum, natural gas, propane, and uranium are
nonrenewable energy sources. They are used to make electricity, heat our homes, move our cars,
and manufacture all kinds of products. These energy sources are called nonrenewable because
their supplies are limited. Petroleum, for example, was formed millions of years ago from the
remains of ancient sea plants and animals. We cant make more crude oil deposits in a short time.
Renewable energy sources include biomass, geothermal energy, hydropower, solar energy, and
wind energy. They are called renewable because they are replenished in a short time. Day after
day, the sun shines, the wind blows, and the rivers flow. We use renewable energy sources mainly
to make electricity.
2.2 POWER:
Power is the rate at which electrical energy is converted to another form, such as motion, heat,
or an electro magnetic field .The common symbol for power is the uppercase letter P. The
standard unit is the watt and is symbolized by W.( or)Power is the rate at which the energy is
generated or consumed.

4


2.2.1 Types of power measurement:
Power can be measured in D.C and A.C.
2.2.2 D.C Power:
In a DC circuit, a source of V volts, delivering Iamperes, produces P watts according to the
formula P=V*I . When a current of I amperes passes through a resistance of R ohms, then the
power in watts dissipated or converted by that component is given by P =I
2
R
.When a potential
difference of V volts appears across a component having a resistance of R ohms, then the power
in watts dissipated or converted by that component is give by P=V/R.In a DC circuit, power is a
scalar (one-dimensional) quantity.
2.2.3 A.C Power:
For ac systems, the determination of power is more complex. The voltage and current in an
AC circuit periodically change direction (alternating current).
In a purely resistive circuit, the voltageand current change direction at the same time (in
phase). Power measurements are madeby measuring the RMS current and voltage and applying
the formula: P =Vrms * Irms
In the general AC case, the determination of power requires two dimensions, because AC
power is a vector quantity. Assuming there is no reactance (opposition to AC but not to DC) in an
AC circuit, the power can be calculated according to the above formulas for DC, using root-mean-
square values for the alternating current and voltage. If reactance exists, some power is alternately
stored and released by the system. This is called apparent power or reactive power. The resistance
dissipates power as heat or converts it to some other tangible form; this is called true power.
If a reactive element is also present (either capacitive or inductive), the voltage and current no
longer change direction at the same time. Current will lag the voltage when the circuit includes
inductance.Current will lead the voltage when the circuit includes capacitance. The amount of
lead orlag,expressed in degrees, the phase angle ().
The power delivered is P =VIcos. The term cos is the power factor. For a purely reactive
circuit, P =0.A load that includes reactive elements is complex impedance (Z). where X is the
inductive or capacitivereactance in ohms and R is the resistance in ohms. AC power flow has the
three components: real power (also known as active power) (P), measured in watts (W); apparent
5


power (S), measured in volt-amperes(VA); and reactive power (Q), measured in reactive volt-
amperes (var)
2.3 TYPES OF POWER :
1.Reactive power
2.Active power
3.Apparent power
2.3.1 Reactive power: The reactive power is defined as:

Where Vn and in are respectively the voltage and current rms values of the nth harmonics of
the line frequency, and jn is the phase difference between the voltage and the current nth
harmonic.
The fundamental power measurements, as seen in figure 2, are represented in what is known as
the power triangle. Using the three measurements of voltage, current, and the phase offset
between the V and I waveforms, the entire triangle can be computed.
In an electrical system containing purely sinusoidal voltage and current waveforms at a fixed
frequency, the measurement of reactive power is easy and can be accomplished using several
methods without errors. However, in the presence of non-sinusoidal waveforms, the energy
contained in the harmonics causes measurement errors.
2.3.2 Active power: The average active power is defined as:

The implementation of the active power measurement is relatively easy and is done accurately
in most energy meters in the field.
6


2.3.3 Apparent power:
The apparent power is the maximum real power that can be delivered to a load. As Vrms and
Irms are the effective voltage and current delivered to the load,
Apparent power =V
rms
*I
rms

The correct implementation of the apparent energy measurement is bound by the accuracy of
the rms measurements
2.3.4 Power factor:
The power factor of an a.c electrical power system is defined as the ratio of the real power
flowing to the load, to the apparent power in the circuit,and is a dimensionless number between -1
and 1.
A negative power factor occurs when the device which is normally the load starts to generate
power which then flows back towards the device which is normally considered the generator.In an
electric power system, a load with a low power factor draws more current than a load with a high
power factor for the same amount of useful power transferred. The higher currents increase the
energy lost in the distribution system, and require larger wires and other equipment. Because of
the costs of larger equipment and wasted energy, electrical utilities will usually charge a higher
cost to industrial or commercial customers where there is a low power factor.The power factor is
defined as: P/S . In the case of a perfectly sinusoidal waveform, P, Q and S can be expressed as
vectors that form a vector triangle such that S
2
=
P
2
+
Q
2
.If is the phase angle betweessn the
current and voltage, then the power factor is equal to the cosine of the angle , , and

2.4 METHODS OF POWER MEASUREMENT:
Different methods can be used to calculate the reactive power. The theoretical definition of the
reactive power is difficult to implement in an electronic system at a reasonable cost.



7


2.4.1 Method 1:Power triangle
The Power triangle method is based on the assumption that the three energies, apparent, active
and reactive, form a right-angle triangle as shown in Figure 1. The reactive power can

then be processed by estimating the active and apparent energies and applying:
Although this method gives excellent results with pure sinusoidal waveforms, noticeable errors
appear in presence of harmonics .
2.4.2 Method 2: Timedelay
A time delay is introduced to shift one of the waveforms by 90 at the fundamental frequency
and multiply the two waveforms:

Where T is the period of the fundamental. In an electronic DSP system, this method can be
implemented by delaying the samples of one input by the number of samples representing a
quarter-cycle of the fundamental frequency .This method presents drawbacks if the line
frequency changes and the number of samples no longer represents a quarter-cycle of the
fundamental frequency. Significant errors are then introduced to the results.
2.4.3 Method 3:Using Multisim:
The circuit below is a simple inductive load powered from an AC supply. The circuit has been
drawn in MULTISIM and simulated using the virtual instruments shown. Note that the load may
be considered as a separate resistor and inductor which in practice may be properties of a single
device.Note that measuring the voltage and current using multi-meters and calculating the power
gives:
Figure 2.1 power output in multisim

8


2.4.4 3-Volt meter Method of Measuring Choke Coil Parameters:
The choke coil parameters we are going to measure in this 3-voltmeter method are - the
inductance, resistance as all choke coils have inherent resistance in addition to their inductance.
We also measure the quality factor and power absorbed by the given choke coil.
A given choke coil is usually represented by a pure inductance (L) in series with equivalent
resistance (r). This equivalent resistance takes into effect the iron losses in the core of the choke
coil and the inherent resistance of the choke coil. 3-Voltmeter method and 3-Ammeter method are
two of the best ways to measure these two parameters. Thus the equivalent resistance accounts for
the copper loses in the choke coil and the iron loses in the iron core. The following figures
represent the circuit diagram of 3-voltmeter, equivalent circuit of choke coil.



Figure 2.2 3-voltmeter circuit

9


Supply voltage 'V
s
' can be varied by means of the single phase variac. V
R
and V
L
are the
voltmeter readings across the resistance and choke coil. The phasor diagram for the
measurement of choke coil parameters by 3-voltmeter method is as shown below :

Figure 2.3 phasor diagram

From the phasor diagram it is clear that,


2.4.5 3- Ammeter Method of Measuring Choke Coil Parameters:
Aim here is to measure the inductance and inherent resistance of a given choke coil and also to
determine the quality factor using 3-Ammeter method.Equivalent circuit of any choke coil
10


consists of inductance in addition to inherent resistance. Usually, any given choke coil is
represented by a pure inductance (L) in series with equivalent resistance (r). The equivalent
resistance takes into effect the iron losses in the core of choke coil and its inherent resistance as
well. By using 3-Ammeter method and 3-Voltmeter method we can efficiently measure these two
parameters. The circuit diagram for the measurement of choke coil parameters for 3-Ammeter
method is as given below: 3-Ammeter Method
In this method 3-ammeters are used, one of them measure current supplied by the source to the
parallel combination of choke coil and external resistance. The remaining two ammeters measure
the current through choke coil and resistor.

Figure 2.4 3-ammeter method
The vector diagram for the 3-ammeter method is as shown here under along with necessary
formula for finding coil resistance,coil impedance,coil reactance,Q-factor and also the power
absorbed by the choke coil.

Figure 2.5 phasor diagram
11












12


CHAPTER 3
SYSTEM DESIGN
3.1 INTRODUCTION:
Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use
hardware and software.The hardware consists of a simple open source hardware board designed
around an 8-bit Atmel AVR microcontroller, though a new model has been designed around a 32-
bit Atmel ARM. The software consists of a standard programming language compiler and a boot
loader that executes on the microcontroller. Auino can sense the environment by receiving input
from a variety of sensors and can affect its surroundings by controlling lights, motors, and other
actuators.



Figure 3.1 Arduino



13


The Arduino Uno is a microcontroller board based on the ATmega328.It contains everything
needed to support the microcontroller,simply connect it to a computer with a USB cable or power
it with a AC-to-DC adapter or battery to get started.
The Uno differs from all preceding boards in that it does not use the FTDI USB-to-serial driver
chip. Instead, it features the Atmega16U2 (Atmega8U2 up to version R2) programmed as a USB-
to-serial converter.Revision 2 of the Uno board has a resistor pulling the 8U2 HWB line to
ground, making it easier to put into DFU mode.
Revision 3 of the board has the following new features:
pinout: added SDA and SCL pins that are near to the AREF pin and two other new pins placed
near to the RESET pin, the IOREF that allow the shields to adapt to the voltage provided from the
board. In future, shields will be compatible both with the board that use the AVR, which operate
with 5V and with the Arduino Due that operate with 3.3V. The second one is a not connected pin,
that is reserved for future purposes.
Stronger RESET circuit.
Atmega 16U2 replace the 8U2.
"Uno" means one in Italian and is named to mark the upcoming release of Arduino 1.0. The
Uno and version 1.0 will be the reference versions of Arduino, moving forward. The Uno is the
latest in a series of USB Arduino boards, and the reference model for the Arduino platform; for a
comparison with previous versions, see the index of Arduino boards.
3. 2PHYSICAL CHARACTERISTICS:
The maximum length and width of the Uno PCB are 2.7 and 2.1 inches respectively, with the
USB connector and power jack extending beyond the former dimension. Four screw holes allow
the board to be attached to a surface or case. Note that the distance between digital pins 7 and 8 is
160 mil (0.16"), not an even multiple of the 100 mil spacing of the other pins.

SPECIFICATIONS:


Operating Voltage 5V
Input Voltage (recommended) 7-12V
Input Voltage (limits) 6-20V
Digital I/O Pins 14 (of which 6 provide PWM output)
Analog Input Pin 6
14


DC Current per I/O Pin 40 mA
DC Current for 3.3V Pin 50 mA
Flash Memory
32 KB (ATmega328) of which 0.5 KB used by
bootloader
SRAM 2 KB (ATmega328)
EEPROM 1 KB (ATmega328)
Clock Speed 16 MHz
3.2.1Hardware:

Figure 3.2 Detailed pin diagram
Analog Reference pin (orange)
Digital Ground (light green)
Digital Pins 2-13 (green)
Digital Pins 0-1/Serial In/Out - TX/RX (dark green)
In-circuit Serial Programmer (blue-green)
Analog In Pins 0-5 (light blue)
Power and Ground Pins (power: orange, grounds: light orange)
15


External Power Supply In (9-12VDC) - X1 (pink)
Toggles External Power and USB Power (place jumper on two pins closest to desired
supply) - SV1 (purple)
USB (yellow)
Micro controller
3.2.2 Pin description:
Power Pins:
V
in
: The input voltage to the Arduino board when it's using an external power source (as
opposed to 5 volts from the USB connection or other regulated power source). You can supply
voltage through this pin, or, if supplying voltage via the power jack, access it through this pin.
5V: This pin outputs a regulated 5V from the regulator on the board. The board can be
supplied with power either from the DC power jack (7 - 12V), the USB connector (5V), or the
V
in
pin of the board (7-12V). Supplying voltage via the 5V or 3.3V pins bypasses the regulator,
and can damage your board. We don't advise it.
3.3V: A 3.3 volt supply generated by the on-board regulator. Maximum current draw is 50
mA.
GND: Ground pins.
IOREF: This pin on the Arduino board provides the voltage reference with which the
microcontroller operates. A properly configured shield can read the IOREF pin voltage and
select the appropriate power source or enable voltage translators on the outputs for working
with the 5V or 3.3V.
Di gi tal Pi ns:
In addition to the specific functions listed below, the digital pins on an Arduino board can
be used for general purpose input and output via the pinMode(), digitalRead(),
and digitalWrite() commands. Each pin has an internal pull-up resistor which can be turned
on and off using digitalWrite() (w/ a value of HIGH or LOW, respectively) when the pin is
configured as an input. The maximum current per pin is 40 mA.
Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data. On
the ArduinoDiecimila, these pins are connected to the corresponding pins of the FTDI USB-
to-TTL Serial chip. On the Arduino BT, they are connected to the corresponding pins of
16


the WT11 Bluetooth module. On the Arduino Mini and LilyPad Arduino, they are intended
for use with an external TTL serial module (e.g. the Mini-USB Adapter).
External Interrupts: 2 and 3. These pins can be configured to trigger an interrupt on a
low value, a rising or falling edge, or a change in value. See the attachInterrupt() function for
details.
PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analogWrite() function.
On boards with anATmega8, PWM output is available only on pins 9, 10, and 11.
BT Reset: 7. (Arduino BT-only) Connected to the reset line of the bluetooth module.
SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI communication,
which, although provided by the underlying hardware, is not currently included in the Arduino
language.
LED: 13. On the Diecimila and LilyPad, there is a built-in LED connected to digital pin
13. When the pin is HIGH value, the LED is on, when the pin is LOW, it's off.
Anal og Pi ns
In addition to the specific functions listed below, the analog input pins support 10-bit
analog-to-digital conversion (ADC) using the analogRead() function. Most of the analog inputs
can also be used as digital pins: analog input 0 as digital pin 14 through analog input 5 as
digital pin 19. Analog inputs 6 and 7 (present on the Mini and BT) cannot be used as digital
pins.
Other Pi ns
AREF. Reference voltage for the analog inputs. Not currently supported by the Arduino
software.
Reset. (Diecimila-only) Bring this line LOW to reset the microcontroller. Typically used to
add a reset button to shields which block the one on the board.
3. 3COMMUNICATION:
The Arduino Uno has a number of facilities for communicating with a computer, another
Arduino, or other microcontrollers. The ATmega328 provides UART TTL (5V) serial
communication, which is available on digital pins 0 (RX) and 1 (TX). An ATmega16U2 on the
board channels this serial communication over USB and appears as a virtual com port to software
17


on the computer. The '16U2 firmware uses the standard USB COM drivers, and no external driver
is needed. However, on Windows, a .inf file is required. The Arduino software includes a serial
monitor which allows simple textual data to be sent to and from the Arduino board. The RX and
TX LEDs on the board will flash when data is being transmitted via the USB-to-serial chip and
USB connection to the computer (but not for serial communication on pins 0 and 1).
3.4 MICROCONTROLLER:
ATmega168/328-Arduino Pin Mapping:
Note that this chart is for the DIP-package chip. The Arduino Mini is based upon a smaller
physical IC package that includes two extra ADC pins, which are not available in the DIP-
package Arduino implementations.

Figure 3.3 Pin mapping
3.5 SOFTWARE:
The Arduino integrated development environment (IDE) is a cross-platform application written
in J ava, and is derived from the IDE for the Processing programming language and
the Wiring projects. It is designed to introduce programming to artists and other newcomers
unfamiliar with software development. It includes a code editor with features such as syntax
highlighting, brace matching, and automatic indentation, and is also capable of compiling and
uploading programs to the board with a single click. There is typically no need to
edit makefiles or run programs on a command-line interface.
Arduino programs are written in C or C++. The Arduino IDE comes with a software
library called "Wiring" from the original Wiring project, which makes many common
input/output operations much easier. This software works on Windows, Mac OS X or Linux
operating systems.
18


3.5.1 Softwares used:
The softwares used for this project are Arduino Software and Processing software. The
processing software used to display the graph.Arduino software is used to calculate the power by
taking voltage and currents as inputs.
3.5.2 Arduino Sketch:
Arduino sketch consists of two basic functions namely,
1. Void setup()
2. Void loop()
1. Void setup():
Setup() is called when a sketch starts. It is used to initialize variables, pin modes, start using
libraries etc. The setup() will only run once, after each powerup or reset of the Arduino board.
Syntax:
Void setup()
{
Statements;
}
2. Void loop():
After creating a setup()function which initializes and sets the initial values, the loop() function
does precisely what its name suggests, and loops consecutively, allowing your program to change
and respond. It is used to actively control the Arduino board.
Syntax:
Void loop()
{
Statements;
}
19



Figure 3.4 Arduino sketch
3.5.3 Processing:
Processing is an open source programming language and environment for creating graphs,
images, animations, and interactions. Initially developed to serve as a software sketchbook and to
teach fundamentals of computer programming within a visual context, Processing also has
evolved into a tool for generating finished professional work. Today, there are tens of thousands
of students, artists, designers, researchers, and hobbyists who use Processing for learning,
prototyping, and production.
Programming using Processing software uses three basic functions namely
1. Void setup()
2. Void draw()
3. Void serial event()



20


1.Void setup( ):
The setup( ) function is called once when the program starts. It is used to define initial
environment properties such as screen size and background color and to load media such as
images and fonts as the program starts. There can only be one setup() function for each program
and it shouldn't be called again after its initial execution.
Note: Variables declared within setup( ) are not accessible within other functions,
including draw( ).
Syntax:
Void setup( )
{
statements
}
2. Void draw( ):
It is called directly after setup( ), the draw( ) function continuously executes the lines of code
contained inside its block until the program is stopped or noLoop( ) is called. draw() is called
automatically and should never be called explicitly.
It should always be controlled with noLoop( ), redraw( ) and loop( ). After noLoop() stops
the code in draw( ) from executing, redraw() causes the code inside draw() to execute once,
and loop( ) will cause the code inside draw() to resume executing continuously.
The number of times draw() executes in each second may be controlled with
theframeRate() function. There can only be one draw( ) function for each sketch,
and draw() must exist if you want the code to run continuously, or to process events such
as mousePressed(). Sometimes, you might have an empty call to draw() in your program.
Syntax:
Void draw( )
{
Statements;
}


21


3.Void serialEvent( ):
It is called when data is available. Use one of the read() methods to capture this data.
TheserialEvent() can be set with buffer() to only trigger after a certain number of data elements
are read and can be set with bufferUntil() to only trigger after a specific character is read.
The which parameter contains the name of the port where new data is available, but is only useful
when there is more than one serial connection open and it's necessary to distinguish between the
two.
Syntax:
Void serialEvent(which port)
{
Statements;
}

Figure 3.5 processing sketch



22


3.5.4 MegunoLink:
MegunoLink is a free program to upload compiled binary files to the Arduino micro
controller and monitor communications from the device. It allows you to go away from the
simple Arduino development environment and use a more full featured environment.

Figure 3.6 megunolink sketch
3.5.5 Load circuit:
Load circuit consists of resistive(BULBS OF 200W each) loads with switches.Also it
consists of CT and PT which are energized by the DC supply and they are used to stepdown
the current and voltage.
The rating of PT used in this load circuit is 230/3v
We have connected a resistor across the output terminals of CT.Hence we are expressing
the rating of CT in volts.
The rating of CT IS 230/3V

Figure 3.7 load circuit


















23



3.5.6 Components required:
Current transformer: A current transformer (CT) is used for measurement of electric
currents. Current transformers, together with voltage transformers (VT) (potential transformers
(PT)), are known as Instrument transformers. When current in a circuit is too high to directly
apply to measuring instruments, a current transformer produces a reduced current accurately
proportional to the current in the circuit, which can be conveniently connected to measuring
and recording instruments. A current transformer also isolates the measuring instruments from
what may be very high voltage in the monitored circuit. Current transformers are commonly
used in metering and protective relays in the Electrical power industry.
Potential transformer:Transformer utilized to provide an output voltage different than the
input voltage. It is a step-down transformer when the output voltage is lower than the input
voltage, or a step-up transformer when the output is higher than the input voltage. Used, for
instance, as an instrument transformer. Also called voltage transformer.
Resistive load:Bulbs of 200w each
Switches.
3.6 REGULATED DC POWER SUPPLY:
By using regulated DC power supply hardware design we can get variable dc as shown.


Figure 3.8 DC Power supply internal circuit
24



Figure 3.9 Hardware design of DC Power supply circuit

3.6.1 Components required:
Transformer T1 can be a 230V primary; 15-0-15 V, 1A secondary step-down transformer.
Fuse F1 can be a 500mA fuse.
Capacitor C1,C2,C5 and C6 must be rated at least 50V.
The circuit given here is of a regulated dual power supply that provides +12V and -12V
from the AC mains. A power supply like this is a very essential tool on the work bench of an
electronic hobbyist.
The transformer T1 steps down the AC mains voltage and diodes D1, D2, D3 and D4
does the job of rectification. Capacitors C1 and C2 does the job of filtering.C3, C4, C7and C8
are decoupling capacitors. IC 7812 and 7912 are used for the purpose of voltage regulation in
which the former is a positive 12V regulator and later is a negative 12V regulator. The output
of 7812 will be +12V and that of 7912 will be -12V.
3.7 OFFSET CIRCUIT:
Necessicity of offset is ,as Arduino does not allow the Alternating waveforms of
voltage andcurrent we are using offset circuit to offset the voltage and current waveforms.
25



Figure 3.10 offset circuit simulation in multisim


Figure 3.11 offset design
26


3.7.1 Components required :
LM 741 IC
Resistors
Diodes 1N4007
Offset circuit output:

Figure 3.12 multisim output

Offsetvoltage,or current is the result of a difference in voltage,and current between the outputs
of two operation amplifiers, or op amps. It is present in all real-world circuits where two op amps
of opposing charges of the same value are grounded and yet still produce a small charge that is
not quite zero.
27


We require two offset circuits voltage offset and current offset.First amplifier is used as the
summing amplifier,in inverting mode.This Amplifier adds up the AC signal with the reference
voltage.where as, second amplifier is used to invert the output of the first amplifier.
3.8 BLOCK DIAGRAM:

The following diagram describes briefly about how the hardware of the project will be


Figure 3.13 Complete block diagram ofArduino Energy Measurement

28



Figure 3.14 circuit connection

The Current transformer and voltage transformer are connected across the resistive loads.The
voltage offset and current offsets are power up by DC Regulted power supply.The voltage and
current are step down to required values by using potential transformer and current
transformer.the outputs which are otaibed from voltage and current conditioning cards are given
to the analog pins of A0,A2 in the Arduino board.Both the ground pins are given to the grund pins
present in aurdino boar respectively.The programming part id done in the Arduino software and is
dumped in a microcontroller.The obtained output will be seen by interfacing Arduino with
laptop.By using some processing softwares like processing and meguno softwares the obtained
output can be displayed graphically.





29


CHAPTER 4
SIMULATION RESULTS
4.1 FOR SINGLE LOAD:
When the first load of 200watts is switched on, the Arduino Serial monitor displays the
average power consumed and utilized enegy in its COM window as shown in figure(a).
Graphically it can be obtained using Megunolink software and Processing software. The figure(b)
represents a graph between average power in watts and time in seconds using Megunolink
software. Figure(C) represents the energy graph in megunolink.Figure (d) represents the graph
which is displayed using Processing software.

Figure 4.1 Power output in com window for first load









Figure 4.2 graph for power output in meguno link
30



Figure 4.3 Graph for energy output in megunolink


Figure 4.4 Graph for power output in processing window

4.2 FOR TWO LOADS:
When two bulbs each of rating 200watts is switched on, the average power and utilized
energy values in the serial monitor shown in the figure (a) Iinstead of 400watts 415 watts are
showndue to the losses such as corelosses. The figure(b) represents a graph between average
power in watts and time in seconds using Megunolink software. From this graph we can
observe the change in average power consumed when the second load is switched on. Figure(c)
represents the graph in processing software.Figure (d) represents the energy graph which is
displayed using megunolink.
31


.
Figure 4.5 com window output for two loads


Figure 4.6 power output in meguno link

32



Figure 4.7 output in processing

Figure 4.8 energy graph in meguno link

4.3 FOR THREE LOADS:
When three loads are switched on(having a total rating of 600watts), the average power
values and utilized energy shown in the figure (a). The figure (b) represents a graph between
average power in watts and time in seconds using Megunolink software. From this graph we can
observe the change in average power consumed when the third load is switched on. Figure (c)
33


represents the graph which is displayed using Processing software. Figure(d) represents the
energy graph in megunolink.

Figure 4.9 Com window output for three loads

Figure 4.10 Power output in meguno link
34



Figure 4.11 output in meguno

Figure 4.12 Energy output in meguno link

4.4 FOR VARIABLE LOADS:
If the loads are increased and decreased in a step wise manner then the graphs obtained in
Megunolink and Processing softwares will be as follows respectively.
35



Figure 4.13 Power output in meguno link

Figure 4.14 Output in meguno




36


CHAPTER 5
CONCLUSION
5.1 CONCLUSION:
Energy measurement is done for resistive loads up to a maximum load of 600watts using
Arduino software,results for three loads are shown in simulation results. The disadvantages of
Labview over Arduino are it has complex programming and it is very expensive when compared
to other programming languages. Labview takes more time and also it is not open source
software. Arduino energy Measurement is an advanced method of determining energy and this
method is more advantageous than other softwares. Arduino is an open source software and can
be extended by experienced programmers such as C and C++. Arduino has simple and clear
programming environment.
5.2 FUTURE SCOPE:
Energy and Power can be measured using various methods. One of the best method is using
Arduino. Energy can be calculated by interfacing Arduino sketch with hardware equipment.
This method is more reliable and easy compared to other softwares to calculate energy
consumption .
This method further may be extended as wireless power meter for calculating power at
different time intervals and energy meter for calculating amount of energy. It can be extended as
Home Energy Monitoring via flashing LED on Meter.
To build a simple electricity energy monitor on that can be used to measure how much
electrical energy you use in your home. It measures voltage with an AC to AC power adapter and
current with a clip on CT sensor, making the setup quite safe as no high voltage work is needed.
This project can be exetended as Arduino Energy Meter which meets wide application as
autonomous system that will measure the consumption of energy of our homes and will inform
us about the cost we have to pay.It can also be extended as Induction Meter using Parallax LCD
and KA393 Comparator.




37


REFFERENCES

[1] http://en.wikipedia.org/wiki/Power
[2] www.datasheeetcatalog.co
[3] Ramakant A. Gayakward, Op-Amps and Linear Integrated Circuits, Fourth Edition,
PHI,1987
[4] www.blueleafsoftware.com
[5] www.arduino.cc





























APPENDIX -A
ARDUINO PROGRAMMING:

#include <Boards.h>
#include <Firmata.h>
#include <GraphSeries.h>
GraphSeries g_aGraphs[] ={"energy(wh)"};
float Voltage =A0;
float Current =A2;
float I =0;
float V =0;
float P =0;
float P1 =0;
float E =0;
unsigned long time;
void setup()
{
Serial.begin(9600);
pinMode(Voltage,INPUT);
pinMode(Current,INPUT);
pinMode(P1,OUTPUT);
}
void loop()
{
float realPower =0;
for(int i=0;i<400;i++)
{
float P =0;
V=((analogRead(Voltage)-(2.3*204.6))/204.6)*(66.474*1.414);
I=((analogRead(Current)-(2.22*204.6))/(204.6*20))*(76.667*1.414);
P=V*I;
realPower=realPower+abs(P);
delay(0.05);
}



P1=realPower/400.0;
time=millis();
E=(P1*time*0.001)/(3600);
delay(1);
Serial.println(E);
g_aGraphs[0].SendData(E);

}
ABOUT PROGRAMM:
Firstly,the analog voltage is defined and initialized to analog pin A0 of Arduino
board.
Analog current is defined and initialized to analog pin A2 of Arduino board.
The variables V,I,Avgpower are defined and initialized for programming purpose.
The power measurement is carried out by using
In void setup( )
The serial data is initialized by using some boderate.
Pinmodes function is used to set voltage and current as inputs and power as output.
In void loop( )
The variable P1 initialised.
For calculating average power we are running a loop for number of instants.
In this loop,the variable P is initialized.
Voltage is negatively offsetted in bytes and it is converted into decimal then it is
multiplied by transformation ratio of potential transformer to get actual voltage
waveform.
Similarly,Current is negatively offsetted in bytes and it is converted into decimal,As
there is a resistor connected across output terminals of current transformer,the
current is measured interms of voltage,inorder to convert current to voltage the
obtained value is divided by the value of resistor,then it is multiplied by the
transformation ratio of current transformer to get actual current waveform.
Power is calculated by multiplying the obtained values of voltage and
current(P=V*I).
This is the power at an instant.
The power is getting added at all instants with some delay.



Average power is calculated by dividing the total power with the number of samples.
Average power is printed by using serial.println command.
Time is calculated by using millis function.
Energy is calculated by multipliying power and time.





APPENDIX-B
PROCESSING PROGRAMMING:
i mpor t pr ocessi ng. ser i al . *;
Ser i al Por t ;
i nt xPos = 1;
f l oat del y=10;
voi d set up ( )
{
si ze( 800, 800) ;
pr i nt l n( Ser i al . l i st ( ) ) ;
Por t = new Ser i al ( t hi s, " COM19" , 9600) ;
Por t . buf f er Unt i l ( ' \ n' ) ;
backgr ound( 0) ;
}
voi d dr aw ( )
{
}
voi d ser i al Event ( Ser i al Por t )
{

St r i ng i nSt r i ng = Por t . r eadSt r i ngUnt i l ( ' \ n' ) ;
i f ( i nSt r i ng ! = nul l )
{
i nSt r i ng = t r i m( i nSt r i ng) ;
f l oat i nByt e = f l oat ( i nSt r i ng) ;
f l oat i nByt e2 = f l oat ( i nSt r i ng) ;
i nByt e = map( i nByt e, 0, 1023, 0, hei ght ) ;
i nByt e2= map( i nByt e2, 0, 1023, 0, hei ght ) ;
st r oke( 127, 34, 255) ;
noFi l l ( ) ;
l i ne( xPos, i nByt e+del y, xPos, i nByt e ) ;
l i ne( xPos, i nByt e2- del y, xPos, i nByt e2) ;
i f ( xPos >= wi dt h)
{




backgr ound( 0) ;
xPos =0;
}
el se
{
xPos++;
}
}
}
ABOUT PROGRAMMING:
In this first we are importing the values of power from the com window of the
ARDUINO.
Two variables are are defined and initialized for x and y positions.
In processing the main programming parts are
Void setup( )
Void draw()
In void setup( )
The size of the display screen is initialized using size function.
Then the comport is set same as that of ARDUINO
All the values from the comport are red until a newline character is encountered.
In void draw( )
This function is used to display 3-D geometry.
The comport data is processed using void serial event( )
All the strings from the ARDUINO are red until a new line character is encountered.
If the string value is equal to null then the control will jumps out of the loop.
If it is not equal to null,all the spaces from beginning to end of the string including tab
spaces are removed using trim function.
Then it is given to float variable.
All the numbers in the string are remapped from one range to another range using
map function.
A line function is defined with 4 parameters to display 2-D line.
Stroke function is used to color the line.
Nofill function is used to disable the 3-D geometry.



Then,the position of x variable and width of the display screen are checked.
If the position of x variable greater than the width of the screen then it is re-initialised
from zero else it is incremented.
Background function is used to color the background of the display screen.
































APPENDIX-C

You might also like