You are on page 1of 42

CHAPTER-1

INTRODUCTION
1.1 INTRODUCTION:
In the hospitals when any major operation is performed, the patient must be in
anesthetize condition. If the operation lasts for a long time, say for suppose for 4 or 5
hours, complete dose of anesthesia cannot be administered in a single stroke. It may
lead to the patient’s death. If lower amount of anesthesia is administered, the patient
may wakeup at the middle of the operation.
To avoid this, the anesthetist administers few milliliters of anesthesia per hour
to the patient. If the anesthetist fails to administer the anesthesia to the patient at the
particular time interval, other allied problems may arise.
To overcome such hazardous problems the design of an automatic operation of
an anesthesia machine based on a micro-controller is effective. In this system a keypad
is provided along with the microcontroller and syringe infusion pump. The anesthetist
can set the level of anesthesia in terms of milliliters per hour to administer anesthesia to
the patient with the help of keypad.
After receiving the signal from the keypad, the microcontroller controls the
signal to the desire level and fed into the DC motor to drive the infusion pump in
proper manner. The anesthesia is administered to the patient according to the stepper
motor rotation (the syringe will move forward or backward direction).
This particular paper will be very much useful to physicians to see the current
position of anesthesia of the patients. If the level of anesthesia is decreased to lower
level (set value), the alarm will be initiated to alert the physician to refill the anesthesia
in the Syringe Pump to continue the process.
In this process sometimes we will not even have the time to inform what the health
condition is so for. In this case this information is forward to the doctor as SMS
through GSM module.

This system can also find the location, it is sent as SMS through the GSM

1
CHAPTER-2
BLOCK DIAGRAM
2.1 BLOCK DIAGRAM:

Fig: 2.1 Block diagram


2.2 EXISTING SYSTEM:
2
At present anesthetist controlled manual operation is employed, which may
cause many difficulties such as,
1. Level of anesthesia may get varied and there is a chance of getting side effects in
future.
2. If suppose the anesthetist fails to administer the level of anesthesia during the
predetermined period, the patient may be disturbed during the operation.
3. Other systems developed to administer anesthesia operates by sensing the
consciousness level of the patient and not by measuring his overall body conditions.

2.3 DISADVANTAGES OF EXISTING SYSTEM:


2.4 PROPOSED SYSTEM:
Now days, embedded systems are used in many applications in medical field
for controlling various biomedical parameters. In this design, a microcontroller is
used for controlling the anesthesia machine automatically, depending upon the various
biomedical parameters such as body temperature, heart rate, respiration rate etc.
Major operations are performed to remove or reconstruct the infected parts in the
human body. These operations lead to blood loss and pain. Therefore it is necessary to
arrest the pain and the blood loss. Anesthesia plays important role in the part of
painkilling. Hence, anesthesia is very essential in performing painless surgery.
Advantages of using the proposed system are,
1. The need for an anesthetist is eliminated.
2. Level of anesthesia is not varied, so the future side effects are eliminated.
3. IR detector is also included in the system for monitoring the total anesthesia level
for the entire period of the surgery time.

3
2.2 SCHEMATIC DIAGRAM

4
Fig2.2 schematic diagram
CHAPTER-3
CIRCUIT DESCRIPTION
3.1 DESIGNING:
Since the main intension of this project is to design “Tapping Detection Of
Power Using Gsm”. In order to fulfill this application there are few steps that has been
performed i.e.

1) Designing
2) Power supply for the entire circuitry.
3) Selection of microcontroller that suits our application.
4) Voltage dividing circuit
5) Selection of lcd
6) Connection of lcd
7) Selection of Gsm
8) Connection of Gsm through max232
9) Circuit operation

3.2 POWER SUPPLY SECTION:


In-order to work with any components basic requirement is power supply. In
this section there is a requirement of 5V power supply. Now the aim is to design the
power supply section which converts 230V AC in to 5V DC. Since 230V AC is too
high to reduce it to directly 5V DC, therefore we need a step-down transformer that
reduces the line voltage to certain voltage that will help us to convert it in to a 5V DC.
Considering the efficiency factor of the bridge rectifier, we came to a conclusion to
choose a transformer, whose secondary voltage is 3 to 4 V higher than the required
voltage i.e. 5V. For this application 0-9V transformers is used, since it is easily
available in the market.
The output of the transformer is 9V AC; it feed to rectifier that converts AC to
pulsating DC. As we all know that there are 3 kind of rectifiers that is

5
1) half wave
2) Full wave and
3) Bridge rectifier
Here we use Bridge rectifier, because half wave rectifier has less efficiency.
Even though the efficiency of full wave and bridge rectifier are the same, since there
is no requirement for any negative voltage for our application, we gone with bridge
rectifier.
Since the output voltage of the rectifier is pulsating DC, in order to convert it
into pure DC we use a high value (1000UF/1500UF) of capacitor in parallel that acts
as a filter. The most easy way to regulate this voltage is by using a 7805 voltage
regulator, whose output voltage is constant 5V DC irrespective of any fluctuation in
line voltage.
3.3 SELECTION OF MICROCONTROLLER:
As we know that there are so many types of micro controller families that are
available in the market. Those are
1) 8051 Family
2) AVR microcontroller Family
3) PIC microcontroller Family
4) ARM Family
Basic 8051 family is enough for our application; hence we are not concentrating
on higher end controller families. In order to fulfill our application, basic AT89C51
controller is enough. But still we selected AT89S52 controller because of inbuilt ISP
(in system programmer) option.
3.4 VOLTAGE DIVIDING CIRCUIT:
We use this voltage dividing circuit before and after the meter to detect
whether the voltage is present at input and output section of meter. After this circuit a
transistor is used which act like a switch. Output of transistor is given to micro
controller. We give the voltage dividing circuit output to micro controller through
this transistor. If voltage is present, transistor is short circuited and entire voltage is
passed to ground and 0v is sent to micro controller , if no voltage is present transistor
act as a open circuit and entire voltage is present at output. Under this condition 5v is
sent to micro controller.

6
3.5 SELECTION OF LCD:
A liquid crystal display (lcd) is an electrically- modulated optical device shaped
into a thin, flat panel made up of any number of color or filled monochrome pixels
with liquid crystals and arrayed in front of a light source( back light) or reflector. In
this project LCD is used to display the gsm status.

3.6 CONNECTION OF LCD:


We can connect LCD in 8 bit or 4 bit mode, if we use 8 bit more pins necessary to
interface LCD, so we can use 4 bit mode to reduce pins. In this project we used 8 bit
mode and it is connected to P0.

3.7 SELECTION OF GSM:


7
We use gsm module to send the information to electricity board when theft
occur,Here I use SIM 300 GSM module for transmitting information.

3.8 CONNECTION OF GSM THROUGH MAX232:


Max 232 is strictly used for asynchronous communication. Since gsm operates
with 3.3 volts we use max 232 to connect gsm to micro controller which act as a level
shifter.Max232 is connected to serial port of microcontroller.

3.9 CIRCUIT OPERATION:

In this power theft detection system, micro controller is the heart and all the
other components are connected to it, since they are controllered by micro controller.
For the functioning of micro controller we need 5v power supply which is connected
to 40th pin of micro controller. Voltage dividing circuits on either sides of meter is
connected to port pins p2.0 and p2.1 of micro controller through transistor which act
like a switch. Lcd is connected to port 1. To transmit the data serially we used serial
port to which gsm is connected through max232.
Our intention is to detect a power theft when occur in houses, factories, etc. Our
project is used to detect tapping of current lines ,that means connecting the direct
power supply to our home without flowing through the meter. For that we are using
voltage dividing circuit on both sides of a meter to detect whether the voltage is
present or not. These two voltage dividing circuits output is given to microcontroller
through transistor which act like a switch. If voltages is present at both sides of meter
that indicates no theft. Without giving input to the meter if the voltage is present at the
output of a meter that case is considered as a power theft and information is send to
electricity board using gsm module .Power theft indication will be shown in lcd
display. Like this we can detect a power theft in houses, factories etc.

8
CHAPTER-4
INTRODUCTION TO EMBEDDED SYSTEM
4. 1 INTRODUCTION:
Embedded systems are electronic devices that incorporate microprocessors
with in their implementations. The main purposes of the microprocessors are to
simplify the system design and provide flexibility. Having a microprocessor in the
device helps in removing the bugs, making modifications, or adding new features are
only matter of rewriting the software that controls the device. Or in other words
embedded computer systems are electronic systems that include a microcomputer to
perform a specific dedicated application. The computer is hidden inside these
products. Embedded systems are ubiquitous. Every week millions of tiny computer
chips come pouring out of factories finding their way into our everyday products.

Embedded systems are self-contained programs that are embedded within a


piece of hardware. Whereas a regular computer has many different applications and
software that can be applied to various tasks, Embedded systems are usually set to a
specific task that cannot be altered without physically manipulating the circuitry.
Another way to think of an embedded system is as a computer system that is created
with optimal efficiency, thereby allowing it to complete specific functions as quickly
as possible.

Embedded systems designers usually have a significant grasp of hardware


technologies. They use specific programming languages and software to develop
embedded systems and manipulate the equipment. Many companies offer embedded
systems development kits and other embedded systems tools for use by engineers and
businesses.

Embedded systems technologies are usually fairly expensive due to the


necessary development time and built in efficiencies, but they are also highly valued

9
in specific industries. Smaller businesses may wish to hire a consultant to determine
what sort of embedded systems will add value to their organization.

4.2 CHARACTERISTICS:
Two major characteristics of embedded system are cost and power consumption.
Since many embedded systems are produced in tens of thousands to millions of units
range, reducing cost is a major concern. Embedded systems often use a (relatively)
slow processor and small memory size to minimize costs.

The slowness is not just clock speed. The whole architecture of the computer is
often intentionally simplified to lower costs. For example, embedded systems often
use peripherals controlled by synchronous serial interfaces, which are ten to hundreds
of times slower than comparable peripherals used in PCs. Programs on an embedded
system often run with real-time constraints with limited hardware resources, often
there is no disk drive, operating system, keyboard or screen. A flash drive may replace
rotating media, a small keypad and LCD screen may be used instead of a PC's
keyboard and screen.

Firmware is the name of software that is embedded in hardware devices, e.g. in


one or more ROM/Flash memory IC chips. Embedded systems are routinely expected
to maintain 100% reliability while running continuously for long periods, sometimes
measured in years. Firmware is usually developed and tested too much harsher
requirements than is general-purpose software, which can usually be easily restarted if
a problem occurs.

4.3 PLATFORM:
There are many different CPU architectures used in embedded designs. This is
contrast to the desktop computer market which is limited to just a few competing
architectures mainly the Intel/AMD x86 and the Apple/Motorola/IBM Power PC’s
which are used in the Apple Macintosh. One common configuration for embedded
systems is the system on a chip, an application-specific integrated circuit, for which
the CPU was purchased as intellectual property to add to the IC's design.

10
4.4 TOOLS:
Like a typical computer programmer, embedded system designers use compilers,
assemblers and debuggers to develop an embedded system. Those software tools can
come from several source.

4.5 OPERATING SYSTEM:


They often have no operating system, or a specialized embedded operating
system (often a real-time operating system), or the programmer is assigned to port one
of these to the new system.

4.6 DEBUGGING:
Debugging is usually performed with an in-circuit emulator, or some type of
debugger that can interrupt the micro controller’s internal microcode. The microcode
interrupt let the debugger operate in hardware in which only the CPU works. The
CPU-based debugger can be used to test and debug the electronics of the computer
from the viewpoint of the CPU.

4.7 DESIGN OF EMBEDDED SYSTEM:


The electronics usually uses either a microprocessor or a microcontroller. Some
large or old systems use general-purpose mainframes computers or minicomputers.
All embedded systems have start-up code. Usually it disables interrupts, sets up
the electronics, tests the computer (RAM, CPU and software), and then starts the
application code. Many embedded systems recover from short-term power failures by
restarting (without recent self-tests). Restart times under a tenth of a second are
common.

Many designers have found one of more hardware plus software-controlled


LED’s useful to indicate errors during development (and in some instances, after
product release, to produce troubleshooting diagnostics). A common scheme is to
have the electronics turn off the LED(s) at reset, where upon the software turns it on
at the first opportunity, to prove that the hardware and start-up software have
performed their job so far. After that, the software blinks the LED(s) or sets up light
patterns during normal operation, to indicate program execution progress and/or
errors. This serves to reassure most technicians/engineers and some users.

11
12
CHAPTER-5
INTRODUCTION TO MICROCONTROLLER
5.1 INTRODUCTION:
Microcontrollers as the name suggests are small controllers. They are like single
chip computers that are often embedded into other systems to function as
processing/controlling unit. For example the remote control you are using probably
has microcontrollers inside that do decoding and other controlling functions. They are
also used in automobiles, washing machines, microwave ovens, toys ... etc, where
automation is needed.
Micro-controllers are useful to the extent that they communicate with other
devices, such as sensors, motors, switches, keypads, displays, memory and even other
micro-controllers. Many interface methods have been developed over the years to
solve the complex problem of balancing circuit design criteria such as features, cost,
size, weight, power consumption, reliability, availability, manufacturability. Many
microcontroller designs typically mix multiple interfacing methods. In a very
simplistic form, a micro-controller system can be viewed as a system that reads from
(monitors) inputs, performs processing and writes to (controls) outputs.
Embedded system means the processor is embedded into the required
application. An embedded product uses a microprocessor or microcontroller to do one
task only. In an embedded system, there is only one application software that is
typically burned into ROM. Example: printer, keyboard, video game player.
Microprocessor - A single chip that contains the CPU or most of the computer.
Microcontroller - A single chip used to control other devices.
Microcontroller differs from a microprocessor in many ways. First and the most
important is its functionality. In order for a microprocessor to be used, other
components such as memory, or components for receiving and sending data must be
added to it. That means that microprocessor is the heart of the computer. On the other
hand, microcontroller is designed to be all of that in one. No other external
components are needed for its application because all necessary peripherals are
already built in it. Thus, we save the time and space needed to construct devices.

13
5.2 MICRO PROCESSOR Vs MICRO CONTROLLER:
Microprocessor:
• CPU is stand-alone, RAM, ROM, I/O, timer are separate
• Designer can decide on the amount of ROM, RAM and I/O ports.
• Expensive
• Versatility general-purpose
Microcontroller:
• CPU, RAM, ROM, I/O and timer are all on a single chip
• Fix amount of on-chip ROM, RAM, I/O ports
• For applications in which cost, power and space are critical
• Single-purpose
5.3 MICRO CONTROLLER 89S52:
Features:
• 8K Bytes of In-System Reprogrammable Flash Memory
• Endurance: 1,000 Write/Erase Cycles
• Fully Static Operation: 0 Hz to 24 MHz
• 256 x 8-bit Internal RAM
• 32 Programmable I/O Lines
• Three 16-bit Timer/Counters
• Eight Interrupt Sources
• Programmable Serial Channel
• Low-power Idle and Power-down Modes
5.4 DESCRIPTION:
The AT89S52 is a low-power, high-performance CMOS 8-bit microcomputer
with 8Kbytes of Flash programmable and erasable read only memory (PEROM). The
on-chip flash allows the program memory to be reprogrammed in system or by a
conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU
with flash on a monolithic chip, the Atmel AT89S52 is a powerful microcomputer,
which provides a highly flexible and cost-effective solution to many embedded
control applications.

PIN DIAGRAM- AT89S52:


14
Fig: 5.5 pin diagram of at89s52

5.5 PIN DESCRIPTION:

15
VCC - Supply voltage.
GND - Ground.
Port 0:
Port 0 is an 8-bit open drain bi-directional I/O port. As an output port, each pin
can sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as
high-impedance inputs. Port 0 can also be configured to be the multiplexed lower-
order address/data bus during accesses to external program and data memory. In this
mode, P0 has internal pull-ups. Port 0 also receives the code bytes during flash
programming and outputs the code bytes during program verification. External pull-
ups are required during program verification.
Port 1:
Port 1 is an 8-bit bi-directional I/O port with internal pull-ups. The port 1 output
buffers can sink/source four TTL inputs. When 1s are written to port 1 pins, they are
pulled high by the internal pull-ups and can be used as inputs. As inputs, port 1 pins
that are externally being pulled low will source current (I IL) because of the internal
pull-ups. In addition, P1.0 and P1.1 can be configured to be the timer/counter 2
external count input (P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX)
respectively.
Port 2:
Port 2 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 2 output
buffers can sink/source four TTL inputs. When 1s are written to port 2 pins, they are
pulled high by the internal pull-ups and can be used as inputs. As inputs, port 2 pins
that are externally being pulled low will source current (I IL) because of the internal
pull-ups. Port 2 emits the high-order address byte during fetches from external
program memory and during accesses to external data memory that uses 16-bit
addresses (MOVX @ DPTR). In this application, port 2 uses strong internal pull ups
when emitting 1s. During accesses to external data memory that uses 8-bit addresses
(MOVX @ RI), Port 2 emits the contents of the P2 Special Function Register. Port 2
also receives the high-order address bits and some control signals during flash
programming and verification.

Port 3:

16
Port 3 is an 8-bit bi-directional I/O port with internal pull ups. The Port 3 output
buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins, they are
pulled high by the internal pullups and can be used as inputs. As inputs, Port 3 pins
that are externally being pulled low will source current (I IL) because of the pull ups.
Port 3 also serves the functions of various special features of the AT89C51. Port 3 also
receives some control signals for flash programming and verification.
5.6 PORT3 ALTERNATIVE FUNCTIONS:
P3.0 RXD (serial input port)
P3.1 TXD (serial output port)
P3.2 INT0 (external interrupt 0)
P3.3 INT1 (external interrupt 1)
P3.4 T0 (timer 0 external input)
P3.5 T1 (timer 1 external input)
P3.6 WR (external data memory write strobe)
P3.7 RD (external data memory read strobe).
RESET:
Reset input. A high on this pin for two machine cycles while the oscillator is
running resets the device.
ALE/PROG:
Address Latch Enable is an output pulse for latching the low byte of the address
during accesses to external memory. This pin is also the program pulse input (PROG)
during flash programming. In normal operation, ALE is emitted at a constant rate of
1/6 the oscillator frequency and may be used for external timing or clocking purposes.
However, that one ALE pulse is skipped during each access to external data memory.
If desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With
the bit set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the
pin is weakly pulled high. Setting the ALE-disable bit has no effect if the
microcontroller is in external execution mode.
PSEN:
Program Store Enable is the read strobe to external program memory. When the
AT89C52 is executing code from external program memory, PSEN is activated twice
each machine cycle, except that two PSEN activations are skipped during each access
to external data memory.

17
EA/VPP:
External Access Enable (EA) must be strapped to GND in order to enable the
device to fetch code from external program memory locations starting from 0000H to
FFFFH. However, if lock bit 1 is programmed, EA will be internally latched on reset.
EA should be strapped to VCC for internal program executions.
XTAL1:
Input to the inverting oscillator amplifier and input to the internal clock operating
circuit.
XTAL2:
It is an output from the inverting oscillator amplifier.
5.7 BLOCK DIAGRAM OF 89S52:

EXTERNAL
INTERRUPTS
TIMER/COU
NTER
INTERRUPT ON-CHIP ROM ON-CHIP
CONTROL FOR RAM TIMER 1 COUNTER
PROGRAM INPUTS
CODE TIMER 0

CPU

BUS 4 I/O SERIAL


OSC CONTROL PORTS PORT

P0 P1 P2 P3 Tx Rx

Fig: 5.6 Block diagram of 89S52

5.8 ARCHITECTURE OF 8052 MICRO CONTROLLER:

18
Fig: 5.8 Architecture of 89S52

5.9 OSCILLATOR CHARACTERISTICS:


XTAL1 and XTAL2 are the input and output, respectively, of an inverting
amplifier, which can be configured for use as an on-chip oscillator. Either a quartz
crystal or ceramic resonator may be used. To drive the device with an external clock
19
source, XTAL2 should be left unconnected while XTAL1 is driven. There are no
requirements on the duty cycle of the external clock signal, since the input to the
internal clocking circuitry is through a divide-by-two flip-flop, but minimum and
maximum voltage high and low time specifications must be observed.
5.10 IDLE MODE:
In idle mode, the CPU puts itself to sleep while all the on-chip peripherals
remain active. The mode is invoked by software. The content of the on-chip RAM and
all the special functions registers remain unchanged during this mode. The idle mode
can be terminated by any enabled interrupt or by a hardware reset. It should be noted
that when idle mode is terminated by a hardware reset, the device normally resumes
program execution, from where it left off, up to two machine cycles before the
internal reset algorithm takes control. On-chip hardware inhibits access to internal
RAM in this event, but access to the port pins is not inhibited. To eliminate the
possibility of an unexpected write to a port pin when idle mode is terminated by reset,
the instruction following the one that invokes idle mode should not be one that writes
to a port pin or to external memory.
5.11 OSCILLATOR CONNECTION:

Note: C1, C2 = 30 pF ± 10 pF for Crystals

Fig: 5.11 oscillator connection

CHAPTER-6
INTRODUCTION TO LCD
6.1 INTRODUCTION TO LCD:

20
Liquid crystal display is a type of display which used in digital watches and
many portable computers. LCD displays utilize two sheets of polarizing material with
a liquid crystal solution between them. An electric current passed through the liquid
causes the crystals to align so that light cannot pass through them. Each crystal,
therefore, is like a shutter, either allowing light to pass through it or blocking the light.
The liquid crystals can be manipulated through an applied electric voltage so that light
is allowed to pass or blocked. By carefully controlling where and what wavelength
(color) of light is allowed to pass, the LCD monitor is able to display images. A back
light provides LCD monitor’s brightness.

Other advances have allowed LCD’s to greatly reduce liquid crystal cell response
times. Response time is basically the amount of time it takes for a pixel to “change
colors”. In reality response time is the amount of time it takes a liquid crystal cell to
go from being active to inactive.

They make complicated equipment easier to operate. LCD’s come in many shapes
and sizes ,but the most common is the 16 character x 4 line (16x4) display with no
backlight. It requires only 11 connections – eight bits for data (which can be reduced
to four if necessary) and three control lines (we have only used two here). It runs with
5V DC supply and only needs about 1mA of current. The display contrast can be
varied by changing the voltage in pin 3 of the display.
6.2 PIN DESCRIPTION:
VCC, VSS and VEE:
While VCC and VSS provide +5V and ground respectively, VEE is used for
controlling LCD contrast.

PIN SYMBOL I/O DESCRIPTION

1 VSS -- Ground
2 VCC -- +5V power supply
3 VEE -- Power supply to
control contrast
4 RS I RS=0 to select
command register
RS=1 to select data
register
5 R/W I R/W=0 for write

21
R/W=1 for read
6 EN I/O Enable
7 DB0 I/O The 8-bit data bus
8 DB1 I/O The 8-bit data bus
9 DB2 I/O The 8-bit data bus
10 DB3 I/O The 8-bit data bus
11 DB4 I/O The 8-bit data bus
12 DB5 I/O The 8-bit data bus
13 DB6 I/O The 8-bit data bus
14 DB7 I/O The 8-bit data bus

The three control lines are referred to as EN, RS, and RW.
EN: The EN line is called "Enable". This control line is used to tell the LCD that you
are sending it the data. To send data to the LCD, your program should first set this
line high (1) and then set the other two control lines and/or put data on the data bus.
When the other lines are completely ready, bring EN low (0) again. The 1-0 transition
tells the 44780 to take the data currently found on the other control lines and on the
data bus and to treat it as a command.
RS: The RS line is the "Register Select" line. When RS is low (0), the data is to be
treated as a command or special instruction (such as clear screen, position cursor,
etc.). When RS is high (1), the data that is sent is a text data which should be
displayed on the screen. For example, to display the letter "T" on the screen you
would set RS high.
RW: The RW line is the "Read/Write" control line. When RW is low (0), the
information on the data bus is being written to the LCD. When RW is high (1), the
program is effectively querying (or reading) the LCD. Only one instruction ("Get
LCD status") is a read command. All others are write commands, so RW will almost
be low.
6.3 ADVANTAGES:
LCD interfacing with 8051 is a real-time application. In recent years the LCD is
finding widespread use replacing LED’s (seven segment LED’s or other multi
segment LED’s).

This is due to following reasons:

1. The declining prices of LCD’s.

22
2. The ability to display numbers, characters and graphics. This is contrast to LED’s,
which are limited to numbers and a few characters. An intelligent LCD displays two
lines, 20 characters per line, which is interfaced to the 8051.
3. Incorporation of a refreshing controller into the LCD, thereby relieving the CPU to
keep displaying the data.
4. Ease of programming for characters and graphics.
6.4 BASIC COMMANDS OF LCD:
When LCD is powered up the display should show a series of dark squares,
possibly only on part of display. These characters are actually in their off state, so the
contrast control should be adjusted anti-clockwise until the squares are just visible.
The display module resets itself to an initial state when power is applied, which
curiously the display has blanked off so that even if characters are entered, they
cannot be seen. It is therefore necessary to issue a command at this point, to switch
the display on.

CODE (Hex) COMMAND TO LCD INTRODUCTION REGISTER

1 CLEAR DISPLAY SCREEN


2 RETURN HOME
4 DECREMENT CURSOR (SHIFT CURSOR TO LEFT)
5 INCREMENT CURSOR (SHIFT CURSOR TO RIGHT)
6 SHIFT DISPLAY RIGHT
7 SHIFT DISPLAY LEFT
8 DISLAY OFF, CURSOR OFF
A DISPLAY OFF, CURSOR ON
6.5 LCD COMMAND CODES:
C DISPLAY ON, CURSOR OFF
E DISPLAY ON, CURSOR BLINKING
F DISPLAY ON, CURSOR BLINKING
10 SHIFT CURSOR POSITION TO LEFT
14 SHIFT CURSOR POSITION TO RIGHT
18 SHIFT THE ENTIRE DISPLAY TO THE LEFT
1C SHIFT THE ENTIRE DISPLAY TO THE RIGHT
ST
80 FORCE CURSOR
23 TO BEGINNING OF 1 LINE
C0 FORCE CURSOR TO BEGINNING OF 2ND LINE
38 2 LINES AND 5X7 MATRIX
24
6.6 CIRCUIT DESCRIPTION OF LCD:
The circuit can be wired up on a “plug-in-style” prototyping board, using dual-
in-line switches for the data lines (S1-S8). A toggle switch for the RS input (S10) and
a momentary action switch (or macro switch) for usage.
Most of the LCD modules conform to a standard interface specification. A 14pin
access is provided having eight data lines, three control lines and three power lines.
The connections are laid out in one of the two common configurations, either two
rows of seven pins, or a single row of 14 pins.

One of the pins are numbered on the LCD’s print circuit board (PCB), but if not,
it is quite easy to locate pin1. Since this pin is connected to ground, it often has a
thicker PCB track, connected to it, and it is generally connected to metalwork at same
point.

PIN DIAGRAM:

G +5V -5v

1 2 3

07 08 09 10 11 12 13 14 4 5 6

D0 D1 D2 D3 D4 D5 D6 D7 RS R/W EN
Fig:6.8 pin description of lcd
The LCD plays a major role in the entire operation as it has the ability to display the
certain data that the user has entitled. LCD display varies from input to input as there
is no specific outline for it to operate.

25
CHAPTER-7
INTRODUCTION TO GSM
7.1 INTRODUCTION TO GSM:

GSM was first introduced in 1991. As of the end of 1997, GSM service was
available in more than 100 countries and has become the de facto standard in Europe
and Asia.

Global System for Mobile communications is the most popular standard for
mobile phones in the world. Its promoter, the GSM Association estimates that 82% of
the global mobile market uses this standard. GSM is used by over 3 billion people
across more than 212 countries and territories. Its ubiquity makes international
roaming very common between mobile phone modulators, enabling subscribers to use
their phones in many parts of the world. GSM differs from its predecessors in that
both signaling and speech channels , and thus it is considered as second generation
(2g) mobile phone system. This has also meant that data communication was easy to
build into the system.

GSM (Global System for Mobile communications) is an open, digital cellular


technology used for transmitting mobile voice and data services. GSM differs from
first generation wireless systems, in that it uses digital technology and time division
multiple access transmission methods. GSM is a circuit-switched system that divides
each 200 kHz channel into eight 25 kHz time-slots. GSM supports data transfer
speeds of up to 9.6 kbps, allowing the transmission of basic data services such as
SMS (Short Message Service). Another major benefit is its international roaming
capability, allowing users to access the same services when traveling abroad as at
home. GSM satellite roaming has also extended service access to areas where
terrestrial coverage is not available.

There are five different cell sizes in a GSM network they are macro, micro, Pico,
femto and umbrella cells. The coverage area of each cell varies according to the
implementation environment. Macro cells are the cells where the base station antenna
is installed on a mast or a building above average roof top level. Micro cells are cells
whose antenna height is under average roof top level, they are typically used in urban

26
areas. Pico cells are small cells whose coverage diameter is a few dozen meters, they
are mainly used in indoors. Femto cells are cells designed for use in residential or
small business environments and connect to the service provider’s network via a
broadband internet connection. Umbrella cells are used to cover shadowed regions of
smaller cells and fill gaps in coverage between those cells.

Before looking at the GSM specifications, it is important to understand the following


basic terms:

 bandwidth—the range of a channel's limits; the broader the bandwidth, the


faster the data can be sent

 frequency—the number of cycles per unit of time; frequency is measured in


hertz(Hz)

 kilo (k)—kilo is the designation for 1,000; the abbreviation kbps represents
1,000 bits per second

 megahertz (MHz)—1,000,000 hertz (cycles per second)

 milliseconds (ms)—one-thousandth of a second

 watt (W)—a measure of power of a transmitter

Specifications for different personal communication services (PCS) systems vary


among the different PCS networks. Listed below is a description of the specifications
and characteristics for GSM.

 Frequency band—the frequency range specified for GSM is 1,850 to 1,990


MHz (mobile station to base station).

 Duplex distance—the duplex distance is 80 MHz’s. Duplex distance is the


distance between the uplink and downlink frequencies. A channel has two
frequencies, 80 MHz apart.

 Channel separation—the separation between adjacent carrier frequencies. In


GSM, this is 200 kHz.

27
 Modulation—Modulation is the process of sending a signal by changing the
characteristics of a carrier frequency. This is done in GSM via Gaussian
minimum shift keying (GMSK).

 Transmission rate—GSM is a digital system with an over-the-air bit rate of


270 kbps.

 Access method—GSM utilizes the time division multiple access (TDMA)


concept. TDMA is a technique in which several different calls may share the
same carrier. Each call is assigned a particular time slot.

 Speech coder—GSM uses linear predictive coding (LPC). The purpose of


LPC is to reduce the bit rate. The LPC provides parameters for a filter that
mimics the vocal tract. The signal passes through this filter, leaving behind a
residual signal. Speech is encoded at 13 kbps.

7.2 COMMANDS ACCORDING TO GSM:


The GSM 07.05 commands are for performing SMS and CBS related
operations.SIM300II supports both text and PDU modes.

Command Description

AT+CMGD DELETE SMS MESSAGE


AT+CMGF SELECT SMS MESSAGE FORMAT
AT+CMGL LIST SMS MESSAGES FROM PREFERRED STORE
AT+CMGR READ SMS MESSAGE
AT+CMGS SEND SMS MESSAGE
AT+CMGW WRITE SMS MESSAGE TO MEMORY
AT+CMSS SEND SMS MESSAGE FROM STORAGE
AT+CMGC SEND SMS COMMAND
AT+CNMI NEW SMS MESSAGE INDICATION
AT+CPMS PREFERRED SMS MESSAGE STORAGE
AT+CRES RESTORE SMS SETTINGS
AT+CSAS SAVE SMS SETTINGS
AT+CSCA SMS SERVICE CENTER ADDRESS
AT+CSCB SELECT CELL BROADCAST SMS MESSAGES
AT+CSDH SHOW SMS TEXT MODE PARAMETERS
AT+CSMP SET SMS TEXT MODE PARAMETERS
AT+CSMS SELECT MESSAGE SERVICE
28
7. 3 MAX232:
The MAX232 is a dual driver/receiver that includes a capacitive voltage
generator to supply TIA/EIA-232-F voltage levels from a single 5-V supply. Each
receiver converts TIA/EIA-232-F inputs to 5-V TTL/CMOS levels. These receivers
have a typical threshold of 1.3 V, a typical hysteresis of 0.5 V, and can accept ±30-V
inputs. Each driver converts TTL/CMOS input levels into TIA/EIA-232-F levels.
7.4 PIN DIAGRAM:

29
fig: 7.4 pin diagram of max232

The MAX232 from Maxim was the first IC which in one package contains the
necessary drivers (two) and receivers (also two), to adapt the RS-232 signal voltage
levels to TTL logic. It became popular, because it just needs one voltage (+5V) and
generates the necessary RS-232 voltage levels (approx. -10V and +10V) internally.
This greatly simplified the design of circuitry. Circuitry designers no longer need to
design and build a power supply with three voltages (e.g. -12V, +5V, and +12V), but
could just provide one +5V power supply, e.g. with the help of a simple 7805 voltage
converter.

7.5 FUNCTION TABLES:

30
7.6 MAX232 PIN LAYOUT:

Capacitor Value
No. Name Purpose Signal voltage
MAX232A

+ connector for capacitor should stand at least


1 C1+ 1µF 100nF
capacitor C1 16V
+10V, capacitor should stand at 1µF to 100nF to
2 V+ output of voltage pump
least 16V VCC VCC
- connector for capacitor should stand at least
3 C1- 1µF 100Nf
capacitor C1 16V
+ connector for capacitor should stand at least
4 C2+ 1µF 100nF
capacitor C2 16V
- connector for capacitor should stand at least
5 C2- 1µF 100nF
capacitor C2 16V
output of voltage pump -10V, capacitor should stand at 1µF to 100nF to
6 V-
inverter least 16V GND GND
7 T2out Driver 2 output RS-232
8 R2in Receiver 2 input RS-232
9 R2out Receiver 2 output TTL

10 T2in Driver 2 input TTL

11 T1in Driver 1 input TTL


12 R1out Receiver 1 output TTL
13 R1in Receiver 1 input RS-232
14 T1out Driver 1 output RS-232
1µF to 100nF to
15 GND Ground 0V
VCC VCC
see
16 VCC Power supply +5V see above
above

31
7.7 LIOGIC DIAGRAM:

The MAX232 has two receivers (converts from RS-232 to TTL voltage levels) and
two drivers (converts from TTL logic to RS-232 voltage levels).

Typically a pair of a driver/receiver of the MAX232 is used for

 TX and RX

And the second one for

 CTS and RTS.

There are not enough drivers/receivers in the MAX232 to connect the DTR, DSR,
and DCD signals. Usually these signals can be omitted when communicating with a
PC's serial interface. If the DTE really requires these signals either a second MAX232
is needed, or some other IC from the MAX232 family can be used (if it can be found
in consumer electronic shops at all).

CHAPTER-8
INTRODUCTION TO KEIL SOFTWARE
Many companies provide the 8051 assembler, some of them provide shareware
version of their product on the Web, Kiel is one of them. We can download them from
their Websites. However, the size of code for these shareware versions is limited and
we have to consider which assembler is suitable for our application.

32
8.1 KIEL U VISION2:
This is an IDE (Integrated Development Environment) that helps you write, compile,
and debug embedded programs. It encapsulates the following components:
. A project manager
. A make facility
. Tool configuration
. Editor
. A powerful debugger
8.2 LIMITATIONS OF EVALUATION SOFTWARE:
The following limitations apply to the evaluation versions of the C51, C251, or C166
tool chains. C51 Evaluation Software Limitations:

1. The compiler, assembler, linker, and debugger are limited to 2 Kbytes of


object code but source Code may be in any size. Programs that generate more
than 2 Kbytes of object code will not compile, assemble, or link the startup
code generated includes LJMP's and cannot be used in single-chip devices
supporting Less than 2 Kbytes of program space like the Philips 750/751/752.
2. The debugger supports files that are 2 Kbytes and smaller.
3. Programs begin at offset 0x0800 and cannot be programmed into single-chip
devices.
4. No hardware support is available for multiple DPTR registers.
5. No support is available for user libraries or floating-point arithmetic.

8.3 PERIPHERAL SIMULATION:


The u vision2 debugger provides complete simulation for the CPU and on chip
peripherals of most embedded devices. To discover which peripherals of a device are
supported, in u vision2, select the simulated peripherals item from the Help menu.
You may also use the web-based device database. We are constantly adding new
devices and simulation support for on-chip peripherals so be sure to check device
database often.
33
34
CHAPTER-9

CODING:

#include<reg51.h>

#include<LCD>

#include<intrins.h>

Sbit buzzer = P0^1;

Sbit IRS = P2^0;

Void SEND_SMS_POWER (unsigned char *);

Void SEND_CHR (unsigned char);

Void SEND_STR (unsigned char *);

Void GSM_INIT (void)

//cmd_lcd (0x01);

//display_lcd ("GSM INITIALIZING");

SEND_STR ("AT\r\n");

delay_ms (300);

SEND_STR ("AT+IPR=9600\r\n");

delay_ms (300);

SEND_STR ("AT+CMGF=1\r\n");

delay_ms (300);
35
SEND_STR ("AT+CNMI=0,1,0,0,0\r\n");

delay_ms (300);

SEND_STR ("ATE0\r\n");

delay_ms (300);

SEND_STR ("AT&W\r\n");

delay_ms (300);

SEND_STR ("AT+CREG?\r\n");

delay_ms (300);

Void main (void)

Buzzer = 0; IRS = 1;

TMOD=0x20;

SCON=0x50;

TH1=0xFD;

TR1=1;

init_lcd ();

cmd_lcd (0x01);

cmd_lcd (0x80);

display_lcd (“POWER THEFT ");

36
cmd_lcd (0xC0);

display_lcd (" INDICATION ");

//delay_ms (500);

GSM_INIT ();

delay_ms (50);

While (1)

cmd_lcd (0x01);

cmd_lcd (0x80);

display_lcd (“POWER THEFT ");

cmd_lcd (0xC0);

display_lcd (" INDICATION ");

While (IRS==1);

Buzzer=1;

cmd_lcd (0x01);

cmd_lcd (0x80);

display_lcd ("POWER THEFTED AT");

cmd_lcd (0xC0);

display_lcd ("METER ID: APT165S");

Delay_ ms (500);

37
SEND_SMS_POWER ("9701214669");

SEND_SMS_POWER ("8464806862");//8464806862

delay_ms (1000);

Buzzer=0;

Void SEND_SMS_POWER (unsigned char *nm)

cmd_lcd (0x01);

display_lcd ("SENDING SMS...");

SEND_STR ("AT+CMGS=");

SEND_CHR ('"');

SEND_STR (nm);

SEND_CHR ('"');

SEND_STR ("\r\n");

SEND_STR ("POWER THEFTED AT METER ID:APT165S");

SEND_CHR (0x1A);

delay_ms (1000);

cmd_lcd (0x01);

display_lcd ("SMS SENT");

38
}

Void SEND_STR (unsigned char *s)

{While (*s)

SEND_CHR (*s++);

} void SEND_CHR (unsigned char c){

SBUF = c;

While (TI == 0);

TI = 0;

39
CHAPTER-10
RESULT
BEFORE SWITCH IS OFF:

Before the switch is on no power supply is passed through the circuit and no operation
is performed at this state. Below figure shows the circuit when the switch is off.

bj

AFTER SWITCH IS ON:

When the switch is on power supply is passed through the circuit, then
the micro controller and the components connected to it get activated.
When the power supply is connected directly to output of meter theft is
detected and message is sent to prescribed number which is shown in
below fig.

40
CHAPTER-11

CONCLUSION

In this way we are going to design the power theft identifier using gsm. The
purpose of designing such system will ultimately reduce the illegal use of electricity
and saves money because it directly affects the economy of nation, because power
theft is non ignorable crime which has to be controlled.
This system will be beneficial to consumer as well as for government. And it will
require only one time installation cost and can be used further. And the big advantage
of this system is that it will increase the revenue.
Future scope:-
It requires only one time installation cost after installation this can be used for life
time.
· It will completely eliminate the power theft and will increase revenue for the
Government and saves electricity.
· We can make this project more users friendly by introducing a RF module.

41
CHAPTER-13
REFERENCE

12.1 TEXT BOOKS REFFERED:

1. “The 8051 Microcontroller and Embedded Systems” by Muhammad Ali


Mazzidi and Janice Gillespie Maida, Pearson Education.

2. 8051 Microcontroller Architecture, programming and application by


KENNETH JAYALA.
3. ATMEL 89S52 Data sheets.
4. Hand book for Digital IC’s from Analogic Devices.

12.2 WEBSITES VIEWED:

 www.atmel.com

 www.beyondlogic.org

 www.dallassemiconductors.com

 www.maxim-ic.com

 www.alldatasheets.com

 www.howstuffworks.com

42

You might also like