You are on page 1of 65

Theft detection based GSM Prepaid electricity system

CHAPTER 1

ABSTRACT

As a part of measure to make electricity accessible to every Pakistani, to overcome the problem
of overbilling, meter tempering and to ensure a cost effective operation, we have introduced the
Prepaid Electricity System. The user receives message on their mobile phones about the units
they purchased via GSM technology. When the units purchased became equal to the units
consumed, the relay performed its function by switching off the electricity system. The warning
message was sent to user mobile through GSM technology before the disconnection of
electricity. Hardware model is also designed using GSM module.
CHAPTER 2

2.1 Embedded Systems:

An embedded system is a special-purpose computer system designed to perform one or a


few dedicated functions, sometimes with real-time computing constraints. It is usually embedded
as part of a complete device including hardware and mechanical parts. In contrast, a general-
purpose computer, such as a personal computer, can do many different tasks depending on
programming. Embedded systems have become very important today as they control many of the
common devices we use.

Since the embedded system is dedicated to specific tasks, design engineers can optimize
it, reducing the size and cost of the product, or increasing the reliability and performance. Some
embedded systems are mass-produced, benefiting from economies of scale.

Physically, embedded systems range from portable devices such as digital watches and
MP3 players, to large stationary installations like traffic lights, factory controllers, or the systems
controlling nuclear power plants. Complexity varies from low, with a single microcontroller
chip, to very high with multiple units, peripherals and networks mounted inside a large chassis or
enclosure.

In general, "embedded system" is not an exactly defined term, as many systems have
some element of programmability. For example, Handheld computers share some elements with
embedded systems — such as the operating systems and microprocessors which power them —
but are not truly embedded systems, because they allow different applications to be loaded and
peripherals to be connected.

An embedded system is some combination of computer hardware and software, either


fixed in capability or programmable, that is specifically designed for a particular kind of
application device. Industrial machines, automobiles, medical equipment, cameras, household
appliances, airplanes, vending machines, and toys (as well as the more obvious cellular phone
and PDA) are among the myriad possible hosts of an embedded system. Embedded systems that
are programmable are provided with a programming interface, and embedded systems
programming is a specialized occupation.
Certain operating systems or language platforms are tailored for the embedded market,
such as Embedded Java and Windows XP Embedded. However, some low-end consumer
products use very inexpensive microprocessors and limited storage, with the application and
operating system both part of a single program. The program is written permanently into the
system's memory in this case, rather than being loaded into RAM (random access memory), as
programs on a personal computer are.

2.2 Need For Embedded Systems:

The uses of embedded systems are virtually limitless, because every day new products
are introduced to the market that utilizes embedded computers in novel ways. In recent years,
hardware such as microprocessors, microcontrollers, and FPGA 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. Producing a custom-made chip to handle a particular task
or set of tasks costs far more time and money. Many embedded computers even come with
extensive libraries, so that "writing your own software" becomes a very trivial task indeed. From
an implementation viewpoint, there is a major difference between a computer and an embedded
system. Embedded systems are often required to provide Real-Time response. The main
elements that make embedded systems unique are its reliability and ease in debugging.

2.2.1 Debugging:

Embedded debugging may be performed at different levels, depending on the facilities


available. From simplest to most sophisticate they can be roughly grouped into the following
areas:
a) Interactive resident debugging, using the simple shell provided by the embedded
operating system (e.g. Forth and Basic)
b) External debugging using logging or serial port output to trace operation using either a
monitor in flash or using a debug server like the Remedy Debugger which even works for
heterogeneous multi core systems.
c) An in-circuit debugger (ICD), a hardware device that connects to the microprocessor via
a JTAG or Nexus interface. This allows the operation of the microprocessor to be
controlled externally, but is typically restricted to specific debugging capabilities in the
processor.
d) An in-circuit emulator replaces the microprocessor with a simulated equivalent,
providing full control over all aspects of the microprocessor.
e) A 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 PC.
f) Unless restricted to external 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.

Because an embedded system is often composed of a wide variety of elements, the


debugging strategy may vary. For 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 (DSP, FPGA, co-processor). An increasing number of embedded
systems today use more than one single processor core. A common problem with multi-core
development is the proper synchronization of software execution. In such a case, the embedded
system design may wish to check the data traffic on the busses between the processor cores,
which requires very low-level debugging, at signal/bus level, with a logic analyzer, for instance.

3.2.2 Reliability:

Embedded systems often reside in machines that are expected to run continuously for
years without errors and in some cases recover by them 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 disk drives, switches or buttons are avoided.
Specific reliability issues may include:
a) The system cannot safely be shut down for repair, or it is too inaccessible to repair.
Examples include space systems, undersea cables, navigational beacons, bore-hole
systems, and automobiles.
b) The system must be kept running for safety reasons. "Limp modes" are less tolerable.
Often backup s are selected by an operator. Examples include aircraft navigation, reactor
control systems, safety-critical chemical factory controls, train signals, engines on single-
engine aircraft.
c) The system will lose large amounts of money when shut down: Telephone switches,
factory controls, bridge and elevator controls, funds transfer and market making,
automated sales and service.
A variety of techniques are used, sometimes in combination, to recover from errors both
software bugs such as memory leaks, and also soft errors in the hardware:
a) Watchdog timer that resets the computer unless the software periodically notifies the
watchdog
b) Subsystems with redundant spares that can be switched over to
c) software "limp modes" that provide partial function
d) Designing with a Trusted Computing Base (TCB) architecture[6] ensures a highly secure
& reliable system environment
e) An Embedded Hypervisor 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 keeps 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.
f) Immunity Aware Programming.

3.3 Applications of embedded system:

We are living in the Embedded World. You are surrounded with many embedded
products and your daily life largely depends on the proper functioning of these gadgets.
Television, Radio, CD player of your living room, Washing Machine or Microwave Oven in
your kitchen, Card readers, Access Controllers, Palm devices of your work space enable you to
do many of your tasks very effectively. Apart from all these, many controllers embedded in your
car take care of car operations between the bumpers and most of the times you tend to ignore all
these controllers.

In recent days, you are showered with variety of information about these embedded
controllers in many places. All kinds of magazines and journals regularly dish out details about
latest technologies, new devices; fast applications which make you believe that your basic
survival is controlled by these embedded products. Now you can agree to the fact that these
embedded products have successfully invaded into our world. You must be wondering about
these embedded controllers or systems. What is this Embedded System?

The computer you use to compose your mails, or create a document or analyze the
database is known as the standard desktop computer. These desktop computers are manufactured
to serve many purposes and applications.

You need to install the relevant software to get the required processing facility. So, these
desktop computers can do many things. In contrast, embedded controllers carryout a specific
work for which they are designed. Most of the time, engineers design these embedded controllers
with a specific goal in mind. So these controllers cannot be used in any other place.

Theoretically, an embedded controller is a combination of a piece of microprocessor


based hardware and the suitable software to undertake a specific task.

These days designers have many choices in microprocessors/microcontrollers. Especially,


in 8 bit and 32 bit, the available variety really may overwhelm even an experienced designer.
Selecting a right microprocessor may turn out as a most difficult first step and it is getting
complicated as new devices continue to pop-up very often.

In the 8 bit segment, the most popular and used architecture is Intel's 8031. Market
acceptance of this particular family has driven many semiconductor manufacturers to develop
something new based on this particular architecture. Even after 25 years of existence,
semiconductor manufacturers still come out with some kind of device using this 8031 core.

3.3.1 Military and aerospace software applications:

From in-orbit embedded systems to jumbo jets to vital battlefield networks, designers of
mission-critical aerospace and defence systems requiring real-time performance, scalability, and
high-availability facilities consistently turn to the LynxOS® RTOS and the LynxOS-178 RTOS
for software certification to DO-178B.
Rich in system resources and networking services, LynxOS provides an off-the-shelf
software platform with hard real-time response backed by powerful distributed computing
(CORBA), high reliability, software certification, and long-term support options.

The LynxOS-178 RTOS for software certification, based on the RTCA DO-178B standard,
assists developers in gaining certification for their mission- and safety-critical systems. Real-time
systems programmers get a boost with Linux Works' DO-178B RTOS training courses.

3.3.2 Communications applications:

"Five-nine" availability, Compact PCI hot swap support, and hard real-time response—
Linux OS delivers on these key requirements and more for today's carrier-class systems. Scalable
kernel configurations, distributed computing capabilities, integrated communications stacks, and
fault-management facilities make Linux OS the ideal choice for companies looking for a single
operating system for all embedded telecommunications applications—from complex central
controllers to simple line/trunk cards.

Linux Works Jump start for Communications package enables OEMs to rapidly develop
mission-critical communications equipment, with pre-integrated, state-of-the-art, data
networking and porting software components—including source code for easy customization.

The Lynx Certifiable Stack (LCS) is a secure TCP/IP protocol stack designed especially for
applications where standards certification is required.

3.3.3 Electronics applications and consumer devices:

As the number of powerful embedded processors in consumer devices continues to rise, the
BlueCat® Linux® operating system provides a highly reliable and royalty-free option for
systems designers.

And as the wireless appliance revolution rolls on, web-enabled navigation systems, radios,
personal communication devices, phones and PDAs all benefit from the cost-effective
dependability, proven stability and full product life-cycle support opportunities associated with
BlueCat embedded Linux. BlueCat has teamed up with industry leaders to make it easier to build
Linux mobile phones with Java integration.

For makers of low-cost consumer electronic devices who wish to integrate the LinuxOS real-
time operating system into their products, we offer special MSRP-based pricing to reduce royalty
fees to a negligible portion of the device's MSRP.

3.3.4 Industrial automation and process control software:

Designers of industrial and process control systems know from experience that LynuxWorks
operating systems provide the security and reliability that their industrial applications require.

From ISO 9001 certification to fault-tolerance, POSIX conformance, secure partitioning and
high availability, we've got it all. Take advantage of our 20 years of experience.

3.4 Microcontroller versus microprocessor:

What is the difference between a Microprocessor and Microcontroller? By


microprocessor is meant the general purpose Microprocessors such as Intel's X86 family (8086,
80286, 80386, 80486, and the Pentium) or Motorola's 680X0 family (68000, 68010, 68020,
68030, 68040, etc). These microprocessors contain no RAM, no ROM, and no I/O ports on the
chip itself. For this reason, they are commonly referred to as general-purpose Microprocessors.

A system designer using a general-purpose microprocessor such as the Pentium or the


68040 must add RAM, ROM, I/O ports, and timers externally to make them functional. Although
the addition of external RAM, ROM, and I/O ports makes these systems bulkier and much more
expensive, they have the advantage of versatility such that the designer can decide on the amount
of RAM, ROM and I/O ports needed to fit the task at hand. This is not the case with
Microcontrollers.

A Microcontroller has a CPU (a microprocessor) in addition to a fixed amount of RAM,


ROM, I/O ports, and a timer all on a single chip. In other words, the processor, the RAM, ROM,
I/O ports and the timer are all embedded together on one chip; therefore, the designer cannot add
any external memory, I/O ports, or timer to it. The fixed amount of on-chip ROM, RAM, and
number of I/O ports in Microcontrollers makes them ideal for many applications in which cost
and space are critical. In many applications, for example a TV remote control, there is no need
for the computing power of a 486 or even an 8086 microprocessor. These applications most often
require some I/O operations to read signals and turn on and off certain bits.

3.5 Peripherals
A close-up of the SMSC LAN91C110 (SMSC 91x) chip, an embedded Ethernet chip

Embedded systems talk with the outside world via peripherals, such as:

1. Serial Communication Interfaces (SCI): RS-232, RS-422, RS-485, etc.


2. Synchronous Serial Communication Interface: I2C, SPI, SSC and ESSI (Enhanced
Synchronous Serial Interface)
3. Universal Serial Bus (USB)
4. Multi Media Cards (SD cards, Compact Flash, etc.)
5. Networks: Ethernet, LonWorks, etc.
6. Fieldbuses: CAN-Bus, LIN-Bus, PROFIBUS, etc.
7. Timers: PLL(s), Capture/Compare and Time Processing Units
8. Discrete IO: aka General Purpose Input/Output (GPIO)
9. Analog to Digital/Digital to Analog (ADC/DAC)
10. Debugging: JTAG, ISP, ICSP, BDM Port, BITP, and DB9 ports.
3.6 ARM7 LPC2148 Theory:

Over the last few years, the ARM architecture has become the most pervasive 32-
bitarchitecture in the world, with wide range of ICs available from various IC manufacturers.
ARM processors are embedded in products ranging from cell/mobile phones to automotive
braking systems. A worldwide community of ARM partners and third-party vendors has
developed among semiconductor and product design companies, including hardware engineers,
system designers, and software developers. ARM7 is one of the widely used micro-controller
family in embedded system application. This section is humble effort for explaining basic
features of ARM-7.

ARM is a family of instruction set architectures for computer processors based on a


reduced instruction set computing (RISC) architecture developed by British company ARM
Holdings. A RISC-based computer design approach means ARM processors require significantly
fewer transistors than typical processors in average computers. This approach reduces costs, heat
and power use. These are desirable traits for light, portable, battery-powered devices—including
smartphones, laptops, tablet and notepad computers), and other embedded systems. A simpler
design facilitates more efficient multi-core CPUs and higher core counts at lower cost, providing
higher processing power and improved energy efficiency for servers and supercomputers.

According to ARM Holdings, in 2010 alone, producers of chips based on ARM


architectures reported shipments of 6.1 billion ARM Based processors, representing 95% of
smartphones, 35% of digital televisions and set-top boxes and 10% of mobile computers. It is the
most widely used 32-bit instruction set architecture in terms of quantity produced.
Figure:3.6.1 ARMLPC2148 PIN OUT
Features:

a) 16/32-bit ARM7TDMI-S microcontroller in a tiny LQFP64 package.

b) 8 to 40 kB of on-chip static RAM and 32 to 512 kB of on-chip flash program

memory.

c) 128 bit wide interface/accelerator enables high speed 60 MHz operation.

d) In-System/In-Application Programming (ISP/IAP) via on-chip boot-loader software.

e) Single flash sector or full chip erase in 400 ms and programming of 256 bytes in 1

ms.

f) Embedded ICE RT and Embedded Trace interfaces offer real-time debugging with

the on-chip RealMonitor software and high speed tracing of instruction execution.

g) USB 2.0 Full Speed compliant Device Controller with 2 kB of endpoint RAM.

h) In addition, the LPC2146/8 provide 8 kB of on-chip RAM accessible to USB by

DMA.

i) One or two (LPC2141/2 vs. LPC2144/6/8) 10-bit A/D converters provide a total of

6/14 analog inputs, with conversion times as low as 2.44 s per channel.

j) Single 10-bit D/A converter provides variable analog output.

k) Two 32-bit timers/external event counters (with four capture and four compare

channels each), PWM unit (six outputs) and watchdog.

l) Low power real-time clock with independent power and dedicated 32 kHz clock

input.

m) Multiple serial interfaces including two UARTs (16C550), two Fast I2C-bus

n) (400 kbit/s), SPI and SSP with buffering and variable data length capabilities.
o) Vectored interrupt controller with configurable priorities and vector addresses.

p) Up to 45 of 5 V tolerant fast general purpose I/O pins in a tiny LQFP64 package.

q) Up to nine edge or level sensitive external interrupt pins available.

3.6.1 Internal Features:

The ARM7TDMI-S is a general purpose 32-bit microprocessor, which offers high

performance and very low power consumption. The ARM architecture is based on Reduced

Instruction Set Computer (RISC) principles, and the instruction set and related decode

mechanism are much simpler than those of microprogrammed Complex Instruction Set

Computers. This simplicity results in a high instruction throughput and impressive real-time

interrupt response from a small and cost-effective processor core.

Pipeline techniques are employed so that all parts of the processing and memory systems

can operate continuously. Typically, while one instruction is being executed, its successor is

being decoded, and a third instruction is being fetched from memory. The ARM7TDMI-S

processor also employs a unique architectural strategy known as THUMB, which makes it

ideally suited to high-volume applications with memory restrictions, or applications where code

density is an issue.

The key idea behind THUMB is that of a super-reduced instruction set. Essentially, the

ARM7TDMI-S processor has two instruction sets:

a. The standard 32-bit ARM instruction set.

b. A 16-bit THUMB instruction set.

The THUMB set’s 16-bit instruction length allows it to approach twice the density of

standard ARM code while retaining most of the ARM’s performance advantage over a

traditional 16-bit processor using 16-bit registers. This is possible because THUMB code
operates on the same 32-bit register set as ARM code. THUMB code is able to provide up to

65% of the code size of ARM, and 160% of the performance of an equivalent ARM processor

connected to a 16-bit memory system.

3.6.2 On chip Flash Memory System:

The LPC2141/2/4/6/8 incorporate a 32 kB, 64 kB, 128 kB, 256 kB, and 512 kB Flash
memory system, respectively. This memory may be used for both code and data storage.
Programming of the Flash memory may be accomplished in several ways: over the serial built-in
JTAG interface, using In System Programming (ISP) and UART0, or by means of In Application
Programming (IAP) capabilities. The application program, using the IAPfunctions, may also
erase and/or program the Flash while the application is running, allowing a great degree of
flexibility for data storage field firmware upgrades, etc. When the LPC2141/2/4/6/8 on-chip
bootloader is used, 32 kB, 64 kB, 128 kB, 256 kB, and 500 kB of Flash memory is available for
user code. The LPC2141/2/4/6/8 Flash memory provides minimum of 100,000 erase/write cycles
and 20 years of data-retention.
3.6.3 On Chip Static RAM:

On-chip Static RAM (SRAM) may be used for code and/or data storage. The on-chip
SRAM may be accessed as 8-bits, 16-bits, and 32-bits. The LPC2141/2/4/6/8 provide 8/16/32 kB
of static RAM, respectively. The LPC2141/2/4/6/8 SRAM is designed to be accessed as a byte-
addressed memory.

Word and halfword accesses to the memory ignore the alignment of the address and
access the naturally-aligned value that is addressed (so a memory access ignores address bits 0
and 1 for word accesses, and ignores bit 0 for halfword accesses). Therefore valid reads and
writes require data accessed as halfwords to originate from addresses with address line 0 being 0
(addresses ending with 0, 2, 4, 6, 8, A, C, and E in hexadecimal notation) and data accessed as
words to originate from addresses with address lines 0 and 1 being 0 (addresses ending with 0, 4,
8, and C in hexadecimal notation). This rule applies to both off and on-chip memory usage.
The SRAM controller incorporates a write-back buffer in order to prevent CPU stalls
during back-to-back writes. The write-back buffer always holds the last data sent by software to
the SRAM. This data is only written to the SRAM when another write is requested by software
(the data is only written to the SRAM when software does another write). If a chip reset occurs,
actual SRAM contents will not reflect the most recent write request (i.e. after a "warm" chip
reset, the SRAM does not reflect the last write operation).
Any software that checks SRAM contents after reset must take this into account. Two
identical writes to a location guarantee that the data will be present after a Reset. Alternatively, a
dummy write operation before entering idle or power-down mode will similarly guarantee that
the last data written will be present in SRAM after a subsequent Reset.
3.6.4 FLASH PROGRAMMING ISSSUES:

Since the Flash memory does not allow accesses during programming and erase
operations, it is necessary for the MAM to force the CPU to wait if a memory access to a Flash
address is requested while the Flash module is busy. (This is accomplished by asserting the
ARM7TDMI-S local bus signal CLKEN.) Under some conditions, this delay could result in a
Watchdog time-out. The user will need to be aware of this possibility and take steps to insure
that an unwanted Watchdog reset does not cause a system failure while programming or erasing
the Flash memory.
In order to preclude the possibility of stale data being read from the Flash memory, the
LPC2141/2/4/6/8 MAM holding latches are automatically invalidated at the beginning of any
Flash programming or erase operation. Any subsequent read from a Flash address will cause a
new fetch to be initiated after the Flash operation has completed.
3.6.5 CONTROL FUNCTIONS:

The System Control Block includes several system features and control registers for a
number of functions that are not related to specific peripheral devices. These include:
a) Crystal Oscillator
b) External Interrupt Inputs
c) Miscellaneous System Controls and Status
d) Memory Mapping Control
e) PLL
f) Power Control
g) Reset
h) APB Divider
i) Wakeup Timer
Each type of function has its own register(s) if any are required and unneeded bits are
defined as reserved in order to allow future expansion. Unrelated functions never share the same
register addresses.
CHAPTER 3

BLOCK DIAGRAM AND ITS EXPLANATION

Theft detection based GSM prepaid electricity system

PSU LCD

8051Micro
controller Current
Meter
Current
Sensor
Load
CHAPTER 4
COMPONENTS DESCRIPTION
The components required for the project are:

 Power supply
 8051 micro controller
 LCD
 GSM module

POWER SUPPLY:
I. Power Supply:

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.

Figure: Transformer Symbol


(or)

Transformer is a device that converts the one form energy to another form of energy like
a transducer.

Figure: Transformer

Basic Principle:

A transformer makes use of Faraday's law and the ferromagnetic properties of an iron
core to efficiently raise or lower AC voltages. It of course cannot increase power so that if the
voltage is raised, the current is proportionally lowered and vice versa.
Figure: Basic Principle

Transformer Working:

A transformer consists of two coils (often called 'windings') linked by an iron core, as
shown in figure below. There is no electrical connection between the coils, instead they are
linked by a magnetic field created in the core.
Figure: Basic Transformer

Transformers are used to convert electricity from one voltage to another with minimal
loss of power. They only work with AC (alternating current) because they require a changing
magnetic field to be created in their core. Transformers can increase voltage (step-up) as well as
reduce voltage (step-down).

Alternating current flowing in the primary (input) coil creates a continually changing
magnetic field in the iron core. This field also passes through the secondary (output) coil and the
changing strength of the magnetic field induces an alternating voltage in the secondary coil. If
the secondary coil is connected to a load the induced voltage will make an induced current flow.
The correct term for the induced voltage is 'induced electromotive force' which is usually
abbreviated to induced e.m.f.

The iron core is laminated to prevent 'eddy currents' flowing in the core. These are
currents produced by the alternating magnetic field inducing a small voltage in the core, just like
that induced in the secondary coil. Eddy currents waste power by needlessly heating up the core
but they are reduced to a negligible amount by laminating the iron because this increases the
electrical resistance of the core without affecting its magnetic properties.

Transformers have two great advantages over other methods of changing voltage:

1. They provide total electrical isolation between the input and output, so they can be safely
used to reduce the high voltage of the mains supply.
2. Almost no power is wasted in a transformer. They have a high efficiency (power out /
power in) of 95% or more.

Classification of Transformer:

 Step-Up Transformer
 Step-Down Transformer

Step-Down Transformer:
Step down transformers are designed to reduce electrical voltage. Their primary voltage
is greater than their secondary voltage. This kind of transformer "steps down" the voltage applied
to it. For instance, a step down transformer is needed to use a 110v product in a country with a
220v supply.

Step down transformers convert electrical voltage from one level or phase configuration
usually down to a lower level. They can include features for electrical isolation, power
distribution, and control and instrumentation applications. Step down transformers typically rely
on the principle of magnetic induction between coils to convert voltage and/or current levels.

Step down transformers are made from two or more coils of insulated wire wound around
a core made of iron. When voltage is applied to one coil (frequently called the primary or input)
it magnetizes the iron core, which induces a voltage in the other coil, (frequently called the
secondary or output). The turn’s ratio of the two sets of windings determines the amount of
voltage transformation.

Figure: Step-Down Transformer

An example of this would be: 100 turns on the primary and 50 turns on the secondary, a
ratio of 2 to 1.

Step down transformers can be considered nothing more than a voltage ratio device.
With step down transformers the voltage ratio between primary and secondary will mirror
the "turn’s ratio" (except for single phase smaller than 1 kva which have compensated
secondary). A practical application of this 2 to 1 turn’s ratio would be a 480 to 240 voltage step
down. Note that if the input were 440 volts then the output would be 220 volts. The ratio
between input and output voltage will stay constant. Transformers should not be operated at
voltages higher than the nameplate rating, but may be operated at lower voltages than rated.

Because of this it is possible to do some non-standard applications using standard


transformers.

Single-phase step-down transformers 1 kva and larger may also be reverse connected to
step-down or step-up voltages. (Note: single phase step up or step down transformers sized less
than 1 KVA should not be reverse connected because the secondary windings have additional
turns to overcome a voltage drop when the load is applied. If reverse connected, the output
voltage will be less than desired.)

Step-Up Transformer:

A step-up transformer has more turns of wire on the secondary coil, which makes a larger
induced voltage in the secondary coil. It is called a step-up transformer because the voltage
output is larger than the voltage input.

Step-up transformer 110v 220v design is one whose secondary voltage is greater than its
primary voltage. This kind of transformer "steps up" the voltage applied to it. For instance, a step
up transformer is needed to use a 220v product in a country with a 110v supply.

A step up transformer 110v 220v converts alternating current (AC) from one voltage to
another voltage. It has no moving parts and works on a magnetic induction principle; it can be
designed to "step-up" or "step-down" voltage. So a step up transformer increases the voltage and
a step down transformer decreases the voltage.
The primary components for voltage transformation are the step up transformer core and
coil. The insulation is placed between the turns of wire to prevent shorting to one another or to
ground.

This is typically comprised of Mylar, nomex, Kraft paper, varnish, or other materials. As
a transformer has no moving parts, it will typically have a life expectancy between 20 and 25
years.

Figure: Step-Up Transformer

Applications

Generally, these Step-Up Transformers are used in industries applications only.

Turns Ratio and Voltage

The ratio of the number of turns on the primary and secondary coils determines the ratio of the
voltages...

...where Vp is the primary (input) voltage, Vs is the secondary (output) voltage, Np is the number
of turns on the primary coil, and Ns is the number of turns on the secondary coil.
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.

Figure: Diode Symbol

A diode is a device which only allows current to flow through it in one direction. In this
direction, the diode is said to be 'forward-biased' and the only effect on the signal is that there
will be a voltage loss of around 0.7V. In the opposite direction, the diode is said to be 'reverse-
biased' and no current will flow through it.

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.
Figure: Half Wave Rectifier

Figure 2 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.

While the output of the half-wave rectifier is DC (it is all positive), it would not be
suitable as a power supply for a circuit. Firstly, the output voltage continually varies between 0V
and Vs-0.7V, and secondly, for half the time there is no output at all.
The Full-wave Rectifier

The circuit in figure 3 addresses the second of these problems since at no time is the
output voltage 0V. This time four diodes are arranged so that both the positive and negative
parts of the AC waveform are converted to DC. The resulting waveform is shown in figure 4.

Figure: Full-Wave Rectifier


Figure: Full-Wave Rectification

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.

Capacitor Filter

The capacitor-input filter, also called "Pi" filter due to its shape that looks like the
Greek letter pi, is a type of electronic filter. Filter circuits are used to remove unwanted or
undesired frequencies from a signal.

Figure: Capacitor Filter

A typical capacitor input filter consists of a filter capacitor C1, connected across the
rectifier output, an inductor L, in series and another filter capacitor connected across the load.

1. The capacitor C1 offers low reactance to the AC component of the rectifier output while
it offers infinite reactance to the DC component. As a result the capacitor shunts an
appreciable amount of the AC component while the DC component continues its journey
to the inductor L
2. The inductor L offers high reactance to the AC component but it offers almost zero
reactance to the DC component. As a result the DC component flows through the
inductor while the AC component is blocked.
3. The capacitor C2 bypasses the AC component which the inductor had failed to block. As
a result only the DC component appears across the load RL.

Figure: Centered Tapped Full-Wave Rectifier with a Capacitor Filter

Voltage Regulator:

A voltage regulator is an electrical regulator designed to automatically maintain a


constant voltage level. It may use an electromechanical mechanism, or passive or active
electronic components. Depending on the design, it may be used to regulate one or more AC or
DC voltages. There are two types of regulator are they.

 Positive Voltage Series (78xx) and


 Negative Voltage Series (79xx)

78xx:’78’ indicate the positive series and ‘xx’indicates the voltage rating. Suppose 7805
produces the maximum 5V.’05’indicates the regulator output is 5V.

79xx:’78’ indicate the negative series and ‘xx’indicates the voltage rating. Suppose 7905
produces the maximum -5V.’05’indicates the regulator output is -5V.

These regulators consists the three pins there are

Pin1: It is used for input pin.

Pin2: This is ground pin for regulator


Pin3: It is used for output pin. Through this pin we get the output.

Figure: Regulator

RELAYS :
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.
Basics On Relay Handling
 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
 type of load and operating conditions before use.
 Do not exceed the usable ambient temperature values listed in the catalog.
 Use the flux-resistant type or sealed type if automatic soldering is to be used.
 Use alcohol-based cleaning solvents when cleaning is to be performed using a
sealed type relay.
 Avoid ultrasonic cleaning of all types of relays.
 Avoid bending terminals, because it may cause malfunction.
 As a guide, use a Faston 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.

Figure: Relay
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 shown in figure . 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 light-emitting
diode to trigger it.

Pole and throw

Since relays are switches the terminology applied to switches is also applied to relays. A
relay will switch one or more poles, each of whose contacts can be thrown by energizing the coil
in one of three ways:

 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 a "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.
Figure: SPST Relay

SPDT Relay

SPDT Relay stands for Single Pole Double Throw relay. Current will flow between the
movable contact and one fixed contact when the coil is De-energized and between the movable
contact and the alternate fixed contact when the relay coil is energized. The most commonly used
relay in car audio, the Bosch relay, is a SPDT relay.

Figure: SPDT Relay

DPST Relay

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.
Figure: DPST Relay

DPDT Relay

DPDT relay stands for Double Pole Double Throw relay. It operates like the SPDT relay
but has twice as many contacts. There are two completely isolated sets of contacts.

Figure: DPDT Relay

This is a 4 Pole Double Throw relay. It operates like the SPDT relay but it has 4 sets of
isolated contacts.

Types of relay:

1. Latching Relay
2. Reed Relay
3. Mercury Wetted Relay
4. Machine Tool Relay
5. Solid State Relay (SSR)
Figure: 4 Pole Double Throw relay

Latching relay
Latching relay, dust cover removed, showing pawl and ratchet mechanism. The ratchet
operates a cam, which raises and lowers the moving contact arm, seen edge-on just below it. The
moving and fixed contacts are visible at the left side of the image.

A latching relay has two relaxed states (bi-stable). These are also called "impulse",
"keep", or "stay" relays. When the current is switched off, the relay remains in its last state. This
is achieved with a solenoid operating a ratchet and cam mechanism, or by having two opposing
coils with an over-centre spring or permanent magnet to hold the armature and contacts in
position while the coil is relaxed, or with a remanent core.

In the ratchet and cam example, the first pulse to the coil turns the relay on and the
second pulse turns it off. In the two-coil example, a pulse to one coil turns the relay on and a
pulse to the opposite coil turns the relay off. This type of relay has the advantage that it
consumes power only for an instant, while it is being switched, and it retains its last setting
across a power outage. A remanent core latching relay requires a current pulse of opposite
polarity to make it change state.
Figure: Latching relay

Reed relay

A reed relay has a set of contacts inside a vacuum or inert gas filled glass tube, which
protects the contacts against atmospheric corrosion. The contacts are closed by a magnetic field
generated when current passes through a coil around the glass tube. Reed relays are capable of
faster switching speeds than larger types of relays but have low switch current and voltage
ratings.

Mercury-wetted reed relay

A mercury-wetted reed relay is a form of reed relay in which the contacts are wetted with
mercury. Such relays are used to switch low-voltage signals (one volt or less) because of their
low contact resistance, or for high-speed counting and timing applications where the mercury
eliminates contact bounce. Mercury wetted relays are position-sensitive and must be mounted
vertically to work properly. Because of the toxicity and expense of liquid mercury, these relays
are rarely specified for new equipment.

Machine tool relay

A machine tool relay is a type standardized for industrial control of machine tools,
transfer machines, and other sequential control. They are characterized by a large number of
contacts (sometimes extendable in the field) which are easily converted from normally-open to
normally-closed status, easily replaceable coils, and a form factor that allows compactly
installing many relays in a control panel. Although such relays once were the backbone of
automation in such industries as automobile assembly, the programmable logic controller (PLC)
mostly displaced the machine tool relay from sequential control applications.

Solid-state relay
A solid state relay (SSR) is a solid state electronic component that provides a similar
function to an electromechanical relay but does not have any moving components, increasing
long-term reliability. With early SSR's, the trade-off came from the fact that every transistor has
a small voltage drop across it. This voltage drop limited the amount of current a given SSR could
handle. As transistors improved, higher current SSR's, able to handle 100 to 1,200 Amperes,
have become commercially available. Compared to electromagnetic relays, they may be falsely
triggered by transients.

Figure: Solid relay, which has no moving parts

Specification

 Number and type of contacts – normally open, normally closed, (double-throw)


 Contact sequence – "Make before Break" or "Break before Make". For example, the old
style telephone exchanges required Make-before-break so that the connection didn't get
dropped while dialling the number.
 Rating of contacts – small relays switch a few amperes, large contactors are rated for up
to 3000 amperes, alternating or direct current
 Voltage rating of contacts – typical control relays rated 300 VAC or 600 VAC,
automotive types to 50 VDC, special high-voltage relays to about 15 000 V
 Coil voltage – machine-tool relays usually 24 VAC, 120 or 250 VAC, relays for
switchgear may have 125 V or 250 VDC coils, "sensitive" relays operate on a few milli-
amperes

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.

LCD: (16x2 alphanumeric LCD)

Description
Liquid crystal display is very important device in embedded system. It offers high
flexibility to user as he can display the required data on it. A liquid crystal display (LCD) is a
thin, flat electronic visual display that uses the light modulating properties of liquid
crystals (LCs). LCs do not emit light directly. LCDs therefore need a light source and are
classified as "passive" displays. Here the lcd has different memories to display data, those are
discussed below.

Block Diagram :

Display Data RAM

Display data RAM (DDRAM) stores display data represented in 8-bit character codes. Its
extended capacity is 80 X 8 bits, or 80 characters. The area in display data RAM (DDRAM) that
is not used for display can be used as general data RAM. So whatever you send on the DDRAM
is actually displayed on the LCD. For LCDs like 1x16, only 16 characters are visible, so
whatever you write after 16 chars is written in DDRAM but is not visible to the user.
Figure below will show you the DDRAM addresses of 2 Line LCD.

Character Generator ROM:

Now you might be thinking that when you send an ascii value to DDRAM, how the
character is displayed on LCD? so the answer is CGROM. The character generator ROM
generates 5 x 8 dot or 5 x 10 dot character patterns from 8-bit character codes. It can generate
208 5 x 8 dot character patterns and 32 5 x 10 dot character patterns. User-defined character
patterns are also available by mask-programmed ROM.

BusyFlag
Busy Flag is an status indicator flag for LCD. When we send a command or data to the
LCD for processing, this flag is set (i.e., BF =1) and as soon as the instruction is executed
successfully this flag is cleared (BF = 0). This is helpful in producing and exact amount of
delayfortheLCDprocessing.
To read Busy Flag, the condition RS = 0 and R/W = 1 must be met and The MSB of the
LCD data bus (D7) act as busy flag. When BF = 1 means LCD is busy and will not accept next
command or data and BF = 0 means LCD is ready for the next command or data to process.

Instruction Register (IR) and Data Register (DR)

There are two 8-bit registers in HD44780 controller Instruction and Data register.
Instruction register corresponds to the register where you send commands to LCD e.g LCD shift
command, LCD clear, LCD address etc. and Data register is used for storing data which is to be
displayed on LCD. When send the enable signal of the LCD is asserted, the data on the pins is
latched in to the data register and data is then moved automatically to the DDRAM and hence is
displayed on the LCD.
Data Register is not only used for sending data to DDRAM but also for CGRAM, the
address where you want to send the data, is decided by the instruction you send to LCD.

16 x 2 Alphanumeric LCD Module Features

 Intelligent, with built-in Hitachi HD44780 compatible LCD controller and RAM
providing simple interfacing
 61 x 15.8 mm viewing area
 5 x 7 dot matrix format for 2.96 x 5.56 mm characters, plus cursor line
 Can display 224 different symbols
 Low power consumption (1 mA typical)
 Powerful command set and user-produced characters
 TTL and CMOS compatible
 Connector for standard 0.1-pitch pin headers

Schematic

Specifications
Circuit Description

Above is the quite simple schematic. The LCD panel's Enable and Register Select is
connected to the Control Port. The Control Port is an open collector / open drain output. While
most Parallel Ports have internal pull-up resistors, there are a few which don't. Therefore, by
incorporating the two 10K external pull up resistors, the circuit is more portable for a wider
range of computers, some of which may have no internal pull up resistors.
We make no effort to place the Data bus into reverse direction. Therefore, we hard wire
the R/W line of the LCD panel, into write mode. This will cause no bus conflicts on the data
lines. As a result, we cannot read back the LCD's internal Busy Flag which tells us if the LCD
has accepted and finished processing the last instruction. This problem is overcome by inserting
known delays into our program.

Potentiometer controls the contrast of the LCD panel. You can use a bench power supply
set to 5v or use a onboard +5 regulator. Remember a few de-coupling capacitors, especially if
you have trouble with the circuit working properly. The 2 line x 16 character LCD modules are
available from a wide range of manufacturers and should all be compatible with the HD44780.

GSM:

Definition of GSM:

GSM (Global System for Mobile communications) is an open, digital cellular technology
used for transmitting mobile voice and data services.

GSM (Global System for Mobile communication) is a digital mobile telephone system
that is widely used in Europe and other parts of the world. GSM uses a variation of Time
Division Multiple Access (TDMA) and is the most widely used of the three digital wireless
telephone technologies (TDMA, GSM, and CDMA). GSM digitizes and compresses data, then
sends it down a channel with two other streams of user data, each in its own time slot. It operates
at either the 900 MHz or 1,800 MHz frequency band. It supports voice calls and data transfer
speeds of up to 9.6 kbit/s, together with the transmission of SMS (Short Message Service).

GSM Frequencies
GSM networks operate in a number of different frequency ranges (separated into GSM
frequency ranges for 2G and UMTS frequency bands for 3G). Most 2G GSM networks operate
in the 900 MHz or 1800 MHz bands. Some countries in the Americas (including Canada and the
United States) use the 850 MHz and 1900 MHz bands because the 900 and 1800 MHz frequency
bands were already allocated. Most 3G GSM networks in Europe operate in the 2100 MHz
frequency band. The rarer 400 and 450 MHz frequency bands are assigned in some countries
where these frequencies were previously used for first-generation systems.
GSM-900 uses 890–915 MHz to send information from the mobile station to the base
station (uplink) and 935–960 MHz for the other direction (downlink), providing 124 RF channels
(channel numbers 1 to 124) spaced at 200 kHz. Duplex spacing of 45 MHz is used. In some
countries the GSM-900 band has been extended to cover a larger frequency range. This 'extended
GSM', E-GSM, uses 880–915 MHz (uplink) and 925–960 MHz (downlink), adding 50 channels
(channel numbers 975 to 1023 and 0) to the original GSM-900 band.
Time division multiplexing is used to allow eight full-rate or sixteen half-rate speech
channels per radio frequency channel. There are eight radio timeslots (giving eight burst periods)
grouped into what is called a TDMA frame. Half rate channels use alternate frames in the same
timeslot. The channel data rate for all 8 channels is 270.833 Kbit/s, and the frame duration is
4.615 ms.
The transmission power in the handset is limited to a maximum of 2 watts in
GSM850/900 and 1 watt in GSM1800/1900. GSM operates in the 900MHz and 1.8GHz bands in
Europe and the 1.9GHz and 850MHz bands in the US. The 850MHz band is also used for GSM
and 3G in Australia, Canada and many South American countries. By having harmonized
spectrum across most of the globe, GSM’s international roaming capability allows users to
access the same services when travelling abroad as at home. This gives consumers seamless and
same number connectivity in more than 218 countries.
Terrestrial GSM networks now cover more than 80% of the world’s population. GSM
satellite roaming has also extended service access to areas where terrestrial coverage is not
available.
Mobile Telephony Standards
Introduction to Modem:

Modem stands for modulator-demodulator.

A modem is a device or program that enables a computer to transmit data over telephone
or cable lines. Computer information is stored digitally, whereas information transmitted over
telephone lines is transmitted in the form of analog waves. A modem converts between these two
forms.

GSM Modem:
A GSM modem is a wireless modem that works with a GSM wireless network. A
wireless modem behaves like a dial-up modem. The main difference between them is that a dial-
up modem sends and receives data through a fixed telephone line while a wireless modem sends
and receives data through radio waves.
A GSM modem can be an external device or a PC Card / PCMCIA Card. Typically, an
external GSM modem is connected to a computer through a serial cable or a USB cable. A GSM
modem in the form of a PC Card / PCMCIA Card is designed for use with a laptop computer. It
should be inserted into one of the PC Card / PCMCIA Card slots of a laptop computer. Like a
GSM mobile phone, a GSM modem requires a SIM card from a wireless carrier in order to
operate.
A SIM card contains the following information:

 Subscriber telephone number (MSISDN)

 International subscriber number (IMSI, International Mobile Subscriber Identity)

 State of the SIM card

 Service code (operator)

 Authentication key

 PIN (Personal Identification Code)

 PUK (Personal Unlock Code)

Computers use AT commands to control modems. Both GSM modems and dial-up modems
support a common set of standard AT commands. In addition to the standard AT commands,
GSM modems support an extended set of AT commands. These extended AT commands are
defined in the GSM standards. With the extended AT commands, the following operations can
be performed:
 Reading, writing and deleting SMS messages.
 Sending SMS messages.
 Monitoring the signal strength.
 Monitoring the charging status and charge level of the battery.
 Reading, writing and searching phone book entries.

The number of SMS messages that can be processed by a GSM modem per minute is very low
i.e., about 6 to 10 SMS messages per minute.

Introduction to AT Commands
AT commands are instructions used to control a modem. AT is the abbreviation of
ATtention. Every command line starts with "AT" or "at". That's the reason, modem commands
are called AT commands. Many of the commands that are used to control wired dial-up modems,
such as ATD (Dial), ATA (Answer), ATH (Hook control) and ATO (Return to online data state)
are also supported by GSM modems and mobile phones.

Besides this common AT command set, GSM modems and mobile phones support an AT
command set that is specific to the GSM technology, which includes SMS-related commands
like AT+CMGS (Send SMS message), AT+CMSS (Send SMS message from storage),
AT+CMGL (List SMS messages) and AT+CMGR (Read SMS messages).
It should be noted that the starting "AT" is the prefix that informs the modem about the
start of a command line. It is not part of the AT command name. For example, D is the actual AT
command name in ATD and +CMGS is the actual AT command name in AT+CMGS.
Some of the tasks that can be done using AT commands with a GSM modem or mobile phone
are listed below:
 Get basic information about the mobile phone or GSM modem. For example, name of
manufacturer (AT+CGMI), model number (AT+CGMM), IMEI number (International
Mobile Equipment Identity) (AT+CGSN) and software version (AT+CGMR).
 Get basic information about the subscriber. For example, MSISDN (AT+CNUM) and
IMSI number (International Mobile Subscriber Identity) (AT+CIMI).
 Get the current status of the mobile phone or GSM/GPRS modem. For example, mobile
phone activity status (AT+CPAS), mobile network registration status (AT+CREG), radio
signal strength (AT+CSQ), battery charge level and battery charging status (AT+CBC).
 Establish a data connection or voice connection to a remote modem (ATD, ATA, etc).
 Send and receive fax (ATD, ATA, AT+F*).
 Send (AT+CMGS, AT+CMSS), read (AT+CMGR, AT+CMGL), write (AT+CMGW) or
delete (AT+CMGD) SMS messages and obtain notifications of newly received SMS
messages (AT+CNMI).
 Read (AT+CPBR), write (AT+CPBW) or search (AT+CPBF) phonebook entries.
 Perform security-related tasks, such as opening or closing facility locks (AT+CLCK),
checking whether a facility is locked (AT+CLCK) and changing passwords(AT+CPWD).
(Facility lock examples: SIM lock [a password must be given to the SIM card every time
the mobile phone is switched on] and PH-SIM lock [a certain SIM card is associated with
the mobile phone. To use other SIM cards with the mobile phone, a password must be
entered.])
 Control the presentation of result codes / error messages of AT commands. For example,
the user can control whether to enable certain error messages (AT+CMEE) and whether
error messages should be displayed in numeric format or verbose format (AT+CMEE=1
or AT+CMEE=2).
 Get or change the configurations of the mobile phone or GSM/GPRS modem. For
example, change the GSM network (AT+COPS), bearer service type (AT+CBST), radio
link protocol parameters (AT+CRLP), SMS center address (AT+CSCA) and storage of
SMS messages (AT+CPMS).
 Save and restore configurations of the mobile phone or GSM/GPRS modem. For
example, save (AT+CSAS) and restore (AT+CRES) settings related to SMS messaging
such as the SMS center address.

It should be noted that the mobile phone manufacturers usually do not implement all AT
commands, command parameters and parameter values in their mobile phones. Also, the
behavior of the implemented AT commands may be different from that defined in the standard.
In general, GSM modems, designed for wireless applications, have better support of AT
commands than ordinary mobile phones.
Basic concepts of SMS technology

1. Validity Period of an SMS Message

An SMS message is stored temporarily in the SMS center if the recipient mobile phone is
offline. It is possible to specify the period after which the SMS message will be deleted from the
SMS center so that the SMS message will not be forwarded to the recipient mobile phone when
it becomes online. This period is called the validity period. A mobile phone should have a menu
option that can be used to set the validity period. After setting it, the mobile phone will include
the validity period in the outbound SMS messages automatically.

2. Message Status Reports


Sometimes the user may want to know whether an SMS message has reached the
recipient mobile phone successfully. To get this information, you need to set a flag in the SMS
message to notify the SMS center that a status report is required about the delivery of this SMS
message. The status report is sent to the user mobile in the form of an SMS message.
A mobile phone should have a menu option that can be used to set whether the status
report feature is on or off. After setting it, the mobile phone will set the corresponding flag in the
outbound SMS messages for you automatically. The status report feature is turned off by default
on most mobile phones and GSM modems.

3. Message Submission Reports

After leaving the mobile phone, an SMS message goes to the SMS center. When it
reaches the SMS center, the SMS center will send back a message submission report to the
mobile phone to inform whether there are any errors or failures (e.g. incorrect SMS message
format, busy SMS center, etc). If there is no error or failure, the SMS center sends back a
positive submission report to the mobile phone. Otherwise it sends back a negative submission
report to the mobile phone. The mobile phone may then notify the user that the message
submission was failed and what caused the failure.
If the mobile phone does not receive the message submission report after a period of
time, it concludes that the message submission report has been lost. The mobile phone may then
send the SMS message again to the SMS center. A flag will be set in the new SMS message to
inform the SMS center that this SMS message has been sent before. If the previous message
submission was successful, the SMS center will ignore the new SMS message but send back a
message submission report to the mobile phone. This mechanism prevents the sending of the
same SMS message to the recipient multiple times.
Sometimes the message submission report mechanism is not used and the
acknowledgement of message submission is done in a lower layer.

4 .Message Delivery Reports

After receiving an SMS message, the recipient mobile phone will send back a message
delivery report to the SMS center to inform whether there are any errors or failures (example
causes: unsupported SMS message format, not enough storage space, etc). This process is
transparent to the mobile user. If there is no error or failure, the recipient mobile phone sends
back a positive delivery report to the SMS center. Otherwise it sends back a negative delivery
report to the SMS center.
If the sender requested a status report earlier, the SMS center sends a status report to the
sender when it receives the message delivery report from the recipient. If the SMS center does
not receive the message delivery report after a period of time, it concludes that the message
delivery report has been lost. The SMS center then ends the SMS message to the recipient for the
second time.
Sometimes the message delivery report mechanism is not used and the acknowledgement
of message delivery is done in a lower layer.

8051 MICROCONTROLLER:

PIN CONFIGURATION:

It comes in different packages like DIP (dual in line package), QFP (quad flat package)
and LLC (lead less chip carrier). It is 40 pin microcontrollers. Pin configuration of 8051
microcontroller is shown below:
VCC: It provides supply voltage to chip. The operating voltage is 5 volt.

GND: It connects with ground of voltage supply.

XTAL1 AND XTAL2 PIN: Although 8051 have on chip crystal oscillator. But still it requires an
external clock oscillator. External crystal oscillator is connected to XTAL1 and XTAL2 pins. It
also requires two capacitors of 30pF as shown in figure below. Capacitors one terminal is
connected with crystal oscillator and other terminal with ground. Processing speed of 8051
microcontroller depends on crystal oscillator frequency. But each microcontroller have
maximum limit of operating frequency. We cannot connect crystal oscillator more than
maximum operating limit frequency.

RST PIN NUMBER 9: is a reset pin. It is active high pin. It is used to reset. If we apply
active high signal to this pin, 8051 microcontroller will reset and turn off all its functions. It will
erase all values of registers and it will make all program counter values to zero. Figure below
shows the power on reset circuitry. Rest input will be effective only, if we apply high pulse for
more than two machines cycles. Otherwise it will not rest.

EA PIN NUMBER 33: is used to store program. All family of 8051 microcontrollers comes
with on chip ROM to store programs. For such purpose EA pin is connected with Vcc. EA
stands for external access.
PSEN Pin number 29: is an output pin. It is stands for “Program store enable”. It is also
used for programming.

BLOCK DIAGRAM OF 8051 MICROCONTROLLER:


TIMERS IN 8051 MICROCONTROLLER:

8051 microcontroller have tw0 timers. Timer is kind of counter which increment its value
by one every time an instruction is executed. Time of increment depends on frequency of crystal
oscillator. I will post a separate article on how to use timers of 8051.

TIMER T0:
As seen in figure below, the timer T0 consists of two registers – TH0 and TL0
representing a low and a high byte of one 16-digit binary number.
Accordingly, if the content of the timer T0 is equal to 0 (T0=0) then both registers it consists of
will contain 0. If the timer contains for example number 1000 (decimal), then the TH0 register
(high byte) will contain the number 3, while the TL0 register (low byte) will contain decimal
number 232.

TMOD REGISTER (TIMER MODE):


The TMOD register selects the operational mode of the timers T0 and T1. As seen in
figure below, the low 4 bits (bit0 - bit3) refer to the timer 0, while the high 4 bits (bit4 - bit7)
refer to the timer 1. There are 4 operational modes and each of them is described herein.

T1M1 T1M0 MODE DESCRIPTION

0 0 0 13-bit timer

0 1 1 16-bit timer

1 0 2 8-bit auto-reload

1 1 3 Split mode

Timer Control (TCON) Register

TCON register is also one of the registers whose bits are directly in control of timer operation.
Only 4 bits of this register are used for this purpose, while rest of them is used for interrupt
control to be discussed later.
UART (Universal Asynchronous Receiver and Transmitter):
One of the microcontroller features making it so powerful is an integrated UART, better
known as a serial port. It is a full-duplex port, thus being able to transmit and receive data
simultaneously and at different baud rates. Without it, serial data send and receive would be an
enormously complicated part of the program in which the pin state is constantly changed and
checked at regular intervals. When using UART, all the programmer has to do is to simply select
serial port mode and baud rate. When it's done, serial data transmit is nothing but writing to the
SBUF register, while data receive represents reading the same register. The microcontroller takes
care of not making any error during data transmission.

SERIAL PORT CONTROL (SCON) REGISTER:

 SM0 - Serial port mode bit 0 is used for serial port mode selection.
 SM1 - Serial port mode bit 1.
 SM2 - Serial port mode 2 bit, also known as multiprocessor communication enable bit.
When set, it enables multiprocessor communication in mode 2 and 3, and eventually
mode 1. It should be cleared in mode 0.
 REN - Reception Enable bit enables serial reception when set. When cleared, serial
reception is disabled.
 TB8 - Transmitter bit 8. Since all registers are 8-bit wide, this bit solves the problem of
transmitting the 9th bit in modes 2 and 3. It is set to transmit logic 1 in the 9th bit.
 RB8 - Receiver bit 8 or the 9th bit received in modes 2 and 3. Cleared by hardware if 9th
bit received is logic 0. Set by hardware if 9th bit received is logic 1.
 TI - Transmit Interrupt flag is automatically set at the moment the last bit of one byte is
sent. It's a signal to the processor that the line is available for a new byte transmits. It
must be cleared from within the software.
 RI - Receive Interrupt flag is automatically set upon one byte receive. It signals that byte
is received and should be read quickly prior to being replaced by a new data. This bit is
also cleared from within the software.

BAUD RATE:

Baud Rate is a number of sent/received bits per second. In case the UART is used, baud
rate depends on: selected mode, oscillator frequency and in some cases on the state of the SMOD
bit of the SCON register.

8051 MICROCONTROLLER POWER CONSUMPTION CONTROL:

Generally speaking, the microcontroller is inactive for the most part and just waits for
some external signal in order to takes its role in a show. This can cause some problems in case
batteries are used for power supply. In extreme cases, the only solution is to set the whole
electronics in sleep mode in order to minimize consumption. A typical example is a TV remote
controller: it can be out of use for months but when used again it takes less than a second to send
a command to TV receiver. The AT89S53 uses approximately 25mA for regular operation,
which doesn't make it a power-saving microcontroller. Anyway, it doesn’t have to be always like
that, it can easily switch the operating mode in order to reduce its total consumption to
approximately 40uA. Actually, there are two power-saving modes of operation: Idle and Power
Down.

TYPES OF INTERRUPTS IN 8051 MICROCONTROLLER:

The 8051 microcontroller can recognize five different events that cause the main program to
interrupt from the normal execution. These five sources of interrupts in 8051are:

1. Timer 0 overflow interrupt- TF0


2. Timer 1 overflow interrupt- TF1
3. External hardware interrupt- INT0
4. External hardware interrupt- INT1
5. Serial communication interrupt- RI/TI

The Timer and Serial interrupts are internally generated by the microcontroller, whereas the
external interrupts are generated by additional interfacing devices or switches that are externally
connected to the microcontroller. These external interrupts can be edge triggered or level
triggered. When an interrupt occurs, the microcontroller executes the interrupt service routine so
that memory location corresponds to the interrupt that enables it.
CHAPTER 5
SOFTWARE EXPLANATION

KEIL µ VISION IDE:

The µVision IDE combines project management, run-time environment, build facilities,
source code editing, and program debugging in a single powerful environment. µVision is easy-
to-use and accelerates your embedded software development. µVision supports multiple screens
and allows you to create individual window layouts anywhere on the visual surface.

The µVision Debugger provides a single environment in which you may test, verify, and
optimize your application code. The debugger includes traditional features like simple and
complex breakpoints, watches windows, and execution control and provides full visibility to
device peripherals.

The Project window shows application source files and selected software components.
Below the components you will find corresponding library and configuration files.
Projects support multiple targets. They ease configuration management and may be used to
generate debug and release builds or adoptions for different hardware platforms.

The Manage Run-Time Environment window shows all software components that are
compatible with the selected device. Inter-dependencies of software components are clearly
identified with validation messages. The Configuration Wizard is an integrated editor utility for
generating GUI-like configuration controls in assembler, C/C++, or initialization files.
The Functions window gives fast access to the functions in each C/C++ source code
module. The Code Completion list and Function Parameter information helps you to keep
track of symbols, functions, and parameters.

Dynamic Syntax Checking validates the program syntax while you are typing and provides
real-time alerts to potential code violations before compilation.
CHAPTER 6
WORKING

For every energy meter, there will be a seal which is made by the electricity board for not
opening that energy meter. There might be a chance of opening the energy meter and doing
illegal activities to decrease their unit readings. In such cases an IR sensor is connected to the
energy meter to detect that seal tempering. IR sensor is used to detect the distance between any
two objects. By placing an IR sensor between the opening doors of energy meter, it will find
distance between the doors and sends a signal to the pic microcontroller if the distance is
increased, which is an indication of opening the energy meter. Then the pic microcontroller
knows that there is tempering in energy meter and sends a command to GSM module to send an
SMS to registered mobile no. in the controller We can control the load, when we find about
tempering of energy meter or when using high power consumption machines that are not
allowed in house hold single phase energy meter. By sending a SMS to a particular GSM
modem number, we can control that load. Here, we coded in this pic microcontroller as „*A‟ to
cut the power for any particular house. So, by sending an SMS as *A the load gets OFF,
CHAPTER 7
CONCLUSION

The project Prepaid electricity meter with theft detection has been implemented
successfully and has applications in households especially in rural areas. This system can be
adopted widely because of its low cost and also because it stops revenue leakage to the already
burdened electricity boards because of electricity theft. The main advantage of this project is its
low cost solution for prepaid metering of electricity usage and also stops theft of electricity at
household level. The facility of tamper detection stops any intrusions by the user into the
electricity meter to alter or stop the calculation of units being consumed.
CHAPTER 8

REFERENCES

1. YujunBao and Xiaoyan Jiang, Design of electric Energy Meter for long-distance data
information transfers which based upon GPRS, ISA2009. International Workshop on Intelligent
Systems and Applications, 2009. Volume 2, Issue 4, pp. 70- 73, 2010.

2. Ashna.K and Sudhish N George, "GSM based automatic energy meter reading system "IEEE
Wireless commuincations, 2013.pp-471-488

3. Vivek Kumar Sehgal,Nitesh Panda, Nipun Rai Handa, Electronic Energy Meter with instant
billing,UK Sim Fourth European Modelling Symposium on Computer Modelling and
Simulation,2011.

4. Hou-Tsan Lee, Wei-Chuan Lin, Ching-Hsiang Huang, Yu- Jhih Huang, "Electricity Metering
and Inroads to New Technologies", Proceedings of SICE Annual Conference (SICE), Volume-1,
Issue-4 pp. 2164- 2169, 2011.

5. Philip Garner, Ian Mullins, Reuben Edwards and Paul Coulton. "Mobile Terminated MS
Billing - Exploits and Security Analysis" New Generation. Proceedings of the Third International
Conference on lnformation Technology: New Generations (ITNG'06) –Vol 200, 10- 12 April
2006, Las Vegas, Nevada, USA, pp. 294 - 299.

6. H.Vijaya Laxmi and M.Narender; Communication between GSm enabled electricity meters
and ; International Journal of Engineering Research and Applications Vol. 1,Issue 4, pp. 48-52,
2010.

You might also like