Professional Documents
Culture Documents
INTRODUCTION
1.1 INTRODUCTION
When planning a system deployment, regardless of size, it is important to look at not
just the initial costs of the hardware and software, but also at the ongoing operational
expenses which really constitutes the largest bulk of the total cost throughout the life of the
deployment. Many factors contribute to these costs and the right embedded system usually
offers superior value in the long term.
1.2 MOTIVATION
1
System Reliability: Because embedded applications have long life spans and systems
are often required to operate in harsh environments (including elevated temperature
ranges), embedded systems typically employ components rated for higher
temperatures and/or higher voltages. Conversely, commercial PC system designs
often employ components with lower temperature/voltage ratings because those
components are inexpensive, readily available, and support the operating conditions
where PCs are typically used. The lifespan of any electronic device is related to its
operating temperature, and that lifespan can be increased significantly either by
operating it at a lower temperature or at a lower voltage than it is rated for (i.e. derating).
Power Consumption: Lower power consumption is always better than higher power
consumption but not just for the obvious reasons of saving energy costs and
increasing battery life. First of all, lower power consumption of key components
results in the entire system operating at a lower temperature, putting less stress on the
rest of the system components, and increasing the life of the system as mentioned
above. Low power consumption can often obviate the need for a fan which allows the
system to run quieter, enables smaller enclosures, and lowers implementation and
support costs. Low power consumption combined with power management
technology built into the silicon itself, also eases the burden on software engineers
who are increasingly tasked with developing sophisticated applications and
techniques for managing system power.
CHAPTER - 2
PREPAID METERING SYSTEM
2.1 EXISTING SYSTEM
Electricity theft includes tampering meters to show a low meter reading, stealing
electricity bypassing a meter, billing irregularities and unpaid bills [1]. Billing irregularities
comprise inaccurate meter reading taken by bribed service man and intentional fixing of the
bill by office staffs in exchange of illicit payments from the consumer. Different nontechnical and technical methods were proposed in the past to detect electricity pilfering.
Nontechnical methods may include inspection of the customers with suspicious load profile.
Although periodic inspection can substantially reduce theft, such measure requires large
manpower and huge labor. Such effort also fails in most cases due to the dishonesty of the
staffs.
Some of the technical ways to detect pilferage are use of central observer meter at
secondary terminals of distribution transformer, harmonic generator, genetic support vector
machines, extreme learning machine, and power line impedance technique. However, these
technical approaches can be effectively implemented only if proper communication is
ensured between the central control station and the appropriate test points.
Smart (Prepaid) Energy Meter has been proposed as an innovative solution aimed at
facilitating affordability and reducing the cost of utilities. This mechanism, essentially,
requires the users to pay for the electricity before its consumption. In this way, consumers
hold credit and then use the electricity until the credit is exhausted. If the available credit is
exhausted then the electricity supply is cutoff by a relay. Readings made by human operators
are prone to errors. This project addresses the above mentioned problems. The development
of GSM infrastructure in past two decades made meter reading system wireless. The GSM
infrastructure, which has national wide coverage, can be used to request and retrieve power
consumption notification over individual houses and flats. Apart from making readings using
GSM communication, billing system is needed to be made prepaid to avoid unnecessary
usage of power. The use of Prepaid Energy meter is still controversial. On the one hand, those
that support the diffusion of prepaid meters claim that they benefit both consumers and
utilities because they help users to consume more efficiently and to improve the management
of their budget, while allowing firms to reduce financial costs. On the other hand, those that
are against prepaid meters argue that their adoption is expensive for firms and risky for low
income consumers, as the insecurity and volatility of their income may force them to make
little use of the service, or ultimately, bring about involuntary self-disconnection.
Relay
Load
Microcontroller
ARM V7
(CORTEX M3)
Buzzer
GSM
2.5 DESCRIPTION:
In the proposed system the power utility maintains a server and each consumer are
provided an energy meter. The server and prepaid meters use GSM modem and GSM module
respectively to communicate with each other using the GSM network. e energy metering chip
produces pulses proportional to the energy consumed using the outputs of current and
potential transformers. The microcontroller calculates the energy consumption by counting
the output pulses of the energy metering chip on an interrupt basis. The microcontroller uses
AT command set to communicate with the GSM module (mobile phone). A battery backup is
also available in the energy meter. The embedded C programming language and the kiel
vision software have been used to program the microcontroller and to implement the server,
respectively.
The recharging process in the proposed metering system is similar to that of
recharging balance in a mobile phone. The user has to buy a scratch card and scratch it to
uncover the secret pin number of the corresponding energy unit he has bought. For example,
if a user wants to buy 100 units (KWh), he has to pay for the 100 units and obtain a scratch
card which holds the secret pin number of the corresponding 100 units. The user has to send
the pin number to the server through SMS. The server then checks whether the pin number is
valid or not. If the pin number is valid, the server then extracts the information of energy-unit
from the pin number (in this case 100 units) and sends it to the meter of the user through
GSM network. The household meter then receives the corresponding unit and is activated. As
the user consumes energy, the corresponding units are deducted from the total balance and the
remaining units are displayed using LCD. After the consumption of the allocated energy, the
meter automatically disconnects the load from the main power line using the relay until the
user recharges again. Thus the system avoids the irregularities associated with traditional
billing system and ensures revenue collection.
CHAPTER - 3
HARDWARE REQUIREMENTS
3.1 MICROCONTROLLER
The microcontroller used in this project is ARM cortex M3. The LPC17xx is an ARM
Cortex-M3 based microcontroller for embedded applications requiring a high level of
integration and low power dissipation. The ARM Cortex-M3 is a next generation core that
offers system enhancements such as modernized debug features and a higher level of support
block integration. The processor is a low-power processor that features low gate count, low
interrupt latency, and low-cost debug. It is intended for deeply embedded applications that
require fast interrupt response features. The processor implements the ARM architecture v7M. The ARM Cortex-M3 CPU incorporates a 3-stage pipeline and uses Harvard architecture
with separate local instruction and data buses as well as a third bus for peripherals. The ARM
Cortex-M3 CPU also includes an internal pre-fetch unit that supports speculative branches.
The peripheral complement of the LPC17xx includes up to 512 kB of flash memory,
up to 64 kB of data memory, Ethernet MAC, a USB interface that can be configured as either
Host, Device, or OTG, 8 channel general purpose DMA controller, 4 UARTs, 2 CAN
channels, 2 SSP controllers, SPI interface, 3 I2C interfaces, 2-input plus 2-output I2S
interface, 8 channel 12-bit ADC, 10-bit DAC, motor control PWM, Quadrature Encoder
interface, 4 general purpose timers, 6-output general purpose PWM, ultra-low power RTC
with separate battery supply, and up to 70 general purpose I/O pins.
The Processor core is a low gate count core, with low latency interrupt
processing that features:
ARMv7-M. A Thumb-2 Instruction Set Architecture (ISA) subset, consisting of all base
Thumb-2 instructions, 16-bit and 32-bit, and excluding blocks for media, Single Instruction
Multiple Data (SIMD), enhanced Digital Signal Processor (DSP) instructions (E variants),
and ARM system access.
Banked Stack Pointer (SP) only.
Hardware divide instructions, SDIV and UDIV (Thumb-2 instructions).
Handler and Thread modes.
devices. The LPC17xx uses a multi-layer AHB matrix to connect the Cortex-M3 buses and
other bus masters to peripherals in a flexible manner that optimizes performance by allowing
peripherals on different slaves ports of the matrix to be accessed simultaneously by different
bus masters. Details of the multilayer matrix connections are APB peripherals are connected
to the CPU via two APB busses using separate slave ports from the multilayer AHB matrix.
This allows for better performance by reducing collisions between the CPU and the DMA
controller. The APB bus bridges are configured to buffer writes so that the CPU or DMA
controller can write to APB devices without always waiting for APB write completion.
complex and open systems without sacrificing the security of the application. Unprivileged
code execution limits or excludes access to some resources like certain instructions and
specific memory locations. The Thread mode is the typical operating mode and supports both
privileged and unprivileged code. The Handler mode is entered when an exception occurs and
all code is privileged during this mode. In addition, all operation is categorized under two
operating states, Thumb for normal execution and Debug for debug activities.
The Cortex-M3 processor is a memory mapped system with a simple, fixed memory
map for up to 4 gigabytes of addressable memory space with predefined, dedicated addresses
for
code
(code
space),
SRAM(memory
space),
external
memories/devices
and
internal/external peripherals. There is also a special region to provide for vendor specific
addressability.
capability particularly useful in automotive applications. The RBIT instruction reverses the
bits in a word and is useful in DSP algorithms such as DFT. The table branch instructions
TBB and TBH enable a balance of code compaction and high performance. Thumb-2
instructions also introduce a new If-Then construct that predicates the conditional execution
of up to four subsequent instructions.
3.1.5 The Nested Vectored Interrupt Controller (NVIC):
The highly configurable NVIC is an integral part of the Cortex-M3 processor and
provides the processors outstanding interrupt handling abilities. The Cortex-M3 processor
uses a re-locatable vector table that contains the address of the function to be executed for a
particular interrupt handler. On accepting an interrupt, the processor fetches the address from
the vector table through the instruction bus interface. The vector table is located at address
zero at reset, but can be relocated by programming a control register.
To reduce gate count and enhance system flexibility the Cortex-M3 has migrated from
the banked shadow register exception model of the ARM7 processor to a stack based
exception model. When an exception takes place, the Program Counter, Program Status
Register, Link Register and the R0-R3,R12 general purpose registers are pushed on to the
stack. The data bus stacks the registers whilst the instruction bus identifies the exception
vector from the vector table and fetches the first instruction of the exception code. Once the
stacking and instruction fetch are completed, the interrupt service routine or fault handler is
executed, followed by the automatic restoration of the registers to enable the interrupted
program to resume normal execution. By handling the stack operations in hardware, the
Cortex-M3 processor removes the need to write assembler wrappers that are required to
perform stack manipulation for traditional C-based interrupt service routines, making
application development significantly easier.
The NVIC supports nesting (stacking) of interrupts, allowing an interrupt to be
serviced earlier by exerting higher priority. It also supports dynamic reprioritization of
interrupts. Priority levels can be changed by software during run time. Interrupts that are
being serviced are blocked from further activation until the interrupt service routine is
completed, so their priority can be changed without risk of accidental re-entry. Tail chaining
in the NVIC is shown in the below figure 3.1.5.
Accesses to memory locations that are not defined in the MPU regions, or not
permitted by the region setting, will cause the Memory Management Fault exception to take
place. The protection for the regions is implemented with rules that are based on the type of
transaction (read, write or execute) and privilege of code performing the access. Each region
includes a set of bits which affect what kinds of accesses are permitted, as well as bits that
affect what kind of bus action is allowed. The MPU also supports overlapping regions, which
are regions that cover the same address. Since sizes are in multiples of 2, overlap means that
one may be fully enclosed within another. It is therefore possible to have multiple regions
enclosed by a single region and it is also possible to have nested overlapping. In the case of
address lookups to locations within overlapping regions, the region with the highest region
number is returned.
The Data Watch point and Trace (DWT) unit contains four comparators, each of
which can be configured as hardware watch points are shown in fig3.1.7. When used in this
configuration, the comparators can be programmed to compare either the data address or
program counter. The DWT comparators can also be configured to trigger PC sampler events,
data address sampler events and to cause the Embedded Trace Macrocell (ETM) to emit
trigger packets in the instruction trace stream.
and the 32-bit AMBA APB based Private Peripheral Bus (PPB). The bus matrix also
implements unaligned data accesses and bit banding. All fetches are one word wide, with the
number of instructions fetched per word depending upon the type of code implemented and
its alignment in memory. The 32-bit D Code interface accesses data from the code memory
space and can be accessed by the CM3Core and the DAP. The 32-bit System interface fetches
instructions and accesses data within the system memory space and like the D Code bus, can
be accessed by the CM3Core and the DAP. The PPB enables access to components outside of
the Cortex-M3 processor system.
3.2 LCD
3.2.1 LCD Description:
LCD (Liquid Crystal Display) screen is an electronic display module and find a wide
range of applications. A 16x2 LCD display is very basic module and is very commonly used
in various devices and circuits. These modules are preferred over seven segments and other
multi segment LEDs. The reasons being: LCDs are economical; easily programmable; have
no limitation of displaying special & even custom characters (unlike in seven segments),
animations and so on.
A 16x2 LCD means it can display 16 characters per line and there are 2 such lines. In
this LCD each character is displayed in 5x7 pixel matrix. This LCD has two registers,
namely, Command and Data. The command register stores the command instructions given to
the LCD. A command is an instruction given to LCD to do a predefined task like initializing
it, clearing its screen, setting the cursor position, controlling display etc. The data register
stores the data to be displayed on the LCD. The data is the ASCII value of the character to be
displayed on the LCD.
Pin
No
1
2
Function
Name
Ground (0V)
Supply voltage; 5V (4.7V 5.3V)
Ground
Vcc
VEE
when high
Select
Low to write to the register; High to read from the Read/write
register
Sends data to data pins when a high to low pulse is Enable
given
7
8
DB0
DB1
DB2
10
DB3
11
DB4
12
DB5
13
DB6
14
DB7
15
Led+
16
Led-
The above diagram represents 16 pin 16X2 LCD. The function and pin numbers are shown in
the below the table 3.2.2.
3.3 GSM
The GSM system is the most widely used cellular technology in use in the world
today. The letters GSM originally stood for the words Grouped Special Mobile, but as it
became clear this cellular technology was being used worldwide the meaning of GSM was
changed to Global System for Mobile Communications. Since this cellular technology was
first deployed in 1991, the use of GSM has grown steadily, and it is now the most widely cell
phone system in the world.
3.3.1 GSM Architecture:
A GSM network is composed of several functional entities, whose functions and
interfaces are specified. The GSM network can be divided into three broad parts. The Mobile
Station is carried by the subscriber. The Base Station Subsystem controls the radio link with
the Mobile Station. The Network Subsystem, the main part of which is the Mobile services
Switching Centre (MSC), performs the switching of calls between the mobile users, and
between mobile and fixed network users. The MSC also handles the mobility management
operations.
The Mobile Station and the Base Station Subsystem communicate across the Um
interface, also known as the air interface or radio link. The Base Station Subsystem
communicates with the Mobile services Switching Centre across the A interface.
The Base Station Subsystem is composed two parts, the Base Transceiver Station
(BTS) and the Base Station Controller (BSC). These communicate across the standardized
Abis interface, allowing (as in the rest of the system) operation between components made by
different suppliers. The Base Transceiver Station houses the radio transceivers that define a
cell and handles the radio-link protocols with the Mobile Station. In a large urban area, there
will potentially be a large number of BTSs deployed, thus the requirements for a BTS are
ruggedness, reliability, portability, and minimum cost. The Base Station Controller manages
the radio resources for one or more BTSs. It handles radio-channel setup, frequency hopping,
and handovers, as described below. The BSC is the connection between the mobile station
and the Mobile service Switching Centre (MSC).
3.3.4 Network Subsystem:
The central component of the Network Subsystem is the Mobile services Switching
Centre (MSC). It acts like a normal switching node of the PSTN or ISDN, and additionally
provides all the functionality needed to handle a mobile subscriber, such as registration,
authentication, location updating, handovers, and call routing to a roaming subscriber. These
services are provided in conjunction with several functional entities, which together form the
Network Subsystem. The MSC provides the connection to the fixed networks (such as the
PSTN or ISDN). Signaling between functional entities in the Network Subsystem uses
Signaling System Number 7 (SS7), used for trunk signaling in ISDN and widely used in
current public networks.
The Visitor Location Register (VLR) contains selected administrative information
from the HLR, necessary for call control and provision of the subscribed services, for each
mobile currently located in the geographical area controlled by the VLR. Although each
functional entity can be implemented as an independent unit, all manufacturers of switching
equipment to date implement the geographical area controlled by the MSC corresponds to
that controlled by the VLR, thus simplifying the signaling required. VLR together with the
MSC, so that the Note that the MSC contains no information about particular mobile stations
this information is stored in the location registers. The other two registers are used for
authentication and security purposes.
The Equipment Identity Register (EIR) is a database that contains a list of all valid
mobile equipment on the network, where each mobile station is identified by its International
Mobile Equipment Identity (IMEI). An IMEI is marked as invalid if it has been reported
stolen or is not type approved. Card which is used for authentication and encryption over the
radio channel. The Authentication Centre (AUC) is a protected database that stores a copy of
the secret key stored in each subscriber's SIM card, which is used for authentication and
encryption over the radio channel.
GSM modems for setup and control is based on the Hayes AT Command set. The GSM
modem specific commands are adapted to the services offered by a GSM modem such as:
text messaging, calling a given Phone number, deleting memory locations etc. Since the main
objective for this application note is to show how to send and receive text messages, only a
subset of the AT-Command set needs to be implemented. The European Telecommunication
Standard Institute (ETSI) GSM 07.05 defines the AT-Command interface for GSM
compatible modems. From this document some selected commands are chosen, and presented
briefly in this section. This command subset will enable the modem to send and receive SMS
messages.
3.3.6 GSM Commands:
Sending The Message
To send the SMS message, we can type the following command:
AT+CMGS=+31638740161 <ENTER>
Replace the above phone number with our own cell phone number. The modem will respond
with:
You can now type the message text and send the message using the <CTRL>-<Z> key
combination:
Hello World ! <CTRL-Z>
After some seconds the modem will respond with the message ID of the message,
indicating that the message was sent correctly:
+CMGS: 62
The message will arrive on the mobile phone shortly.
Listing The Messages
Once we have successfully set the messages storage, we can list the messages
available using the list command:
AT+CMGL=ALL <ENTER>
ALL has to be send in uppercase on some modems. The modem will respond with
a list of decoded SMS messages.
Reading A Message
To list a single message, we have to use the read command. We must use the list
command first, so we know the indexes of the messages in the storage. For instance, to read
the message on memory location 2 we can use:
AT+CMGR=2 <ENTER>
The modem will list the single message:
+CMGR: REC READ,+31625012254,,07/07/05,09:56:03+08
Test message 2
OK
The status of the message is now REC_READ instead of REC_UNREAD because we
read the message.
Deleting A Message
Once we have read a message, we can free the memory by deleting the message from the
storage. For instance, to delete the message on memory location 2 we can use:
AT+CMGD=2 <ENTER>
The modem will delete the single message.
bridge rectifier
filter circuit
regulator
3.4.2 Transformer:
A transformer is a device that transfers electrical energy from one circuit to another
through inductively coupled conductors the transformer's coils. A varying current in the first
or primary winding creates a varying magnetic flux in the transformer's core, and thus a
varying magnetic field through the secondary winding. This varying magnetic field induces a
varying electromotive force (EMF) or "voltage" in the secondary winding. This effect is
called mutual induction.
3.4.3 Diodes:
Diodes allow electricity to flow in only one direction. The arrow of the circuit
symbol shows the direction in which the current can flow. Diodes are the electrical version
of a valve and early diodes were actually called valves.
3.4.4 Rectifier:
The purpose of a rectifier is to convert an AC waveform into a DC waveform (OR)
Rectifier converts AC current or voltages into DC current or voltage. There are two different
rectification circuits, known as 'half wave' and 'full wave' rectifiers. Both use components
called diodes to convert AC into DC.
The Half Wave Rectifier
The half-wave rectifier is the simplest type of rectifier since it only uses one diode, as
shown in figure 3.4.4.
Figure3.4.4 shows the AC input waveform to this circuit and the resulting output. As
you can see, when the AC input is positive, the diode is forward-biased and lets the current
through. When the AC input is negative, the diode is reverse-biased and the diode does not
let any current through, meaning the output is 0V. Because there is a 0.7V voltage loss across
the diode, the peak output voltage will be 0.7V less than Vs.
When the AC input is positive, diodes A and B are forward-biased, while diodes C and D
are reverse-biased. When the AC input is negative, the opposite is true diodes C and D are
forward-biased, while diodes A and B are reverse-biased.
While the full wave rectifier is an improvement on the half wave rectifier, its output
still isn't suitable as a power supply for most circuits since the output voltage still varies
between 0V and Vs-1.4V. So, if you put 12V AC in, you will 10.6V DC out.
3.5 Operation:
The circuit consisting of the combination of the two diodes is called full wave rectifier.
These diodes combined with a capacitor are known as full wave rectifier with a capacitor.
This capacitor is known as filtering capacitor improves the output of the rectifier and the
efficiency of this rectifier is 81.2%.
The resistor is used to limit the voltage and current those are supplied to the regulator in order
to avoid the regulator from getting damaged.
The diode 3 is used to protect the diodes 1 and 2 from the back current discharged by the
capacitor.
The output at this point is not completely regulated since there is still some amount of ripple
present in the rectified voltage.
Therefore a regulator is used to ensure low voltage ripple and excellent load and line voltage
regulation.
The resistor after the regulator is used to limit the current supplied to the LED.
When the voltage supplied is greater than 3.8V, the LED will glow. The regulated DC voltage
output is taken across the capacitor and is further supplied to other applications.
3.6 RELAY
A relay is an electrically operated switch. These are remote control electrical switches
that are controlled by another switch, such as a horn switch or a computer as in a power train
control module, devices in industries, home based applications. Relays allow a small current
pin, 4-pin, 5-pin, and 6-pin, single switch or dual switches. Relays are used throughout the
automobile. Relays which come in assorted sizes, ratings, and applications, are used as
remote control switches. A typical vehicle can have 20 relays or more.
To maintain initial performance, care should be taken to avoid dropping or hitting the relay.
Under normal use, the relay is designed so that the case will not detach. To maintain initial
performance, the case should not be removed. Relay characteristics cannot be guaranteed if
the case is removed.
Use of the relay in an atmosphere at standard temperature and humidity with minimal
amounts of dust, SO 2, H 2 S, or organic gases is recommended.
Please avoid the use of silicon-based resins near the relay, because doing so may result in
contact failure. (This applies to plastic sealed type relays, too.)
Care should be taken to observe correct coil polarity (+, ) for polarized relays.
Proper usage requires that the rated voltage be impressed on the coil. Use rectangular waves
for DC coils and sine waves for AC coils.
Be sure the coil impressed voltage does not continuously exceed the maximum allowable
voltage.
Absolutely avoid using switching voltages and currents that exceed the designated values.
The rated switching power and life are given only as guides. The physical phenomena at the
contacts and contact life greatly vary depending on the type of load and the operating
conditions. Therefore, be sure to carefully check the
Do not exceed the usable ambient temperature values listed in the catalog.
Use alcohol based cleaning solvents when cleaning are to be performed using a sealed type
relay.
As a guide, use a Fasten mounting pressure of 40 to 70N {4 to 7kgf}for relays with tab
terminals.
A relay is used to isolate one electrical circuit from another. It allows a low current
control circuit to make or break an electrically isolated high current circuit path. The basic
relay consists of a coil and a set of contacts. The most common relay coil is a length of
magnet wire wrapped around a metal core. When voltage is applied to the coil, current passes
through the wire and creates a magnetic field. This magnetic field pulls the contacts together
and holds them there until the current flow in the coil has stopped. The diagram below shows
the parts of a simple relay.
3.6.2 Operation:
When a current flows through the coil, the resulting magnetic field attracts an
armature that is mechanically linked to a moving contact. The movement either makes or
breaks a connection with a fixed contact. When the current is switched off, the armature is
usually returned by a spring to its resting position. Latching relays exist that require operation
of a second coil to reset the contact position.
By analogy with the functions of the original electromagnetic device, a solid-state
relay operates a thyristor or other solid-state switching device with a transformer or lightemitting diode to trigger it.
Normally-open (NO) contacts connect the circuit when the relay is activated; the circuit is
disconnected when the relay is inactive. It is also called a Form A contact or "make" contact.
Normally-closed (NC) contacts disconnect the circuit when the relay is activated; the circuit
is connected when the relay is inactive. It is also called a Form B contact or "break" contact.
Change-over (CO), or double-throw (DT), contacts control two circuits: one normally-open
contact and one normally-closed contact with a common terminal. It is also called a Form C
contact or transfer contact ("break before make"). If this type of contact utilizes make
before break functionality, then it is called a Form D contact.
SPST
SPST relay stands for Single Pole Single Throw relay. Current will only flow through
the contacts when the relay coil is energized.
DPST relay stands for Double Pole Single Throw relay. When the relay coil is
energized, two separate and electrically isolated sets of contacts are pulled down to make
contact with their stationary counterparts. There is no complete circuit path when the relay is
De-energized.
3.7 APPLICATIONS
Relays are used:
To control a high-voltage circuit with a low-voltage signal, as in some types of modems,
To control a high-current circuit with a low-current signal, as in the starter solenoid of an
automobile,
To detect and isolate faults on transmission and distribution lines by opening and closing
circuit breakers (protection relays),
To isolate the controlling circuit from the controlled circuit when the two are at different
potentials, for example when controlling a mains-powered device from a low-voltage switch.
The latter is often applied to control office lighting as the low voltage wires are easily
installed in partitions, which may be often moved as needs change. They may also be
controlled by room occupancy detectors in an effort to conserve energy,
To perform logic functions. For example, the Boolean AND function is realized by
connecting relay contacts in series, the OR function by connecting contacts in parallel. Due to
the failure modes of a relay compared with a semiconductor, they are widely used in safety
critical logic, such as the control panels of radioactive waste handling machinery.
As oscillators, also called vibrators. The coil is wired in series with the normally closed
contacts. When a current is passed through the relay coil, the relay operates and opens the
contacts that carry the supply current. This stops the current and causes the contacts to close
again. The cycle repeats continuously, causing the relay to open and close rapidly. Vibrators
are used to generate pulsed current.
To generate sound. A vibrator, described above, creates a buzzing sound because of the rapid
oscillation of the armature. This is the basis of the electric bell, which consists of a vibrator
with a hammer attached to the armature so it can repeatedly strike a bell.
To perform time delay functions. Relays can be used to act as an mechanical time delay
device by controlling the release time by using the effect of residual magnetism by means of
a inserting copper disk between the armature and moving blade assembly.
CHAPTER - 4
SOFTWARE REQUIREMENTS
4.1 KEIL VISION4
4.1.1 Vision4 Overview
The Vision4 IDE is a windows based software development platform that combines
a robust editor, project manager, and integrated make facility. Vision4 integrates all tools
including the C compiler, macro assembler, linker/locator, and HEX file generator. Vision4
helps expedite the development process of our embedded applications by providing the
following:
Integrated make facility for assembling, compiling, and linking our embedded
applications
True integrated source level Debugger with high-speed CPU and peripheral simulator
Advanced GDI interface for software debugging in the target hardware and for
connection to Keil ULINK
Flash programming utility for downloading the application program into Flash ROM
Select the controller series from the database list available from IDE.
10
11
12
13
14
15
16
Upon completion, we would like our meter to be able to do the following things:
1 Measure electricity consumption accurately.
2 Display real time account balance.
3 Communicate with the utility company to:
Let the user recharge his electricity account from the meter
APPENDEX
PROGRAM CODE
#include "lpc17xx.h"
#include "lcd.h"
#include "uart.h"
#include "math.h"
#define EINT0
0x00000001
#define EINT0_EDGE
0x00000001
#define EINT0_RISING
0x00000001
#define BLINK_INTERVAL
250
#define TRUE
#define FALSE
#define TIMER_MATCH
1000
(9000000/100 - 1)
IIRValue >>= 1;
{
/* Receive Data Available */
rf11=LPC_UART3->RBR;
if(rf11=='+')
{
if(UART3_Rx()=='C')
{
if(UART3_Rx()=='M')
{
if(UART3_Rx()=='T')
{
if(UART3_Rx()=='I')
{
if(UART3_Rx()==':')
{
while(UART3_Rx()!=',');
msgno=UART3_Rx();
LPC_UART3->FCR = 0x05; // Clear ISR
UART3_String("AT+CMGF=1");
UART3_Tx('\r');
_delay_ms(500);
UART3_String("AT+CMGR=");
UART3_Tx(msgno);
LPC_UART3->FCR = 0x07;
UART3_Tx('\r');
while(UART3_Rx()!='?');
for(i=0;(s1[i]=UART3_Rx())!='$';i++)
{
j++;
}
_delay_ms(20000);
s1[i]='\0';
//UART3_String(s1);
UART3_Tx('\r');
_delay_ms(500);
UART3_String("AT+CMGD=");
UART3_Tx(msgno);
UART3_Tx('\r');
v=1;
}
}
}
}
}
}
}
else if ( IIRValue == IIR_CTI )
{
/* Character Time-out indicator */
UART1Status |= 0x100;
}
}
if(bal>0)
{
c++;
bal=bal-1;
InitLCD();
_delay_ms(100);
LCDCmd(0x80);
_delay_ms(100);
LCDWriteStringXY(0,0,"Power:");
_delay_ms(100);
LCDWriteIntXY(9,0,c,4);
_delay_ms(100);
LCDWriteStringXY(14,0,"KW");
_delay_ms(100);
LCDWriteStringXY(0,1,"Balence:");
_delay_ms(100);
LCDWriteIntXY(9,1,bal,4);
_delay_ms(100);
LCDWriteStringXY(14,1,"RS");
_delay_ms(100);
}
LPC_SC->EXTINT |= EINT0;
}
/* clear interrupt */
_delay_ms(100);
UART3_String("AT");
UART3_Tx('\r');
_delay_ms(100);
UART3_String("AT+CMGF=1");
UART3_Tx('\r');
_delay_ms(100);
UART3_String("AT+CMGF=1");
UART3_Tx('\r');
_delay_ms(100);
UART3_String("AT+CMGS=");
UART3_Tx('"');
UART3_String(M_NO);
UART3_Tx('"');
UART3_Tx('\r');
_delay_ms(100);
UART3_String("Your Power balance is Low. Please Recharge your Account ");
UART3_Tx('\r');
UART3_Tx(0X1A);
for(i=0;i<6;i++)
{
_delay_ms(1000);
}
}
LPC_TIM0->IR = 0x1<<0;
timer0_m0_counter++;
}
return;
}
|= (1<<1);
LPC_SC->PCLKSEL0 |= (1<<2);
LPC_TIM0->TCR
// reset timer
LPC_TIM0->PR
LPC_TIM0->MR0
= 0x01;
= 72;
= 1000000;
= 1000000;
40nS/tick
LPC_TIM0->MR1
40nS/tick
LPC_TIM0->MCR
= 3;
NVIC_EnableIRQ(TIMER0_IRQn);
}
}
init_timer( 0 );
InitLCD();
_delay_ms(30);
LCDCmd(0x80);
_delay_ms(30);
LCDWriteString("Welcome");
_delay_ms(30);
UARTInit1(9600);
UARTInit3(9600);
//ADCInit(ADC_CLK);
_delay_ms(1000);
UART3_String("AT+CMGD=1\r");
_delay_ms(1000);
UART3_String("AT+CMGD=2\r");
_delay_ms(1000);
UART3_String("AT+CMGD=3\r");
_delay_ms(1000);
UART3_String("AT+CMGD=4\r");
_delay_ms(1000);
UART3_String("AT+CMGD=5\r");
_delay_ms(1000);
bal=0;
while( 1 )
{
if(bal>0)
{
if
(timer0_m0_counter
>
0)
BLINK_INTERVAL) )
{
LCDCmd(0xc0);
_delay_ms(10);
LCDWriteInt(sec,4);
_delay_ms(10);
sec++;
timer0_m0_counter=0;
if(sec>=60)
{
sec=0;
bal--;
c++;
LCDWriteStringXY(0,0,"Power:");
_delay_ms(100);
LCDWriteIntXY(9,0,c,4);
_delay_ms(100);
LCDWriteStringXY(14,0,"KW");
_delay_ms(100);
LCDWriteStringXY(4,1,"Bal:");
_delay_ms(100);
LCDWriteIntXY(9,1,bal,4);
_delay_ms(100);
LCDWriteStringXY(14,1,"RS");
_delay_ms(100);
}
}
PowerRelay_en1();
&&
(timer0_m0_counter
<=
if(bal==2)
{
if(count==0)
{
count=1;
Send_SMS(mobno);
}
}
else
{
count=0;
}
if(bal==0)
{
bal=0;
PowerRelay_clr1();
}
}
else
{
PowerRelay_clr1();
}
if(v==1)
{
v=0;
amt=0;
LCDClear();
j=j-1;
k=j;
s1[i]='\0';
for(i=0;i<=j;i++)
{
amt=amt+((s1[i]-48)*(pow(10,k)));
LCDWriteInt(s1[i],2);
k--;
}
InitLCD();
_delay_ms(10);
bal=bal+amt;
LCDClear();
_delay_ms(10);
LCDWriteString("Add ");
_delay_ms(10);
LCDWriteInt(amt,4);
_delay_ms(10);
LCDWriteString(" Rupees Success");
_delay_ms(2000);
LCDClear();
_delay_ms(10);
LCDCmd(0x80);
_delay_ms(100);
LCDWriteStringXY(0,0,"Power:");
_delay_ms(100);
LCDWriteIntXY(9,0,c,4);
_delay_ms(100);
LCDWriteStringXY(14,0,"KW");
_delay_ms(100);
LCDWriteStringXY(0,1,"Balence:");
_delay_ms(100);
LCDWriteIntXY(9,1,bal,4);
_delay_ms(100);
LCDWriteStringXY(14,1,"RS");
_delay_ms(100);
i=0;j=0;k=0;
}
}
CHAPTER 5
RESULT ANLYSIS
CONCLUSION
In Chapter 1, given brief introduction about embedded system and motivation of the
project is discussed.
In Chapter 2, the problem statement is discussed. Dissertation objectives and
organization of the dissertation are illustrated in this chapter. The importance and need for a
new generalized technique for detection of illegal consumers is also discussed.
In Chapter 3 and 4, a detailed analysis on features of smart meters and available
communication technologies are presented. Issues and challenges in the design, development,
deployment, and maintenance of smart meter technologies are explained.
FUTURE SCOPE
Encoding algorithm can be enhanced by introducing more real-world parameters and
variables (both technical and non-technical), such that the process of mapping energy patterns
into irregularities is further strengthened. Integration of these new technical and non-technical
parameters into classification algorithms may come into light after complete implementation
of smart grid. This inclusion will ensure the impact of such parameters on algorithms for
identification of illegal consumers.
REFERENCES
[1] T. B. Smith, Electricity theft: a comparative analysis, Elsevier Journal
Energy Policy, vol. 32, no. 18, pp. 2067-2076, Dec. 2004.
[2] A.H. Nizar and Z.Y. Dong, Identification and detection of electricity
customer behaviour irregularities, in proceedings of IEEE Power
Systems Conference and Exposition, pp. 1-10, Mar. 2009.
[3] Jain and Bagree , A prepaid meter using mobile communication , International Journal
of Engineering, Science and 164 Technology, Vol. 3, No. 3, 2011, pp. 160-166.