GSM Based Energy Meter
GSM Based Energy Meter
GSM Based Energy Meter
TOPICS
Certificates
Acknowledgement........
CHAPTE !" INTOD#CTION
!.! Introd$ction of t%e &ro'ect
!.( Pro'ect o)er)iew...
!.* T%esis
CHAPTE (" E+,EDDED S-STE+S
(.! Introd$ction to em.edded s/stems
(.( Need of em.edded s/stems...
(.* E0&lanation of em.edded s/stems...
(.1 A&&lications of em.edded s/stems
CHAPTE *" HAD2AE DESCIPTION
*.! Introd$ction wit% .lock diagram
*.( +icrocontroller.
*.* eg$lated &ower s$&&l/...
*.1 3ED indicator........
*.4 Energ/ +eter.........
*.5 O&toco$&ler...
*.6 7S+...
1
*.8 ela/...
*.9 3CD....
*.!: Tam&er switc%...
CHAPTE 1" SO;T2AE DESCIPTION
1.! E0&ress PC,
1.( PIC C Com&iler.
1.* Prote$s software
1.1 Proced$ral ste&s for com&ilation< sim$lation and d$m&ing..
CHAPTE 4" PO=ECT DESCIPTION
CHAPTE 5" AD>ANTA7ES< DISAD>ANTA7ES AND APP3ICATIONS
CHAPTE 6" ES#3TS< CONC3#SION< ;#T#E POSPECTS
E;EENCES
2
CHAPTE !" INTOD#CTION
!.! Introd$ction"
The purpose of this project is to design a system which helps in remote monitoring and control
of the Domestic Energy meter through simply sending an SMS. This system enables the Electricity
Department to read the meter readings regularly without the person visiting each house. This can be
achieved by the use of Microcontroller unit that continuously monitors and records the Energy Meter
readings in its permanent (non-volatile memory location. This system also ma!es use of a "SM
modem for remote monitoring and control of Energy Meter.
The modules in the project are# "SM modem for establishing communication between system
at house and electricity department$ Energy meter which continuously gives usage details$ %&D to
display current reading of meter$ 'elay to disconnect the power in case of nonpayment of bill.
The Microcontroller based system continuously records the readings and the live meter
reading and will be sent to the Electricity department on re(uest. This system also can be used to
disconnect the power supply to the house in case of non-payment of electricity bills. ) dedicated "SM
modem with S*M card is re(uired for each energy meter. The Microcontroller which acts as a
controlling unit of the whole system is loaded with intelligent software programmed using Embedded
& language.
;eat$res"
+. ,rovides user friendly remote energy meter monitoring.
-. Supports controlling of meter.
.. &an be controlled anywhere in the world.
/. 0on-volatile memory based energy-reading storing.
1. )uto disconnect feature.
!.( Pro'ect O)er)iew"
)n embedded system is a combination of software and hardware to perform a
dedicated tas!. Some of the main devices used in embedded products are Microprocessors and
Microcontrollers.
3
Microprocessors are commonly referred to as general purpose processors as they
simply accept the inputs$ process it and give the output. *n contrast$ a microcontroller not only accepts
the data as inputs but also manipulates it$ interfaces the data with various devices$ controls the data
and thus finally gives the result.
The project 2 Energ/ +eter monitoring and control s/stem $sing S+S
tec%nolog/3 using +45677) Microcontroller is an e8clusive project that can be used
!.* T%esis O)er)iew"
The thesis e8plains the implementation of 2 Energ/ +eter monitoring and
control s/stem $sing S+S tec%nolog/3 using +45677) microcontroller. The organi9ation of the
thesis is e8plained here with#
C%a&ter ! ,resents introduction to the overall thesis and the overview of the project. *n the project
overview a brief introduction of microcontrollers$ energy meter and its applications are discussed.
C%a&ter ( ,resents the topic embedded systems. *t e8plains the about what is embedded systems$
need for embedded systems$ e8planation of it along with its applications.
C%a&ter * ,resents the hardware description. *t deals with the bloc! diagram of the project and
e8plains the purpose of each bloc!. *n the same chapter the e8planation of microcontrollers$ power
supplies$ energy meter$ %&D$ "SM modem$ tamper switch$ 'elay are considered.
C%a&ter 1 ,resents the software description. *t e8plains the implementation of the project using ,*&
& &ompiler software.
C%a&ter 4 &resents the project description along with energy meter$ %&D$ "SM modem$ tamper
switch$ and 'elay modules interfacing to microcontroller.
C%a&ter 5 ,resents the advantages$ disadvantages and applications of the project.
C%a&ter 6 ,resents the results$ conclusion and future scope of the project.
4
CHAPTE (" E+,EDDED S-STE+S
(.! Em.edded S/stems"
)n embedded system is a computer system designed to perform one or a few dedicated
functions often with real-time computing constraints. *t is embedded as part of a complete device
often including hardware and mechanical parts. :y contrast$ a general-purpose computer$ such as a
personal computer (,&$ is designed to be fle8ible and to meet a wide range of end-user needs.
Embedded systems control many devices in common use today.
Embedded systems are controlled by one or more main processing cores that are
typically either microcontrollers or digital signal processors (DS,. The !ey characteristic$ however$ is
being dedicated to handle a particular tas!$ which may re(uire very powerful processors. 5or e8ample$
air traffic control systems may usefully be viewed as embedded$ even though they involve mainframe
computers and dedicated regional and national networ!s between airports and radar sites. (Each radar
probably includes one or more embedded systems of its own.
Since the embedded system is dedicated to specific tas!s$ design engineers can
optimi9e it to reduce the si9e and cost of the product and increase the reliability and performance.
Some embedded systems are mass-produced$ benefiting from economies of scale.
,hysically embedded systems range from portable devices such as digital watches and
M,. players$ to large stationary installations li!e traffic lights$ factory controllers$ or the systems
controlling nuclear power plants. &omple8ity varies from low$ with a single microcontroller chip$ to
very high with multiple units$ peripherals and networ!s mounted inside a large chassis or enclosure.
*n general$ ;embedded system; is not a strictly definable term$ as most systems have
some element of e8tensibility or programmability. 5or e8ample$ handheld computers share some
elements with embedded systems such as the operating systems and microprocessors which power
them$ but they allow different applications to be loaded and peripherals to be connected. Moreover$
even systems which don<t e8pose programmability as a primary feature generally need to support
software updates. =n a continuum from ;general purpose; to ;embedded;$ large application systems
will have subcomponents at most points even if the system as a whole is ;designed to perform one or
a few dedicated functions;$ and is thus appropriate to call ;embedded;. ) modern e8ample of
embedded system is shown in fig# -.+.
5
;ig (.!"A modern e0am&le of em.edded s/stem
%abeled parts include microprocessor (/$ ')M (4$ flash memory (7.Embedded
systems programming is not li!e normal ,& programming. *n many ways$ programming for an
embedded system is li!e programming ,& +1 years ago. The hardware for the system is usually
chosen to ma!e the device as cheap as possible. Spending an e8tra dollar a unit in order to ma!e
things easier to program can cost millions. >iring a programmer for an e8tra month is cheap in
comparison. This means the programmer must ma!e do with slow processors and low memory$ while
at the same time battling a need for efficiency not seen in most ,& applications. :elow is a list of
issues specific to the embedded field.
(.!.! Histor/"
*n the earliest years of computers in the +?.@A/@s$ computers were sometimes
dedicated to a single tas!$ but were far too large and e8pensive for most !inds of tas!s performed by
embedded computers of today. =ver time however$ the concept of programmable controllers evolved
from traditional electromechanical se(uencers$ via solid state devices$ to the use of computer
technology.
=ne of the first recogni9ably modern embedded systems was the )pollo "uidance
&omputer$ developed by &harles Star! Draper at the M*T *nstrumentation %aboratory. )t the project<s
inception$ the )pollo guidance computer was considered the ris!iest item in the )pollo project as it
employed the then newly developed monolithic integrated circuits to reduce the si9e and weight. )n
6
early mass-produced embedded system was the )utonetics D-+7 guidance computer for
the Minuteman missile$ released in +?4+. *t was built from transistor logic and had a hard dis! for
main memory. Bhen the Minuteman ** went into production in +?44$ the D-+7 was replaced with a
new computer that was the first high-volume use of integrated circuits.
(.!.( Tools"
Embedded development ma!es up a small fraction of total programming. There<s also a
large number of embedded architectures$ unli!e the ,& world where + instruction set rules$ and the
Cni8 world where there<s only . or / major ones. This means that the tools are more e8pensive. *t also
means that they<re lowering featured$ and less developed. =n a major embedded project$ at some point
you will almost always find a compiler bug of some sort.
Debugging tools are another issue. Since you can<t always run general programs on
your embedded processor$ you can<t always run a debugger on it. This ma!es fi8ing your program
difficult. Special hardware such as DT)" ports can overcome this issue in part. >owever$ if you stop
on a brea!point when your system is controlling real world hardware (such as a motor$ permanent
e(uipment damage can occur. )s a result$ people doing embedded programming (uic!ly become
masters at using serial *= channels and error message style debugging.
(.!.* eso$rces"
To save costs$ embedded systems fre(uently have the cheapest processors that can do
the job. This means your programs need to be written as efficiently as possible. Bhen dealing with
large data sets$ issues li!e memory cache misses that never matter in ,& programming can hurt you.
%uc!ily$ this won<t happen too often- use reasonably efficient algorithms to start$ and optimi9e only
when necessary. =f course$ normal profilers won<t wor! well$ due to the same reason debuggers don<t
wor! well.
Memory is also an issue. 5or the same cost savings reasons$ embedded systems usually
have the least memory they can get away with. That means their algorithms must be memory efficient
(unli!e in ,& programs$ you will fre(uently sacrifice processor time for memory$ rather than the
reverse. *t also means you can<t afford to lea! memory. Embedded applications generally use
deterministic memory techni(ues and avoid the default ;new; and ;malloc; functions$ so that lea!s
can be found and eliminated more easily. =ther resources programmers e8pect may not even e8ist.
7
5or e8ample$ most embedded processors do not have hardware 5,Cs (5loating-,oint ,rocessing
Cnit. These resources either need to be emulated in software$ or avoided altogether.
(.!.1 eal Time Iss$es"
Embedded systems fre(uently control hardware$ and must be able to respond to them
in real time. 5ailure to do so could cause inaccuracy in measurements$ or even damage hardware such
as motors. This is made even more difficult by the lac! of resources available. )lmost all embedded
systems need to be able to prioriti9e some tas!s over others$ and to be able to put offEs!ip low priority
tas!s such as C* in favor of high priority tas!s li!e hardware control.
(.( Need ;or Em.edded S/stems"
The uses of embedded systems are virtually limitless$ because every day new products
are introduced to the mar!et that utili9es embedded computers in novel ways. *n recent years$
hardware such as microprocessors$ microcontrollers$ and 5,") chips have become much cheaper. So
when implementing a new form of control$ it<s wiser to just buy the generic chip and write your own
custom software for it. ,roducing a custom-made chip to handle a particular tas! or set of tas!s costs
far more time and money. Many embedded computers even come with e8tensive libraries$ so that
;writing your own software; becomes a very trivial tas! indeed. 5rom an implementation viewpoint$
there is a major difference between a computer and an embedded system. Embedded systems are often
re(uired to provide 'eal-Time response. The main elements that ma!e embedded systems uni(ue are
its reliability and ease in debugging.
(.(.! De.$gging"
Embedded debugging may be performed at different levels$ depending on the facilities
available. 5rom simplest to most sophisticate they can be roughly grouped into the following areas#
*nteractive resident debugging$ using the simple shell provided by the embedded operating
system (e.g. 5orth and :asic
E8ternal debugging using logging or serial port output to trace operation using either a
monitor in flash or using a debug server li!e the 'emedy Debugger which even wor!s for
heterogeneous multi core systems.
8
)n in-circuit debugger (*&D$ a hardware device that connects to the microprocessor via a
DT)" or 0e8us interface. This allows the operation of the microprocessor to be controlled
e8ternally$ but is typically restricted to specific debugging capabilities in the processor.
)n in-circuit emulator replaces the microprocessor with a simulated e(uivalent$ providing full
control over all aspects of the microprocessor.
) complete emulator provides a simulation of all aspects of the hardware$ allowing all of it to
be controlled and modified and allowing debugging on a normal ,&.
Cnless restricted to e8ternal debugging$ the programmer can typically load and run software
through the tools$ view the code running in the processor$ and start or stop its operation. The
view of the code may be as assembly code or source-code.
:ecause an embedded system is often composed of a wide variety of elements$ the
debugging strategy may vary. 5or instance$ debugging a software(and microprocessor centric
embedded system is different from debugging an embedded system where most of the processing is
performed by peripherals (DS,$ 5,")$ co-processor. )n increasing number of embedded systems
today use more than one single processor core. ) common problem with multi-core development is
the proper synchroni9ation of software e8ecution. *n such a case$ the embedded system design may
wish to chec! the data traffic on the busses between the processor cores$ which re(uires very low-
level debugging$ at signalEbus level$ with a logic analy9er$ for instance.
(.(.( elia.ilit/"
Embedded systems often reside in machines that are e8pected to run continuously for
years without errors and in some cases recover by them selves if an error occurs. Therefore the
software is usually developed and tested more carefully than that for personal computers$ and
unreliable mechanical moving parts such as dis! drives$ switches or buttons are avoided.
Specific reliability issues may include#
The system cannot safely be shut down for repair$ or it is too inaccessible to repair. E8amples
include space systems$ undersea cables$ navigational beacons$ bore-hole systems$ and
automobiles.
The system must be !ept running for safety reasons. ;%imp modes; are less tolerable. =ften
bac!ups are selected by an operator. E8amples include aircraft navigation$ reactor control
9
systems$ safety-critical chemical factory controls$ train signals$ engines on single-engine
aircraft.
The system will lose large amounts of money when shut down# Telephone switches$ factory
controls$ bridge and elevator controls$ funds transfer and mar!et ma!ing$ automated sales and
service.
) variety of techni(ues are used$ sometimes in combination$ to recover from errorsF
both software bugs such as memory lea!s$ and also soft errors in the hardware#
Batchdog timer that resets the computer unless the software periodically notifies the watchdog
Subsystems with redundant spares that can be switched over to
software ;limp modes; that provide partial function
Designing with a Trusted &omputing :ase (T&: architectureG4H ensures a highly secure I
reliable system environment
)n Embedded >ypervisor is able to provide secure encapsulation for any subsystem
component$ so that a compromised software component cannot interfere with other
subsystems$ or privileged-level system software. This encapsulation !eeps faults from
propagating from one subsystem to another$ improving reliability. This may also allow a
subsystem to be automatically shut down and restarted on fault detection.
*mmunity )ware ,rogramming
(.* E0&lanation of Em.edded S/stems"
(.*.! Software Arc%itect$re"
There are several different types of software architecture in common use.
Simple &ontrol %oop#
*n this design$ the software simply has a loop. The loop calls subroutines$ each of which
manages a part of the hardware or software.
*nterrupt &ontrolled System#
Some embedded systems are predominantly interrupt controlled. This means that tas!s
performed by the system are triggered by different !inds of events. )n interrupt could be generated
10
for e8ample by a timer in a predefined fre(uency$ or by a serial port controller receiving a byte. These
!inds of systems are used if event handlers need low latency and the event handlers are short and
simple.
Csually these !inds of systems run a simple tas! in a main loop also$ but this tas! is not
very sensitive to une8pected delays. Sometimes the interrupt handler will add longer tas!s to a (ueue
structure. %ater$ after the interrupt handler has finished$ these tas!s are e8ecuted by the main loop.
This method brings the system close to a multitas!ing !ernel with discrete processes.
&ooperative Multitas!ing#
) non-preemptive multitas!ing system is very similar to the simple control loop
scheme$ e8cept that the loop is hidden in an ),*. The programmer defines a series of tas!s$ and each
tas! gets its own environment to 2run3 in. Bhen a tas! is idle$ it calls an idle routine$ usually called
2pause3$ 2wait3$ 2yield3$ 2nop3 (stands for no operation$ etc. The advantages and disadvantages are
very similar to the control loop$ e8cept that adding new software is easier$ by simply writing a new
tas!$ or adding to the (ueue-interpreter.
,rimitive Multitas!ing#
*n this type of system$ a low-level piece of code switches between tas!s or threads
based on a timer (connected to an interrupt. This is the level at which the system is generally
considered to have an ;operating system; !ernel. Depending on how much functionality is re(uired$ it
introduces more or less of the comple8ities of managing multiple tas!s running conceptually in
parallel.
)s any code can potentially damage the data of another tas! (e8cept in larger systems
using an MMC programs must be carefully designed and tested$ and access to shared data must be
controlled by some synchroni9ation strategy$ such as message (ueues$ semaphores or a non-bloc!ing
synchroni9ation scheme.
:ecause of these comple8ities$ it is common for organi9ations to buy a real-time
operating system$ allowing the application programmers to concentrate on device functionality rather
than operating system services$ at least for large systemsJ smaller systems often cannot afford the
overhead associated with a generic real time system$ due to limitations regarding memory si9e$
performance$ andEor battery life.
11
Micro!ernels )nd E8o!ernels#
) micro!ernel is a logical step up from a real-time =S. The usual arrangement is that
the operating system !ernel allocates memory and switches the &,C to different threads of e8ecution.
Cser mode processes implement major functions such as file systems$ networ! interfaces$ etc.
*n general$ micro!ernels succeed when the tas! switching and intertas! communication
is fast$ and fail when they are slow. E8o!ernels communicate efficiently by normal subroutine calls.
The hardware and all the software in the system are available to$ and e8tensible by application
programmers. :ased on performance$ functionality$ re(uirement the embedded systems are divided
into three categories#
(.*.( Stand Alone Em.edded S/stem"
These systems ta!es the input in the form of electrical signals from transducers or
commands from human beings such as pressing of a button etc..$ process them and produces desired
output. This entire process of ta!ing input$ processing it and giving output is done in standalone mode.
Such embedded systems comes under stand alone embedded systems
Eg# microwave oven$ air conditioner etc..
(.*.* eal?time em.edded s/stems"
Embedded systems which are used to perform a specific tas! or operation in a specific
time period those systems are called as real-time embedded systems. There are two types of real-time
embedded systems.
>ard 'eal-time embedded systems#
These embedded systems follow an absolute dead line time period i.e..$ if the tas!ing is
not done in a particular time period then there is a cause of damage to the entire e(uipment.
Eg# consider a system in which we have to open a valve within .@ milliseconds. *f this valve is
not opened in .@ ms this may cause damage to the entire e(uipment. So in such cases we use
embedded systems for doing automatic operations.
Soft 'eal Time embedded systems#
12
Eg# &onsider a TK remote control system$ if the remote control ta!es a few milliseconds delay it will
not cause damage either to the TK or to the remote control. These systems which will not cause damage when
they are not operated at considerable time period those systems comes under soft real-time embedded systems.
(.*.1 Network comm$nication em.edded s/stems"
) wide range networ! interfacing communication is provided by using embedded
systems.
Eg#
&onsider a web camera that is connected to the computer with internet can be used to
spread communication li!e sending pictures$ images$ videos etc..$ to another computer
with internet connection throughout anywhere in the world.
&onsider a web camera that is connected at the door loc!.
Bhenever a person comes near the door$ it captures the image of a person and sends to
the des!top of your computer which is connected to internet. This gives an alerting message with
image on to the des!top of your computer$ and then you can open the door loc! just by clic!ing the
mouse. 5ig# -.- show the networ! communications in embedded systems.
;ig (.(" Network comm$nication em.edded s/stems
13
(.*.4 Different t/&es of &rocessing $nits"
The central processing unit (c.p.u can be any one of the following microprocessor$
microcontroller$ digital signal processing.
)mong these Microcontroller is of low cost processor and one of the main advantage of
microcontrollers is$ the components such as memory$ serial communication interfaces$ analog
to digital converters etc..$ all these are built on a single chip. The numbers of e8ternal
components that are connected to it are very less according to the application.
Microprocessors are more powerful than microcontrollers. They are used in major applications
with a number of tas!ing re(uirements. :ut the microprocessor re(uires many e8ternal
components li!e memory$ serial communication$ hard dis!$ input output ports etc..$ so the
power consumption is also very high when compared to microcontrollers.
Digital signal processing is used mainly for the applications that particularly involved with
processing of signals
(.1 APP3ICATIONS O; E+,EDDED S-STE+S"
(.1.! Cons$mer a&&lications"
)t home we use a number of embedded systems which include microwave oven$
remote control$ vcd players$ dvd players$ camera etcL.
;ig(.*" A$tomatic coffee makes e@$i&ment
14
(.1.( Office a$tomation"
Be use systems li!e fa8 machine$ modem$ printer etcL
;ig(.1" ;a0 mac%ine ;ig(.4" Printing mac%ine
(.1.*. Ind$strial a$tomation"
Today a lot of industries are using embedded systems for process control. *n industries
we design the embedded systems to perform a specific operation li!e monitoring temperature$
pressure$ humidity $voltage$ current etc..$ and basing on these monitored levels we do control other
devices$ we can send information to a centrali9ed monitoring station.
;ig(.5" o.ot
*n critical industries where human presence is avoided there we can use robots which
are programmed to do a specific operation.
15
(.1.4 Com&$ter networking"
Embedded systems are used as bridges routers etc..
;ig(.6" Com&$ter networking
(.1.5 Tele comm$nications"
&ell phones$ web cameras etc.
;ig(.8" Cell P%one ;ig(.9" 2e. camera
CHAPTE *" HAD2AE DESCIPTION"
16
*.! Introd$ction#
*n this chapter the bloc! diagram of the project and design aspect of independent
modules are considered. :loc! diagram is shown in fig# ..+#
;I7 *.!" ,lock diagram of 7S+ OPEATION DI7ITA3 ENE7- +ETE
T%e main .locks of t%is &ro'ect are#
+. Micro controller (+45677)
-. 'eset button
.. &rystal oscillator
/. 'egulated power supply (',S
17
1. %ed indicator
4. Energy meter
7. =ptocoupler
6. "SM modem
?. 'elay
+@. %&D
++. Tamper switch
*.( +icro controller"
+icro controller"
;ig" *.( +icrocontrollers
*.(.! Introd$ction to +icrocontrollers"
&ircumstances that we find ourselves in today in the field of microcontrollers had their
beginnings in the development of technology of integrated circuits. This development has made it
possible to store hundreds of thousands of transistors into one chip. That was a prere(uisite for
production of microprocessors$ and the first computers were made by adding e8ternal peripherals such
as memory$ input-output lines$ timers and other. 5urther increasing of the volume of the pac!age
resulted in creation of integrated circuits. These integrated circuits contained both processor and
peripherals. That is how the first chip containing a microcomputer$ or what would later be !nown as a
microcontroller came about.
18
Microprocessors and microcontrollers are widely used in embedded systems products.
Microcontroller is a programmable device. ) microcontroller has a &,C in addition to a fi8ed amount
of ')M$ '=M$ *E= ports and a timer embedded all on a single chip. The fi8ed amount of on-chip
'=M$ ')M and number of *E= ports in microcontrollers ma!es them ideal for many applications in
which cost and space are critical.
The microcontroller used in this project is ,*&+45677). The ,*& families of
microcontrollers are developed by Microchip Technology *nc. &urrently they are some of the most
popular microcontrollers$ selling over +-@ million devices each year. There are basically four families
of ,*& microcontrollers#
,*&+-&MMM +-E+/-bit program word
,*& +4&1M +--bit program word
,*&+4&MMM and ,*&+45MMM +/-bit program word
,*&+7&MMM and ,*&+6&MMM +4-bit program word
The features$ pin description of the microcontroller used are discussed in the following sections.
*.(.( Descri&tion"
*ntroduction to PIC Microcontrollers:
,*& stands for ,eripheral *nterface &ontroller given by Microchip Technology to
identify its single-chip microcontrollers. These devices have been very successful in 6-bit
microcontrollers. The main reason is that Microchip Technology has continuously upgraded the
device architecture and added needed peripherals to the microcontroller to suit customers<
re(uirements. The development tools such as assembler and simulator are freely available on the
internet at www.microchip.com
Low - end PIC Architectres:
Microchip ,*& microcontrollers are available in various types. Bhen ,*&
microcontroller M&C was first available from "eneral *nstruments in early +?6@<s$ the
microcontroller consisted of a simple processor e8ecuting +--bit wide instructions with basic *E=
functions. These devices are !nown as low-end architectures. They have limited program memory and
19
are meant for applications re(uiring simple interface functions and small program I data memories.
Some of the low-end device numbers are
+-&1MM
+4&1M
+4&1@1
Mid r!n"e PIC Architectres:
Mid range ,*& architectures are built by upgrading low-end architectures with more number of
peripherals$ more number of registers and more dataEprogram memory. Some of the mid-range
devices are
+4&4M
+4&7M
+4567M
,rogram memory type is indicated by an alphabet.
& N E,'=M$ 5 N 5lash$ '& N Mas! '=M
,opularity of the ,*& microcontrollers is due to the following factors.
+. Speed# >arvard )rchitecture$ '*S& architecture$ + instruction cycle N / cloc! cycles.
-. *nstruction set simplicity# The instruction set consists of just .1 instructions (as opposed to +++
instructions for 6@1+.
.. ,ower-on-reset and brown-out reset. :rown-out-reset means when the power supply goes
below a specified voltage (say /K$ it causes ,*& to resetJ hence malfunction is avoided. )
watch dog timer (user programmable resets the processor if the softwareEprogram ever
malfunctions and deviates from its normal operation.
/. ,*& microcontroller has four optional cloc! sources.
%ow power crystal
Mid range crystal
>igh range crystal
20
'& oscillator (low cost.
1. ,rogrammable timers and on-chip )D&.
4. Cp to +- independent interrupt sources.
7. ,owerful output pin control (-1 m) (ma8. current sourcing capability per pin.
6. E,'=ME=T,E'=ME5lash memory option.
?. *E= port e8pansion capability.
CP# Architectre:
The &,C uses >arvard architecture with separate ,rogram and Kariable (data memory interface.
This facilitates instruction fetch and the operation on dataEaccessing of variables simultaneously.
)rchitecture of ,*& microcontroller
;ig.*.*.Arc%itect$re of PIC microcontroller
:asically$ all ,*& microcontrollers offer the following features#
'*S& instruction set with around .1 instructions O? Digital *E= ports
=n-chip timer with 6-bit prescaler.
,ower-on reset
Batchdog timer
,ower saving S%EE, mode
Direct$ indirect$ and relative addressing modes
E8ternal cloc! interface
')M data memory
E,'=M (or =T, program memory
21
,eripheral features"
>igh sin!Esource current -1m)
Timer@# 6-bit timerEcounter with 6-bit prescaler can be incremented during sleep via e8ternal
crystalEcloc!
Timer-#6-bit timerEcounter with 6-bit period register prescaler and post scalar.
&apture$ &ompare$ ,BM (&&, module
&apture is +4-bit$ ma8 resolution is +-.1ns
&ompare is +4-bit$ ma8 resolution is -@@ ns
,BM ma8$ resolution is +@-bit
6-bit 1 channel analog-to-digital converter
Synchronous serial port (SS, with S,* (MasterESlave and (Slave
Some devices offer the following additional features#
)nalogue input channels
)nalogue comparators
)dditional timer circuits
EE,'=M data memory
5lash EE,'=M program memory
E8ternal and timer interrupts
*n-circuit programming
*nternal oscillator
CS)'T serial interface
*.(.* Pin diagram"
22
;ig.*.1.PIN DIA7A+ O; PIC!5;866
,ic+4f677 is a /@ pin microcontroller. *t has 1 ports port )$ port :$ port &$ port D$ port E. )ll the pins
of the ports are for interfacing input output devices.
,ort )# *t consists of 4 pins from )@ to )1
,ort :# *t consists of 6 pins from :@ to :7
,ort &# *t consists of 6 pins from &@ to &7
,ort D# *t consists of 6 pins from D@ to D7
,ort E# *t consists of . pins from E@ to E-
The rest of the pins are mandatory pins these should not be used to connect inputEoutput devices.
,in + is M&%' (master clear pin pin also referred as reset pin.
23
,in +.$ +/ are used for crystal oscillator to connect to generate a fre(uency of about -@M>9.
,in ++$ +- and.+$ .- are used for voltage supply Kdd(Pand Kss(-
,*& +45677) Specification#
')M .46 bytes
EE,'=M -14 bytes
5lash ,rogram Memory 6! words
=perating 5re(uency D& to -@M>9
*E= port ,ort )$:$&$D$E
This is the specification for ,*&+45677) from Microchip. ) single microcontroller
which is very brilliant and useful. )lso this microcontroller is very easy to be assembled$ program and
also the price is very cheap. *t cost less than +@ dollar. The good thing is that single unit can be
purchased at that +@ dollar price. Cnli!e some other *ntegrated &ircuit that must be bought at a
minimum order (uantity such as +@@@ units or -@@@ units or else you wonQt be able to purchase it.
=ne unit of ,*&+45677) microcontroller can be programmed and erased so many times.
Some said about +@ @@@ times. *f you are doing programming and downloading your code into the
,*& -@ times a day that means you can do that for 1@@ days which is more than a yearR
The erasing time is almost unnoticeable because once new program are loaded into the ,*&$
the old program will automatically be erased immediately. During my time of Degree study$ * did not
use ,*& but * use other type of microcontroller. * have to wait for about +1 to .@ minutes to erase the
EE,'=M before * can load a new program and test the microcontroller. =ne day * can only modify
my code and test it for less than +@ times. +@8+1 minutes N +1@ minutes.
A+"
24
,*&+45677) already made with .46 bytes of 'andom )ccess Memory (')M inside it. )ny
temporary variable storage that we wrote in our program will be stored inside the ')M. Csing this
microcontroller you donQt need to buy any e8ternal ')M.
EEPO+"
-14 bytes of EE,'=M are available also inside this microcontroller. This is very useful to
store information such as ,*0 0umber$ Serial 0umber and so on. Csing EE,'=M is very important
because data stored inside EE,'=M will be retained when power supply is turn off. ')M did not
store data permanently. Data inside ')M is not retained when power supply is turn off.
The si9e of program code that can be stored is about 6! words inside ,*&+45677) '=M. +
word si9e is +/ bits. :y using the free version of the &&S & compiler only -! words of program can
be written and compiled. To write 6! words of & program you have to purchase the original &&S &
compiler and it cost less than 7@@ dollar.
Cr/stal oscillator#
The crystal oscillator speed that can be connected to the ,*& microcontroller range from D& to
-@Mh9. Csing the &&S & compiler normally -@Mh9 oscillator will be used and the price is very
cheap. The -@ M>9 crystal oscillator should be connected with about --p5 capacitor. ,lease refer to
my circuit schematic.
There are 1 inputEoutput ports on ,*& microcontroller namely port )$ port :$ port &$ port D
and port E. Each port has different function. Most of them can be used as *E= port.
*.* E7#3ATED PO2E S#PP3-"
*.*.! Introd$ction"
,ower supply is a supply of electrical power. ) device or system that supplies electrical
or other types of energy to an output load or group of loads is called a power supply unit or ,SC. The
term is most commonly applied to electrical energy supplies$ less often to mechanical ones$ and rarely
to others.
25
) power supply may include a power distribution system as well as primary or
secondary sources of energy such as
&onversion of one form of electrical power to another desired form and voltage$ typically
involving converting )& line voltage to a well-regulated lower-voltage D& for electronic devices.
%ow voltage$ low power D& power supply units are commonly integrated with the devices they
supply$ such as computers and household electronics.
:atteries.
&hemical fuel cells and other forms of energy storage systems.
Solar power.
"enerators or alternators.
*.*.( ,lock Diagram"
;ig *.*.( eg$lated Power S$&&l/
26
The basic circuit diagram of a regulated power supply (D& =E, with led connected as
load is shown in fig# ......
;ig *.*.* Circ$it diagram of eg$lated Power S$&&l/ wit% 3ed connection
The components mainly used in above figure are
-.@K )& M)*0S
T')0S5='ME'
:'*D"E 'E&T*5*E'(D*=DES
&),)&*T='
K=%T)"E 'E"C%)T='(*& 76@1
'ES*ST='
%ED(%*">T EM*TT*0" D*=DE
The detailed e8planation of each and every component mentioned above is as follows#
Transformation" The process of transforming energy from one device to another is called
transformation. 5or transforming energy we use transformers.
Transformers"
27
) transformer is a device that transfers electrical energy from one circuit to another
through inductively coupled conductors without changing its fre(uency. ) varying current in the first
or primary winding creates a varying magnetic flu8 in the transformer<s core$ and thus a
varying magnetic field through the secondary winding. This varying magnetic field induces a
varying electromotive force (EM5 or ;voltage; in the secondary winding. This effect is called mutual
induction.
*f a load is connected to the secondary$ an electric current will flow in the secondary
winding and electrical energy will be transferred from the primary circuit through the transformer to
the load. This field is made up from lines of force and has the same shape as a bar magnet.
*f the current is increased$ the lines of force move outwards from the coil. *f the current
is reduced$ the lines of force move inwards.
*f another coil is placed adjacent to the first coil then$ as the field moves out or in$ the
moving lines of force will ;cut; the turns of the second coil. )s it does this$ a voltage is induced in the
second coil. Bith the 1@ >9 )& mains supply$ this will happen 1@ times a second. This is called
MCTC)% *0DC&T*=0 and forms the basis of the transformer.
The input coil is called the ,'*M)'S B*0D*0"J the output coil is the
SE&=0D)'S B*0D*0". 5ig# ..../ shows step-down transformer.
;ig *.*.1" Ste&?Down Transformer
The voltage induced in the secondary is determined by the TC'0S ')T*=.
28
5or e8ample$ if the secondary has half the primary turnsJ the secondary will have half
the primary voltage.
)nother e8ample is if the primary has 1@@@ turns and the secondary has 1@@ turns$ then
the turnQs ratio is +@#+.
*f the primary voltage is -/@ volts then the secondary voltage will be 8 +@ smaller N -/
volts. )ssuming a perfect transformer$ the power provided by the primary must e(ual the power ta!en
by a load on the secondary. *f a -/-watt lamp is connected across a -/ volt secondary$ then the
primary must supply -/ watts.
To aid magnetic coupling between primary and secondary$ the coils are wound on a
metal &='E. Since the primary would induce power$ called EDDS &C''E0TS$ into this core$ the
core is %)M*0)TED. This means that it is made up from metal sheets insulated from each other.
Transformers to wor! at higher fre(uencies have an iron dust core or no core at all.
0ote that the transformer only wor!s on )&$ which has a constantly changing current
and moving field. D& has a steady current and therefore a steady field and there would be no
induction.
Some transformers have an electrostatic screen between primary and secondary. This is
to prevent some types of interference being fed from the e(uipment down into the mains supply$ or in
the other direction. Transformers are sometimes used for *M,ED)0&E M)T&>*0".
Be can use the transformers as step up or step down.
Ste& #& transformer"
*n case of step up transformer$ primary windings are every less compared to secondary
winding.
:ecause of having more turns secondary winding accepts more energy$ and it releases
more voltage at the output side.
Ste& down transformer"
29
*ncase of step down transformer$ ,rimary winding induces more flu8 than the
secondary winding$ and secondary winding is having less number of turns because of that it accepts
less number of flu8$ and releases less amount of voltage.
,atter/ &ower s$&&l/"
) battery is a type of linear power supply that offers benefits that traditional line-
operated power supplies lac!# mobility$ portability and reliability. ) battery consists of multiple
electrochemical cells connected to provide the voltage desired. 5ig# ....1 shows >i-Batt ?K battery
;ig *.*.4" Hi?2att 9> ,atter/
The most commonly used dry-cell battery is the carbon-9inc dry cell battery. Dry-cell
batteries are made by stac!ing a carbon plate$ a layer of electrolyte paste$ and a 9inc plate alternately
until the desired total voltage is achieved. The most common dry-cell batteries have one of the
following voltages# +.1$ .$ 4$ ?$ --.1$ /1$ and ?@. During the discharge of a carbon-9inc battery$ the
9inc metal is converted to a 9inc salt in the electrolyte$ and magnesium dio8ide is reduced at the
carbon electrode. These actions establish a voltage of appro8imately +.1 K.
The lead-acid storage battery may be used. This battery is rechargeableJ it consists of
lead and leadEdio8ide electrodes which are immersed in sulfuric acid. Bhen fully charged$ this type of
battery has a -.@4--.+/ K potential () +- volt car battery uses 4 cells in series. During discharge$ the
lead is converted to lead sulfate and the sulfuric acid is converted to water. Bhen the battery is
charging$ the lead sulfate is converted bac! to lead and lead dio8ide ) nic!el-cadmium battery has
become more popular in recent years. This battery cell is completely sealed and rechargeable. The
electrolyte is not involved in the electrode reaction$ ma!ing the voltage constant over the span of the
batteries long service life. During the charging process$ nic!el o8ide is o8idi9ed to its higher o8idation
state and cadmium o8ide is reduced. The nic!el-cadmium batteries have many benefits. They can be
30
stored both charged and uncharged. They have a long service life$ high current availabilities$ constant
voltage$ and the ability to be recharged. 5ig# ....4 shows pencil battery of +.1K.
;ig *.*.5" Pencil ,atter/ of !.4>
ectification"
The process of converting an alternating current to a pulsating direct current is called
as rectification. 5or rectification purpose we use rectifiers.
ectifiers"
) rectifier is an electrical device that converts alternating current ()& to direct current
(D&$ a process !nown as rectification. 'ectifiers have many uses including as components of power
supplies and as detectors of radio signals. 'ectifiers may be made of solid-state diodes$ vacuum tube
diodes$ mercury arc valves$ and other components.
) device that it can perform the opposite function (converting D& to )& is !nown as
an inverter.
Bhen only one diode is used to rectify )& (by bloc!ing the negative or positive
portion of the waveform$ the difference between the term diode and the term rectifier is merely one
of usage$ i.e.$ the term rectifier describes a diode that is being used to convert )& to D&. )lmost all
rectifiers comprise a number of diodes in a specific arrangement for more efficiently converting )& to
D& than is possible with only one diode. :efore the development of silicon semiconductor rectifiers$
vacuum tube diodes and copper (* o8ide or selenium rectifier stac!s were used.
,ridge f$ll wa)e rectifier"
31
The :ridge rectifier circuit is shown in fig# ....7$ which converts an ac voltage to dc
voltage using both half cycles of the input ac voltage. The :ridge rectifier circuit is shown in the
figure. The circuit has four diodes connected to form a bridge. The ac input voltage is applied to the
diagonally opposite ends of the bridge. The load resistance is connected between the other two ends of
the bridge.
5or the positive half cycle of the input ac voltage$ diodes D+ and D. conduct$ whereas
diodes D- and D/ remain in the =55 state. The conducting diodes will be in series with the load
resistance '% and hence the load current flows through '%.
5or the negative half cycle of the input ac voltage$ diodes D- and D/ conduct
whereas$ D+ and D. remain =55. The conducting diodes D- and D/ will be in series with the load
resistance '% and hence the current flows through '% in the same direction as in the previous half
cycle. Thus a bi-directional wave is converted into a unidirectional wave.
*nput =utput
;ig *.*.6" ,ridge rectifier" a f$ll?wa)e rectifier $sing 1 diodes
D,!:6"
0ow -a -days :ridge rectifier is available in *& with a number of D:+@7. *n our project
we are using an *& in place of bridge rectifier. The picture of D: +@7 is shown in fig# ....6.
;eat$res"
32
"ood for automation insertion
Surge overload rating - .@ amperes pea!
*deal for printed circuit board
'eliable low cost construction utili9ing molded
"lass passivated device
,olarity symbols molded on body
Mounting position# )ny
Beight# +.@ gram
;ig *.*.8" D,!:6
;iltration"
The process of converting a pulsating direct current to a pure direct current using filters
is called as filtration.
;ilters"
Electronic filters are electronic circuits$ which perform signal-processing functions$
specifically to remove unwanted fre(uency components from the signal$ to enhance wanted ones.
Introd$ction to Ca&acitors"
33
The &apacitor or sometimes referred to as a &ondenser is a passive device$ and one
which stores energy in the form of an electrostatic field which produces a potential (static voltage
across its plates. *n its basic form a capacitor consists of two parallel conductive plates that are not
connected but are electrically separated either by air or by an insulating material called the Dielectric.
Bhen a voltage is applied to these plates$ a current flows charging up the plates with electrons giving
one plate a positive charge and the other plate an e(ual and opposite negative charge This flow of
electrons to the plates is !nown as the &harging &urrent and continues to flow until the voltage across
the plates (and hence the capacitor is e(ual to the applied voltage Kcc. )t this point the capacitor is
said to be fully charged and this is illustrated below. The construction of capacitor and an electrolytic
capacitor are shown in figures ....? and ....+@ respectively.
;ig *.*.9"Constr$ction Of a Ca&acitor ;ig *.*.!:"Electrol/tic Ca&aticor
Cnits of &apacitance#
Microfarad (T5 +T5 N +E+$@@@$@@@ N @.@@@@@+ N +@
-4
5
0anofarad (n5 +n5 N +E+$@@@$@@@$@@@ N @.@@@@@@@@+ N +@
-?
5
,ico farad (p5 +p5 N +E+$@@@$@@@$@@@$@@@ N @.@@@@@@@@@@@+ N +@
-+-
5
O&eration of Ca&acitor"
34
Thin! of water flowing through a pipe. *f we imagine a capacitor as being a storage
tan! with an inlet and an outlet pipe$ it is possible to show appro8imately how an electronic capacitor
wor!s.
5irst$ let<s consider the case of a ;coupling capacitor; where the capacitor is used to
connect a signal from one part of a circuit to another but without allowing any direct current to flow.
*f the current flow is alternating between 9ero and a ma8imum$
our ;storage tan!; capacitor will allow the current waves to pass
through.
>owever$ if there is a steady current$ only the initial short burst
will flow until the ;floating ball valve; closes and stops further
flow.
So a coupling capacitor allows ;alternating current; to pass through because the ball
valve doesn<t get a chance to close as the waves go up and down. >owever$ a steady current (uic!ly
fills the tan! so that all flow stops.
) capacitor will pass alternating current but (apart from an initial surge it will not pass
d.c.
Bhere a capacitor is used to decouple a circuit$ the effect is to
;smooth out ripples;. )ny ripples$ waves or pulses of current are
passed to ground while d.c. 5lows smoothly.
35
eg$lation"
The process of converting a varying voltage to a constant regulated voltage is called as
regulation. 5or the process of regulation we use voltage regulators.
>oltage eg$lator"
) voltage regulator (also called a UregulatorQ with only three terminals appears to be a
simple device$ but it is in fact a very comple8 integrated circuit. *t converts a varying input voltage
into a constant UregulatedQ output voltage. Koltage 'egulators are available in a variety of outputs li!e
1K$ 4K$ ?K$ +-K and +1K. The %M76MM series of voltage regulators are designed for positive input.
5or applications re(uiring negative input$ the %M7?MM series is used. Csing a pair of Uvoltage-
dividerQ resistors can increase the output voltage of a regulator circuit.
*t is not possible to obtain a voltage lower than the stated rating. Sou cannot use a +-K
regulator to ma!e a 1K power supply. Koltage regulators are very robust. These can withstand over-
current draw due to short circuits and also over-heating. *n both cases$ the regulator will cut off before
any damage occurs. The only way to destroy a regulator is to apply reverse voltage to its input.
'everse polarity destroys the regulator almost instantly. 5ig# ....++ shows voltage regulator.
;ig *.*.!!" >oltage eg$lator
36
esistors"
) resistor is a two-terminal electronic component that produces a voltage across its terminals
that is proportional to the electric current passing through it in accordance with =hm<s law#
V $ IR
'esistors are elements of electrical networ!s and electronic circuits and are ubi(uitous in most
electronic e(uipment. ,ractical resistors can be made of various compounds and films$ as well as
resistance wire (wire made of a high-resistivity alloy$ such as nic!elEchrome.
The primary characteristics of a resistor are the resistance$ the tolerance$ ma8imum wor!ing
voltage and the power rating. =ther characteristics include temperature coefficient$ noise$ and
inductance. %ess well-!nown is critical resistance$ the value below which power dissipation limits the
ma8imum permitted current flow$ and above which the limit is applied voltage. &ritical resistance is
determined by the design$ materials and dimensions of the resistor.
'esistors can be made to control the flow of current$ to wor! as Koltage dividers$ to
dissipate power and it can shape electrical waves when used in combination of other components.
:asic unit is ohms.
T%eor/ of o&eration"
O%mAs law"
The behavior of an ideal resistor is dictated by the relationship specified in =hm<s law#
K N *'
=hm<s law states that the voltage (K across a resistor is proportional to the current (*
through it where the constant of proportionality is the resistance ('.
Power dissi&ation"
The power dissipated by a resistor (or the e(uivalent resistance of a resistor networ! is
calculated using the following#
37
;ig *.*.!(" esistor ;ig *.*.!*" Color ,ands In esistor
*.1. 3ED"
) light-emitting diode (%ED is a semiconductor light source. %EDQs are used as
indicator lamps in many devices$ and are increasingly used for lighting. *ntroduced as a practical
electronic component in +?4-$ early %EDQs emitted low-intensity red light$ but modern versions are
available across the visible$ ultraviolet and infrared wavelengths$ with very high brightness. The
internal structure and parts of a led are shown in figures ../.+ and ../.- respectively.
38
;ig *.1.!" Inside a 3ED ;ig *.1.(" Parts of a 3ED
2orking"
The structure of the %ED light is completely different than that of the light bulb.
)ma9ingly$ the %ED has a simple and strong structure. The light-emitting semiconductor material is
what determines the %ED<s color. The %ED is based on the semiconductor diode.
Bhen a diode is forward biased (switched on$ electrons are able to recombine with
holes within the device$ releasing energy in the form of photons. This effect is called
electroluminescence and the color of the light (corresponding to the energy of the photon is
determined by the energy gap of the semiconductor. )n %ED is usually small in area (less than
+ mm
-
$ and integrated optical components are used to shape its radiation pattern and assist in
reflection. %EDQs present many advantages over incandescent light sources including lower energy
consumption$ longer lifetime$ improved robustness$ smaller si9e$ faster switching$ and greater
durability and reliability. >owever$ they are relatively e8pensive and re(uire more precise current and
heat management than traditional light sources. &urrent %ED products for general lighting are more
e8pensive to buy than fluorescent lamp sources of comparable output. They also enjoy use in
applications as diverse as replacements for traditional light sources in automotive lighting
(particularly indicators and in traffic signals. The compact si9e of %EDQs has allowed new te8t and
video displays and sensors to be developed$ while their high switching rates are useful in advanced
communications technology. The electrical symbol and polarities of led are shown in fig# ../...
;ig *.1.*" Electrical S/m.ol B Polarities of 3ED
39
%ED lights have a variety of advantages over other light sources#
>igh-levels of brightness and intensity
>igh-efficiency
%ow-voltage and current re(uirements
%ow radiated heat
>igh reliability (resistant to shoc! and vibration
0o CK 'ays
%ong source life
&an be easily controlled and programmed
)pplications of %ED fall into three major categories#
Kisual signal application where the light goes more or less directly from the %ED to the human
eye$ to convey a message or meaning.
*llumination where %ED light is reflected from object to give visual response of these objects.
"enerate light for measuring and interacting with processes that do not involve the human
visual system.
*.4 ENE7- +ETE"
)n electric meter or energ/ meter is a device that measures the amount of electrical energy
consumed by a residence$ business$ or an electrically-powered device.
Electric meters are typically calibrated in billing units$ the most common one being the !ilowatt hour.
,eriodic readings of electric meters establish billing cycles and energy used during a cycle.
*n settings when energy savings during certain periods are desired$ meters may measure demand$ the
ma8imum use of power in some interval. *n some areas$ the electric rates are higher during certain
40
times of day$ to encourage reduction in use. )lso$ in some areas meters have relays to turn off
nonessential e(uipment
*.4.! T%eor/"
The first accurate$ recording electricity consumption meter was a D& meter by Dr >ermann )ron$
who patented it in +66.. >ugo >irst of the "eneral Electric &ompany introduced it commercially into
"reat :ritain from +666.
G-H
Meters had been used prior to this$ but they measured the rate of power
consumption at that particular moment. )ron<s meter recorded the total energy used over time$ and
showed it on a series of cloc! dials.
The prototype of the world<s first !ilowatt-hour meter$ inventor# =ttV :lWthy. Made in "an9
&ompany$ >ungary in +66?
The first specimen of the )& !ilowatt-hour meter produced on the basis of >ungarian =ttV :lWthy<s
patent and named after him was presented by the "an9 Bor!s at the 5ran!furt 5air in the autumn of
+66?$ and the first induction !ilowatt-hour meter was already mar!eted by the factory at the end of the
same year. These were the first alternating-current wattmeterQs$ !nown by the name of :lWthy-meters
41
Cnit of measurement
,anel-mounted solid state electricity meter$ connected to a - MK) electricity substation. 'emote
current and voltage sensors can be read and programmed remotely by modem and locally by infra-red.
The circle with two dots is the infra-red port. Tamper-evident seals can be seen.
The most common unit of measurement on the electricity meter is the !ilowatt hour$ which is e(ual to
the amount of energy used by a load of one !ilowatt over a period of one hour$ or .$4@@$@@@ joules.
Some electricity companies use the S* mega joule instead.
Demand is normally measured in watts$ but averaged over a period$ most often a (uarter or half hour.
'eactive power is measured in ;Kolt-amperes reactive;$ (varh in !ilovar-hours. :y convention$ a
;lagging; or inductive load$ such as a motor$ will have positive reactive power. ) ;leading;$ or
capacitive load$ will have negative reactive power.
G/H
Kolt-amperes measures all power passed through a distribution networ!$ including reactive and actual.
This is e(ual to the product of root-mean-s(uare volts and amperes.
Distortion of the electric current by loads is measured in several ways. ,ower factor is the ratio of
resistive (or real power to volt-amperes. ) capacitive load has a leading power factor$ and an
inductive load has a lagging power factor. ) purely resistive load (such as a filament lamp$ heater or
!ettle e8hibits a power factor of +. &urrent harmonics are a measure of distortion of the wave form.
42
5or e8ample$ electronic loads such as computer power supplies draw their current at the voltage pea!
to fill their internal storage elements. This can lead to a significant voltage drop near the supply
voltage pea! which shows as a flattening of the voltage waveform. This flattening causes odd
harmonics which are not permissible if they e8ceed specific limits$ as they are not only wasteful$ but
may interfere with the operation of other e(uipment. >armonic emissions are mandated by law in EC
and other countries to fall within specified limits.
=ther units of measurement
*n addition to metering based on the amount of energy used$ other types of metering are available.
Meters which measured the amount of charge (coulombs used$ !nown as ampere-hour meters$ were
used in the early days of electrification. These were dependent upon the supply voltage remaining
constant for accurate measurement of energy usage$ which was not a li!ely circumstance with most
supplies.
Some meters measured only the length of time for which charge flowed$ with no measurement of the
magnitude of voltage or current is made. These were only suited for constant-load applications.
0either type is li!ely to be used today.
*.4.( T/&es of energ/ meters"
!. Electromec%anical ind$ction meter
43
Mechanism of electromechanical induction meter# X - Koltage coil - many turns of fine wire encased
in plastic$ connected in parallel with load. X - &urrent coil - three turns of thic! wire$ connected in
series with load. X - Stator - concentrates and confines magnetic field. X - )luminum rotor disc. X -
rotor bra!e magnets. X - spindle with worm gear. X - display dials - note that the +E+@$ +@ and +@@@
dials rotate cloc!wise while the +$ +@@ and +@@@@ dials rotate counter-cloc!wise.
Electricity meters operate by continuously measuring the instantaneous voltage (volts and current
(amperes and finding the product of these to give instantaneous electrical power (watts which is then
integrated against time to give energy used (joules$ !ilowatt-hours etc. Meters for smaller services
( such as small residential customers can be connected directly in-line between source and customer.
5or larger loads$ more than about -@@ amps of load$ current transformers are used$ so that the meter
can be located other than in line with the service conductors. The meters fall into two basic categories$
electromechanical and electronic.
(. Electromec%anical meters
This mechanical electricity meter has every other dial rotating counter-cloc!wise.
The most common type of electricity meter is the Thomson or electromechanical induction watt-hour
meter$ invented by Elihu Thomson in +666.The electromechanical induction meter operates by
counting the revolutions of an aluminum disc which is made to rotate at a speed proportional to the
power. The number of revolutions is thus proportional to the energy usage. *t consumes a small
amount of power$ typically around - watts.
The metallic disc is acted upon by two coils. =ne coil is connected in such a way that it produces a
magnetic flu8 in proportion to the voltage and the other produces a magnetic flu8 in proportion to the
current. The field of the voltage coil is delayed by ?@ degrees using a lag coil.
G7H
This produces eddy
currents in the disc and the effect is such that a force is e8erted on the disc in proportion to the product
44
of the instantaneous current and voltage. ) permanent magnet e8erts an opposing force proportional to
the speed of rotation of the disc. The e(uilibrium between these two opposing forces results in the disc
rotating at a speed proportional to the power being used. The disc drives a register mechanism which
integrates the speed of the disc over time by counting revolutions$ much li!e the odometer in a car$ in
order to render a measurement of the total energy used over a period of time.
The type of meter described above is used on a single-phase )& supply. Different phase
configurations use additional voltage and current coils.
*. Single &%ase energ/ meter
Three-phase electromechanical induction meter$ metering +@@ ) -.@E/@@ K supply. >ori9ontal
aluminum rotor disc is visible in center of meter
The aluminum disc is supported by a spindle which has a worm gear which drives the register. The
register is a series of dials which record the amount of energy used. The dials may be of the
cyclometer type$ an odometer-li!e display that is easy to read where for each dial a single digit is
shown through a window in the face of the meter$ or of the pointer type where a pointer indicates each
digit. Bith the dial pointer type$ adjacent pointers generally rotate in opposite directions due to the
gearing mechanism.
45
The amount of energy represented by one revolution of the disc is denoted by the symbol Kh which is
given in units of watt-hours per revolution. The value 7.- is commonly seen. Csing the value of Kh$
one can determine their power consumption at any given time by timing the disc with a stopwatch. *f
the time in seconds ta!en by the disc to complete one revolution is t$ then the power in watts is
. 5or e8ample$ if Kh N 7.-$ as above$ and one revolution too! place in +/./
seconds$ the power is +6@@ watts. This method can be used to determine the power consumption of
household devices by switching them on one by one.
Most domestic electricity meters must be read manually$ whether by a representative of the power
company or by the customer. Bhere the customer reads the meter$ the reading may be supplied to the
power company by telephone$ post or over the internet. The electricity company will normally re(uire
a visit by a company representative at least annually in order to verify customer-supplied readings and
to ma!e a basic safety chec! of the meter.
*n an induction type meter$ creep is a phenomenon that can adversely affect accuracy$ that occurs
when the meter disc rotates continuously with potential applied and the load terminals open circuited.
) test for error due to creep is called a creep test.
Two standards govern meter accuracy$ )0S* &+-.-@ for 0orth )merica and *E& 4-@1..
1. Electronic meters
Electronic meters display the energy used on an %&D or %ED display$ and can also transmit readings
to remote places. *n addition to measuring energy used$ electronic meters can also record other
parameters of the load and supply such as ma8imum demand$ power factor and reactive power used
etc. They can also support time-of-day billing$ for e8ample$ recording the amount of energy used
during on-pea! and off-pea! hours.
46
Solid state electricity meter used in a home in the 0etherlands.
Electronic meters now use %ow ,ower 'adio$ "SM$ ",'S$ :luetooth$ *rD)$ as well as 'S-/61
wired lin!. The meters can now store the entire usage profiles with time stamps and relay them at a
clic! of a button. The demand readings stored with the profiles accurately indicate the load
re(uirements of the customer. This load profile data is processed at the utilities for billing and
planning purposes.
)M' ()utomatic Meter 'eading and 'M' ('emote Meter 'eading describe various systems that
allow meters to be chec!ed without the need to send a meter reader out. )n electronic meter can
transmit its readings by telephone line or radio to a central billing office. )utomatic meter reading can
be done with "SM ("lobal System for Mobile &ommunications modems$ one is attached to each
meter and the other is placed at the central utility office.
47
4. Solid?state design
:asic bloc! diagram of an electronic energy meter
)s in the bloc! diagram$ the meter has a power supply$ a metering engine$ ) processing and
communication engine (i.e. a microcontroller$ and other add-on modules such as 'T&$ %&D display$
communication portsEmodules and so on.
The metering engine is given the voltage and current inputs and has a voltage reference$ samplers and
(uanti9es followed by an )D& section to yield the digiti9ed e(uivalents of all the inputs. These inputs
are then processed using a Digital Signal Processor to calculate the various metering parameters such
as powers$ energies etc.
The largest source of long-term errors in the meter is drift in the preamp$ followed by the precision of
the voltage reference. :oth of these vary with temperature as well$ and vary wildly because most
meters are outdoors. &haracteri9ing and compensating for these is a major part of meter design.
The processing and communication section has the responsibility of calculating the various derived
(uantities from the digital values generated by the metering engine. This also has the responsibility of
communication using various protocols and interface with other addon modules connected as slaves to
it.
'T& and other add-on modules are attached as slaves to the processing and communication section
for various inputEoutput functions. =n a modern meter most if not all of this will be implemented
48
inside the microprocessor$ such as the 'eal Time &loc! ('T&$ %&D controller$ temperature sensor$
memory and analog to digital converters.
5. +$lti&le tariff C)aria.le rateD meters
Electricity retailers may wish to charge customers different tariffs at different times of the day to
better reflect the costs of generation and transmission. Since it is not possible to store electricity
during a period of low demand for use during a period of high demand$ costs will vary significantly
depending on the time of day. %ow cost generation capacity (baseload such as coal can ta!e many
hours to start$ meaning a surplus in times of low demand$ whereas high cost but fle8ible generating
capacity (such as gas turbines must be !ept available to respond at a moment<s notice (spinning
reserve to pea! demand$ perhaps being used for a few minutes per day$ which is very e8pensive.
Some multiple tariff meters use different tariffs for different amounts of demand. These are usually
industrial meters.
Domestic $sage
Domestic variable-rate meters generally permit two to three tariffs (;pea!;$ ;off-pea!; and ;shoulder;
and in such installations a simple electromechanical time switch may be used. >istorically$ these have
often been used in conjunction with electrical storage heaters or hot water storage systems.
Multiple tariffs are made easier by time of use (T=C meters which incorporate or are connected to a
time switch and which have multiple registers.
Switching between the tariffs may happen via a radio-activated switch rather than a time switch to
prevent tampering with a sealed time switch to obtain cheaper electricity.
#nited Eingdom
49
Economy 7 Meter and Tele switcher
'adio-activated switching is common in the CY$ with a nightly data signal sent within the long wave
carrier of ::& 'adio /$ +?6 !>9. The time of off-pea! usage is between +-..@am - 7..@am$ and this
is designed to power storage heaters and immersion heaters. *n the CY$ such tariffs are branded
Economy 7 or Bhite Meter. The popularity of such tariffs has declined in recent years$ at least in the
domestic mar!et$ due to the (perceived or real deficiencies of storage heaters and the low cost of
natural gas.
Some
meters using Economy 7 switch the entire electricity supply to the cheaper rate during the 7
hour night time period$ not just the storage heater circuit. The downside of this is that the daytime rate
will be a touch higher$ and standing charges may be a little higher too. 5or instance$ normal rate
electricity may be 7p per !Bh$ whereas Economy 7<s daytime rate might be 7.1p per !Bh$ but only
-.6p per !Bh at night. Timer switches installed on washing machines$ tumble dryers$ dishwashers and
immersion heaters may be set so that they switch on only when the rate is lower.
Commercial $sage
%arge commercial and industrial premises may use electronic meters which record power usage in
bloc!s of half an hour or less. This is because most electricity grids have demand surges throughout
the day$ and the power company may wish to give price incentives to large customers to reduce
demand at these times. These demand surges often correspond to meal times or$ famously$ to
advertisements in popular television programmers.
A&&liance energ/ meters
,lug in electricity meters (or ;,lug load; meters measure energy used by individual appliances. The
meter is plugged into an outlet$ and the appliance to be measured is plugged into the meter. Such
meters can help in energy conservation by identifying major energy users$ or devices that consume
e8cessive standby power. ) power meter can often be borrowed from the local power authorities or a
local public library.
50
!. In?%ome energ/ $se dis&la/s
) potentially powerful means to reduce household energy consumption is to provide convenient real-
time feedbac! to users so they can change their energy using behavior. 'ecently$ low-cost energy
feedbac! displays have become available. ) study using a consumer-readable meter in 1@@ =ntario
homes by Hydro One showed an average 4.1Z drop in total electricity use when compared with a
similarly si9ed control group. Hydro One subse(uently offered free power monitors to .@$@@@
customers based on the success of the pilot.
G+/H
,rojects such as "oogle ,ower Meter$ ta!e information
from a smart meter and ma!e it more readily available to users to help encourage conservation.
(. Smart meters
Smart meters go a step further than simple )M' (automatic meter reading. They offer additional
functionality including a real-time or near real-time reads$ power outage notification$ and power
(uality monitoring. They allow price setting agencies to introduce different prices for consumption
based on the time of day and the season.
These price differences can be used to reduce pea!s in demand (load shifting or pea! lopping$
reducing the need for additional power plants and in particular the higher polluting and costly to
operate natural gas powered pea!er plants. The feedbac! they provide to consumers has also been
shown to cut overall energy consumption.
Gcitation neededH
)nother type of smart meter uses no intrusive load monitoring to automatically determine the number
and type of appliances in a residence$ how much energy each uses and when. This meter is used by
electric utilities to do surveys of energy use. *t eliminates the need to put timers on all of the
appliances in a house to determine how much energy each uses.
*. Pre&a/ment meters
51
,repayment meter and magnetic stripe to!ens$ from a rented accommodation in the CY The button
labeled A displays information and statistics such as current tariff and remaining credit. The button
labeled , activates a small amount of emergency credit should the customer run out
1. A &re&a/ment ke/
The standard business model of electricity retailing involves the electricity company billing the
customer for the amount of energy used in the previous month or (uarter. *n some countries$ if the
retailer believes that the customer may not pay the bill$ a prepayment meter may be installed. This
re(uires the customer to ma!e advance payment before electricity can be used. *f the available credit
is e8hausted then the supply of electricity is cut off by a relay.
*n the CY$ mechanical prepayment meters used to be common in rented accommodation.
Disadvantages of these included the need for regular visits to remove cash$ and ris! of theft of the
cash in the meter.
Modern solid-state electricity meters$ in conjunction with smart cards$ have removed these
disadvantages and such meters are commonly used for customers considered to be a poor credit ris!.
*n the CY$ one system is the ,ay ,oint networ!$ where rechargeable to!ens ([uantum cards for
natural gas$ or plastic ;!eys; for electricity can be loaded with whatever money the customer has
available.
'ecently smartcards are introduced as much reliable to!ens that allows two way data e8change
between meter and the utility.
*n South )frica and 0orthern *reland prepaid meters are recharged by entering a uni(ue$ encoded
twenty digit number using a !eypad. This ma!es the to!ens$ essentially a slip of paper$ very cheap to
produce.
)round the world$ e8periments are going on$ especially in developing countries$ to test pre-payment
systems. *n some cases$ prepayment meters have not been accepted by customers. There are various
52
groups$ such as the Standard Transfer Specification (STS association$ which promote common
standards for prepayment metering systems across manufacturers. >owever in spite of these efforts
prepayment meter mar!et had not spread e8cept in South )frica.
*.5" OPTOCO#P3E"
)n optocoupler-isolated power supply is often the safest and most practical way to go when it comes
to performance and protection. >ereQs the basic on todayQs %EDEphoto detector isolators and what you
need to !now to apply them to your system.
The junior system designer often places the systemQs power re(uirements at the end of the list$ and
thus overloo!s the importance of an isolated$ versus non-isolated )&E)&$ )&ED&$ D&E)&$ or D&ED&
converter. True isolation (transformer at the input$ optoisolator in the supplyQs feedbac! control loops
virtually removes any direct conductive path between the power supplyQs input stage and its output
terminalsEload. ThatQs especially important in the high-power density applications that are becoming
more the rule than the e8ception$ and for more demanding system re(uirements
That often place power supplies in e8plosive or otherwise ha9ardous environments.
The use of an optocoupler also acts to brea! ground loops$ and this functionality is valuable in
eliminating common-mode noise$ especially for systems wor!ing at the higher operating voltages.
Bhen different power supplies in a system are tied together$ ground loop currents tend to be induced
due to slight differences in ground potential.
*n addition$ power supplies tend to see transient noise in e(uipment that switches between various
power states (todayQs optocouplers are able to withstand up to /@ !KEmicrosecond transient common-
mode voltage. Typical optocouplers for performing this so-called galvanic isolation functionFin
essence to connect intrinsically safe circuitry to circuits that pose a safety ris!Fcomprise an %ED$ a
photo detector$ and appropriate connecting circuitry in the supplyQs output-to-input feedbac! %oop.
*n general circuit operation$ the optocoupler$ driven by the supplyQs ,BM$ serves as the lin! to
maintain the supplyQs desired output voltage Bhen the output voltage deviates either due to line
andEor load changes$ the supplyQs error amplifier attempts to compensate. *t compares its input with a
reference voltage$ and the error signal thus controls the output of the ,BM. *n turn$ the ,BM directs
the primary- side
53
,ower M=S5ETs via the optocoupler
T%e standards
'egulatory agencies such as C% in the Cnited States$ &E0E%E& in Europe$ &S) in &anada$ and T**S
in Dapan$ set the power level needed to ma!e circuitry intrinsically safe. *n essence$ the standards set
the re(uirements for the galvanic isolation barrier between the 2safe3 circuitry and the outside world.
5or best results$ choose optocouplers with
)dditional reinforced insulation as suggested by *E& E0-4@7/7- 1--. 'einforced insulation ensures
protection from electric shoc! as well as provides a failsafe mode. 5ail-safe techni(ues terminate
system operation and leaves system processes and components in a secure state when a failure occurs.
The input-voltage level usually defines the insulation voltage rating$ which typically ranges from 1@@
volts for some telecom applications to .1@@ volts for universal line-voltage capability. The regulations
you need to !now about$ and the specs you should study$ include *E&4@?1@$ E011@--$ and *E&
4+@@@. *E& 4+@@@ in particular covers electromagnetic compatibility (EM&$ and part
/ of that document (*E&4+@@@- /-/ covers fast transientEburst Electrical 5ast Transient (E5T testing
discussed in part /./ addresses interference simulated in inductively loaded switches. *n this standard$
the modules will be subjected to the following test levels$ depending on the designed environment#
%evel + (Bell protectedJ %evel - (,rotectedJ %evel . (Typical *ndustrial EnvironmentJ and %evel /
(Severe *ndustrial Environment$ where test voltage pea!s at the power supply ports are @.1 !K (1!>9
repetition rate$ + !K (1!>9$ - !K (1!>9$ and / !K (-.1!>9$ respectively.
A&&lications"
54
&omputer terminals
System appliances$ measuring instruments
'egisters$ copiers$ automatic vending machines
Electric home appliances$ such as fan heaters$ etc
Signal transmission between circuits of different potentials and impedances
*.6 7S+
7lo.al S/stem for +o.ile Comm$nication C7S+D
Definition"
"SM$ which stands for "lobal System for Mobile communications$ reigns (important as the
worldQs most widely used cell phone technology. &ell phones use a cell phone service carrierQs "SM
networ! by searching for cell phone towers in the nearby area. "lobal system for mobile
communication ("SM is a globally accepted standard for digital cellular communication.
"SM is the name of a standardi9ation group established in +?6- to create a
common European mobile telephone standard that would formulate specifications for a pan-European
mobile cellular radio system operating at ?@@ M>9. *t is estimated that many countries outside of
Europe will join the "SM partnership.
55
+ODE+ SPECI;ICATIONS"
The S*M.@@ is a complete Tri-band "SM solution in a compact plug-in module.
5eaturing an industry-standard interface$ the S*M.@@ delivers "SME",'S?@@E+6@@E+?@@Mh9
performance for voice$ SMS$ data and 5a8 in a small form factor and with low power consumption.
The leading features of S*M.@@ ma!e it deal fir virtually unlimited application$ such as B%%
applications (5i8ed &ellular Terminal$ M-M application$ handheld devices and much more.
+. Tri-band "SME",'S module with a si9e of /@8..8-.61
-. &ustomi9ed MM* and !eypadE%&D support
.. )n embedded powerful T&,E*, protocol stac!
/. :ased upon mature and field proven platform$ bac!ed up by our support service$ from
definition to design and production.
56
7eneral ;eat$res"
Tri-band "SME",'S?@@E+6@@E+?@@Mh9
",'S multi-slot class +@
",'S mobile station class A:
&omplaint to "SM phase -E-P
i. -class /(-B \?@@M>9
ii. -class +(+B \E+6@@+?@@M>9
Dimensions# /@8..8-.61 mm
Beight# 6gm
7. &ontrol via )T commands
("SM @7.@7$ @7.@1 and S*M&=M enhanced )T commands
S*M application tool !it
supply voltage range ..1LL./.1 v
%ow power consumption
0ormal operation temperature# --@ Q& to P11 U&
'estricted operation temperature # --@ Q& to --1 U& and P11 Q& to P7@ U&
storage temperature# -/@ U& to P6@ U&
S&ecifications for ;a0"
"roup . and class +
S&ecifications for Data"
",'S class +@# ma8 61.4 !bps (downlin!
,:&&> support
coding schemes &s +$-$.$/
&SD upto +/./ !bps
CSSD
57
0on transperant mode
,,,-stac!