Smart Meter
Smart Meter
University Of Sharjah
Department of Electrical and Computer Engineering
Senior Design Project (I)
Fall 2011/2012
Done By
|Page1
Senior II Project Design 2012
Acknowledgement
extend our sincere thanks and appreciation to Dr. Mohamed Saad for his
.Bassel Soudan , Dr.Amr Mohamed El Nady and Dr.Ahmed Alwakil for their
information.
Last but not least we would like thank our parents in helping us, guiding us and
supporting us.
|Page2
Senior II Project Design 2012
Table of Contents
Chapter 1 Introduction....1
1.1 Scope.....1
Oscillator....5
|Page3
Senior II Project Design 2012
3.2 LPC2148 Development Board and interference with external
devices....18
3.3.1.3 Interrupt.......22
Communication....25
4.1 Introduction25
|Page4
Senior II Project Design 2012
4.5.2 Xbee-PRO Digi-Mesh 2.4 Configuration Using X-CTU
Software.....32
5.1 Conclusion..35
II.....36
References...38
Appendix.....41
|Page5
Senior II Project Design 2012
Abstract
Utility companies which are working in power consumption data collection projects
are trying to avoid the idea of collecting power data manually from the electricity
meters of the buildings in the urban areas. This report presents the replace design of a
wireless power consumption collection system .Our proposed system was an energy
Our Propose system offers an accurate , inexpensive and efficient solution for wireless
|Page6
Senior II Project Design 2012
( )ADE7757 ( )LPC2148
|Page7
Senior II Project Design 2012
List of Figures
Figure 2.3 Power Signals in Case of unity power factor condition ...8
0.5...8
|Page8
Senior II Project Design 2012
List of Tables
|Page9
Senior II Project Design 2012
List of Terms
ARM7TDMI ARM7+Thumb+Debug+Multiplier+ICE
CF Calibration Frequency
IC Integrated Circuit
IP Instruction Pointer
| P a g e 10
Senior II Project Design 2012
RTC Real Time Clock
ZC ZigBee Coordinator
ZR ZigBee Router
| P a g e 11
Senior II Project Design 2012
List of Symbols
P Power
V Voltage
I Currant
Freq Frequency
T Time
| P a g e 12
Senior II Project Design 2012
Chapter 1
Introduction
1.1 Scope
There is a high demand for an accurate way to collect power consumption data
from meters. We select an inexpensive, fast and accurate wireless power consumption
data collection technique [1] that is based on using digital electricity meter and ZigBee
network to transfer data from the meter to the collector who passes through the building
by vehicle. The collector gets the meter's readings wirelessly from the buildings while
that may affect the resident's convenience and privacy because it depends on a person
that goes to each building and takes the reading. Most of the time, the collector needs
to go inside houses and buildings, that may causes an inconvenience and disturbance to
the people who live in the houses or the buildings. In addition, manual power
consumption data collection may cause a delay in billing and data collection. For
example, when there is no one in the house, the collector needs to come again to take
the reading. Moreover, human errors may arise when the collector takes the reading
from the meter. She/he may miss a reading or confusion between two meters' readings
may occur.
| P a g e 13
Senior II Project Design 2012
This project presents some solutions to the disadvantages of manual power
consumption data collection techniques mentioned above. In this project, digital power
meter is used to measure the power instead of electromechanical meter so that the
readings will be accurate. Moreover, the power consumption data will be sent
automatically through a ZigBee network to the collector while she/he is driving which
ensures the residents privacy and convenience. Getting the readings automatically from
the meter saves the time used in collecting data and improves the billing system.
collection system.
3. Use MCP3905 metering IC to calculate the power of a simple load (light bulb) to
5. Be aware of different kinds of serial interface such as USB, UART and SPI.
7. Use XBee-PRO DigiMesh 2.4 chips to build a simple ZigBee network that
represents the network between a ZigBee transmitter attached to the digital meter
8. Study point-to-point topology to apply it in the ZigBee network between the ZigBee
9. Gain research skills like time management, working as a team, critical thinking and
documentation.
| P a g e 14
Senior II Project Design 2012
ZigBee
Network
Metering IC through the input pins (CH0+, CH0-, CH1+ and CH1-). MCP3905 chip
manipulates the data to find the . Then the result is sent to a ZigBee transmitter module
(XBee-PRO DigiMesh 2.4) using UART cable which is RS-232(The same concept as
the transmitter ZigBee module that is attached to the meter at home) .The transmitter
| P a g e 15
Senior II Project Design 2012
ZigBee module sends the data wirelessly to the a ZigBee receiver module ( The same
concept as the receiver ZigBee module in the collector's car). The receiver Zigbee
database.
| P a g e 16
Senior II Project Design 2012
Power Measurements
This chapter focuses on the principle of obtaining the current and the voltage
values from the load to calculate the real power information. Also it discusses the use
voltages for current and voltage measurements, and produce square signal as an output
with frequency that is proportional to the average real power [1]. MCP3905 is
MCP3905 chip provides two channels to calculate the average real power. The
two channels are channel0 and channel1; channel0 is for the current coming from the
load and channel1 is for the voltage of the load. For each channel there is two analog
fully differential input pair: CH0+ (positive input) and CH0- (negative input) are belong
to channel0, while CH1+ and CH1- are belong to channel 1.The voltage of the signal
at CH0+ and CH0- should not be greater than 470 mV with respect to AGND and the
voltage of the signal at CH1+ , CH1- should not be greater than 660 mV with respect
in series with the load which provides the current-to-voltage-conversion needed by the
MCP3905 chip . The shunt resistor value should be chosen properly depending on some
factors such as power dissipation in the shunt, the thermal management consideration
and shunt quality and tampering consideration. The value of the shunt should be small
to minimize the power dissipation in order to control the thermal values . Also the
resistance of the shunt should be as close as possible to the used wire resistance to
minimize the effect of any attempt to divert the current using an external wire [2]. The
shunt resistance value should not be too small so that it meets the accuracy requirements
at light loads. The voltage will be derived by connecting the CH1 to a potentiometer
and then to the load. The potentiometer is responsible for calibrating the output by
changing the input signal amplitude [3]. The functional block diagram of the MCP3905
| P a g e 18
Senior II Project Design 2012
F0, F1 and F2 are three input pins in MCP3905 that are used to control
1- The low frequency logics output which are Fout1 and Fout2.
The average real power information is obtained from the pulses that go out of
FOUT1 and FOUT2. Before signal goes to output pin, it goes through a digital-to -
frequency converter and then low frequency pulses go out of the chip through FOUT1
and FOUT2 [1]. The following equation relates the input voltages with the output
frequency:
(2.1)
Where:
| P a g e 19
Senior II Project Design 2012
The voltage of the line is obtained from equation (2.2),so that the meter is simply
calibrated by attenuating the line voltage to the Value that we will be obtained from
HFOUT is used to speed up the calibration of meter. Also it has a high frequency
that is equal to the instantaneous real power, so that pulses accumulated over short
period of time [1] . The frequency of HFOUT is calculated as it's given in the following
equation:
(2.2)
Where:
| P a g e 20
Senior II Project Design 2012
a frequency proportional to the value of the average real power. These pulses go as an
input in Microcontroller Unit (MCU). The microcontroller calculates the average real
power depending on the frequency of the signal and the pulse width as discussed in
chapter 3.
power from the load using MCP3905 and the Microcontroller as shown in figure 2.3.
In our project we use MCP30905 Evaluation Board for more information refer to
Fig 2.3 the components that are needed to calculate the average real power
| P a g e 21
Senior II Project Design 2012
Board
The MCP3905 evaluation board has an input prototype area and output
prototype area that provide easy connection with the load and with microcontroller .In
the input area there is high voltage AC input line and load connection .Also there is a
space for the shunt or current transformer for current to voltage conversion in channel
0 .In the middle of the bored there are a set of jumpers , LED and resisters connected
to the MCP3905 to provides different functions .At the output area there is the PIC tail
| P a g e 22
Senior II Project Design 2012
The shunt
(250)
The desired input and output channels are set and chosen using the jumpers in
The output
jumpers
Channel0 and
Channel1
jumpers
Frequency
constant
jumpers
| P a g e 23
Senior II Project Design 2012
We connect the line (220 V) and some loads that have power between 15W and
Fig2.7 The input prototype Area connection with loads and power supply
We connect the evaluation board with the microcontroller from the pin RC0 in
| P a g e 24
Senior II Project Design 2012
Chapter 3
Power Information Processing
3.1 Introduction
the square signal that goes as an output from the MCP3905 Evaluation Board, so the
average real power will be inversely proportional to the pulse width [1]. In order to
obtain the value of the average real power consumed by the load, we use a
microcontroller to calculate the pulse width of the output square signal of MCP3905
Evaluation Board. Also we use the microcontroller to transmit the value of the
power.
width of the square signal that comes as an output of MCP3905 evaluation board.
functions that are need in our project such as serial communication port RS232, bin TX
as shown in figure3.2 [5]. Figure3.3shows the parts of PIC-P40 development board that
| P a g e 25
Senior II Project Design 2012
Fig 3.1 PIC16F877A pin diagram [4] Fig 3.2 PICkit2 programmer [5]
ICSP
RS232
TX pin
PIC16F877A base
Fig 3.3 PIC-P40 development board and the used components in this project [6]
We also use LCD (fig 3.4) to show the value of the average real power that
| P a g e 26
Senior II Project Design 2012
We program the microcontroller using C language by PIC C compiler. Its a smart
compiler that has huge libraries that are designed for PIC registers. [6]
of the average real power consumed by the load and inversely proportional to the pulse
width.[1] The task of the microcontroller PIC16F877A is to calculate the pulse width
of the square signal and calculate the average real power according to equation 3.1 and
send this value to the Zigbee network. We derive equation 3.3 experimentally (as will
The idea of finding the pulse width depends on capturing the falling edges of the signal.
So the task of PIC16F877A is to count the time between two falling edges. In
order to calculate the time between two falling edges; the interrupt function is used. In
our project we use internal and external interrupts. External interrupt is used to
capture each falling edge and internal interrupt is used as a clock to count the number
shows the operation of capturing the falling edges by external interrupt while the
the actual time. We connect RC0 (the output pin) from MCP3905 Evaluation Board to
RB0 in PIC16F877A microcontroller because RB0 is one of the pins that are able to
| P a g e 27
Senior II Project Design 2012
Fig 3.5 capturing the rising or falling edges by external interrupt and counting the number of seconds by internal
interrupt
The idea of getting the value of the pulse width by PIC16F877A is briefly as
follows: when the square signal enters the microcontroller through RB0 pin; an
external interrupt is generated each time there is a falling edge.. In parallel with the
previous process, there is a variable that accumulate the number of milliseconds each
time there is an internal interrupt till the next falling edge ( one cycle is completed ).
The value of the time variable now contains the pulse width value. The
microcontroller calculate the power according to equation 3.1 and displays the power
| P a g e 28
Senior II Project Design 2012
(a)
(c)
| P a g e 29
Senior II Project Design 2012
3.5 Results
In order to extract the relationship between the average real power consumed by a
load to the pulse width of the square signal that goes as an output from MCP3905
evaluation board. We test the project with variety of loads with different power values
and we observe the change in pulse width. Fig 3.7 shows the relation between the
power and the pulse width. Table 3.1 shows the result of testing the code on different
bulbs.
250
200
100
50
0
800 700 600 500 400 300 200 100 0
Pulse Width (ms)
Fig 3.7 The relation between the power and the pulse width
Pulse width
Actual power Experimental value of the power (y) (watt)
(x)(ms)
60 711 59.27735
75 558 72.7642
90 453 86.79833
| P a g e 30
Senior II Project Design 2012
115 301 122.66007
160 208 167.68294
175 200 173.34012
Chapter 4
Transferring Power Consumption
Data Using ZigBee Communication
4.1 Introduction
This Chapter discusses the topology of ZigBee network that power consumption
data are transferred through. ZigBee communication has many features that make
transferring data between the customer and the base station easy and flexible as it will
be discussed in section 4.2. In this chapter we explains the use of point- to -point
wireless communication topology in this project and the configuration steps of Xbee
communication protocol based on an IEEE 802 standard for personal area networks that
invented after WIFI and Bluetooth .It is widely used in applications that require low
data rate and short-range wireless. ZigBee networks require low power consummation
and have a rate of 250 kbps. ZigBee node can go to sleep for a very short time (30ms)
when it's not sending or receiving data which decreases the power consumption and
| P a g e 31
Senior II Project Design 2012
increases the battery life. Using ZigBee technology ensures secure data transmission
and receiving. Also ZigBee network can consist of more number of nodes comparing
ZigBee is a wireless network that supports both star and tree typical networks,
therefore, one of the node in the ZigBee may work as a coordinator to control the
As any network, ZigBee network consists of couple of layers and each layer serves the
higher layer. ZigBee layers are divided to four layers according to ZigBee
specifications and IEEE standards 802.15.4 . The four layers are : application layer ,
network layer, physical layer and medium access control layer as shown in Fig 4.1 [7]
| P a g e 32
Senior II Project Design 2012
tasks depending on its location in the network and its application [7] :
ZigBee Router (ZR): It work as a midpoint between the node and it extends
ZigBee End Device (ZED): The final destination of the network where the
| P a g e 33
Senior II Project Design 2012
Compu
ter +
ZigBee
Digital
Meter +
ZigBee Tx
information from the power measuring chip MCP3905 and manipulating it sets the
UART port to transmit the data to the ZigBee transmitter module (Xbee PRO digi-
A mobile data collector (a collector in a car) collects the data using ZigBee
receiver module (Xbee PRO digi-mesh 2.4) and stores them in a database in a PC
We use Point-to-Point network because it has some advantages such as: it has
the most inexpensive architecture since it needs only two nodes and it doesn't require
| P a g e 34
Senior II Project Design 2012
any external nodes to be added in between. The only disadvantage of this choice is the
International which established in 1985 [11] that produce a variety of products that
support many areas like embedded system products , wireless communications and
integrated circuits .
Xbee PRO digi-mesh 2.4 module meets the requirements of low cost and low power
consumption of ZigBee network design such as sleep mode and it's easy to be used
implementation .
Also one of the main features in Xbee-PRO module that it provides a long data range
extension , which leads to obtain accurate data delivery about 250,000 bps thats work
within the range of 2.4 GHz frequency , and it has up to 90 m coverage of indoor
| P a g e 35
Senior II Project Design 2012
Implementations
DigiMesh2.4 before configuring the two Xbee chips in the project communication part.
Kit starter xbee pro xbp24 dks rf if and rfid contains XBee Boards, Modules,
X-CTU software.
addressing values, accepted frequencies, timing etcwe connect the two modules to a PC
with windows operating system through a USB cable .The main target here is to set
the parameters of both Xbee modules in order to communicate with each other and
To perform test process : we choose USB serial Port in X-CTU window. Then
choose Test/Query button. Its also preferable to check for any new updates of the
firmware by clicking on the Modem Configuration. Then click on the download new
| P a g e 36
Senior II Project Design 2012
versions. Secondly, we click on read button to see and configure XBee-PRO DigiMesh
consideration which is the PAN ID , the value of the Baud Rate and the Addressing
First of all ,PAN ID consist of 4 hex digits which will be used by the
transmitter and the receiver to recognize which network they communicating through
| P a g e 37
Senior II Project Design 2012
The Baud Rate value will be chosen according to the application, so we scroll
down the list and choose the appropriate value as shown in Figure 4.6[10] .
Third , Setting the addresses between the Xbee modules should be compatible
address of chip B should be the destination address of chip A and vice versa[10] .
| P a g e 38
Senior II Project Design 2012
microcontroller through UART cable in the programmed Xbee board .Using three main
pins 5V, Ground and RC7 RX_pin . By default, the received data will be sent to the
second XBee-PRO DigiMesh 2.4 chip through Xbee USB-board Figure 4.7, which will
Now , Both Xbees are ready to communicate with each other and to test this
point-to- point channel , we should open TERMINAL tab in X-CTU software then type
whatever you want to send for example : Hello World ! as shown in Figure 4.7 the
character are in blue followed by red character transmitted and received character
respectively -.
| P a g e 39
Senior II Project Design 2012
By doing the previous steps. The microcontroller now is read to communicate with the
PC [13].
| P a g e 40
Senior II Project Design 2012
Chapter 5
Conclusion and Senior II Plan
5.1 Conclusion
consumption data from a meter without any human interference and with high accuracy
by avoiding billing errors. Also with Automatic Meter Reading this process is fast ,
efficient and inexpensive .The project can be modified in future so that a feedback from
the microcontroller at the collector side can do a certain action depending on the power
consumption reading state , for example if the consumer exceeds the limits a message
| P a g e 41
Senior II Project Design 2012
While working on this project we were looking for compatible prices for all
components and devices. Therefore, we select the appropriate items after studying
prices in the market and compare them to each other, then we chose them according to
their quality and price. The following table shows a detailed information about the total
| P a g e 42
Senior II Project Design 2012
At the end of this project there were a lot of challenges that we faced during this
year. These challenges led to a delay in the design and implementation and sometimes
they led to the re-payment of some components. the list below discusses the main
in using this device, because it is very high-level product, the compilers of this
microcontroller which was easier , more flexible and has a lot of online tutorials
easy .
3- We faced a difficulty in setting the Xbee module, and we tried different types
of these modules. One of modules is not working and the distributer didn't give
us any supply.
| P a g e 43
Senior II Project Design 2012
Based on the difficulties and the challenges mentioned above, we would like to
propose some suggestions that might reduce these problems to our colleagues who are
going to work on their senior design projects and student who will work in this field.
1- The data sheets should be read carefully before deciding buying any device.
2- We recommend not depending on any supplier without making sure that the
3- This project is a power project, so that the researcher should be careful while
working on implementation.
4- Researchers should ask for assistance from laboratory expert to ensure the
| P a g e 44