Sunteți pe pagina 1din 85

PROJECT REPORT ON

AUTO CONTROL OF VEHICLE ENGINE


AT THE TRAFFIC SIGNALING POST
CONTENTS
1. ABSTRACT
2. INTRODUCTION
3. FUNCTIONAL DESCRIPTION
4. DIAGRAMS
BLOCK DIAGRAM
CIRCUIT DIAGRAM
5. BRIEF DESCRIPTION ABOUT ZIGBEE TECHNOLOGY
6. DESCRIPTION ABOUT MICROCONTROLLERS
7. DESCRIPTION ABOUT LCD INTERFACING
8. BRIEF DESCRIPTION ABOUT LCD PANELS
9. RELAYS AND THEIR APPLICATIONS
10. SOFTWARE DESCRIPTION WITH CHIP BURNING PROCESS
11. HARDWARE DETAILS
12. CONCLUSIONS AND REFERENCES

AUTO CONTROL OF VEHICLE


ENGINE AT THE TRAFFIC
SIGNALING POST
ABSTRACT
The project designed here is an automatic vehicle control as per the traffic
signaling system. The main aim of this project work is to save the fuel of the
vehicle and reducing the pollution.
The demo module is designed with a proto type vehicle in a single
direction of the traffic signaling post. As this is of single direction, the traffic signal
post is designed with one RED and one GREEN indicator. The traffic signaling
post communicates with the vehicle through wireless network Zigbee technology.
So the signal post acts as transmitting section and the vehicle will be receiving
section.
The transmitting section at the traffic signal post is designed with
microcontroller, indicators, Zigbee transmitter and an IR sensing circuit for
detecting the vehicle entered into the zone. And the receiving section i.e., vehicle
is designed with micro controller, Zigbee receiver, start and stop buttons, LCD for
displaying the time left to change the signal to GREEN, alarm, relays and DC
motors for the vehicle movement.
Total 3 DC motors are used for the vehicle in which two are used for the
vehicle movement and one motor is used to indicate the vehicle engine ON or
OFF state. Once the vehicle enters in to the signal post zone which is detected

by the IR sensor arranged before the signal post, the controller in the transmitting
section transmits the time duration of the RED signal to the vehicle. If the time
duration is more than 10 seconds, the controller in the vehicle activates the alarm
to switch OFF the engine. If the engine is not switched OFF, the controller
automatically OFFs the engine. If the time duration is less than 10 seconds, the
vehicles engine will not be switched OFF.
By this type of system, lot of fuel can be saved and the pollution can also
be decreased. This way the traffic signaling system can be designed to other
three directions as well.

CHAPTER-2

INTRODUCTION
Traffic congestion is increasingly becoming a severe problem in many
large cities around the world. The problem is more complex in developing
countries where cities are growing much faster than those in the developed
countries. The average annual population growth in developing countries is
estimated at around 5% compared to 0.7% in developed countries. With the
increase of population the traffic is also being increased day by day. It has
become a hell kind of experience in these days to go out in the peak hours,
mostly in the metropolitan cities. It takes hours to go to a near place where there
have been number of traffic signal junctions.
Automotive technologies are gaining ground in modern road traffic-control
systems, since the number of road vehicles and passengers is rapidly growing.
There is a perpetual need for safety-critical traffic automation, and traffic
engineering makes the dynamic or static analysis and the synthesis of
automotive vehicle technologies possible. The main goal of engineering is the
planning and management of traffic systems as well as the intelligent
automobiles to take self decisions i.e., artificial intelligence is to be designed in
them.
The project supports the development of reliable and optimal control
structures for urban traffic and for motorway systems. The intelligent and
cooperative set-up of actuation and its linkage to the central control system is
vital for avoiding fuel consumption of vehicle at signal post. Moreover,
environmental costs (e.g., pollution) can be decreased. Growing numbers of road

users and the limited resources provided by current infrastructures lead to ever
increasing traveling times.
Traffic in a city is very much affected by traffic light controllers. When
waiting for a traffic light, the driver looses time and the car uses fuel. To make
automobile controllers more intelligent, we exploit the emergence of novel
technologies such as communication networks and sensor networks, as well as
the use of more sophisticated algorithms for setting traffic lights. Intelligent traffic
light control does not only mean that traffic lights are set in order to minimize
waiting times of road users, but also that road users receive information about
how to drive through a city in order to minimize their waiting times and save fuel
as well as reduce pollution. This means that we are coping with a complex multiagent system, where communication and coordination play essential roles. Our
research has led to a novel system in which traffic light controllers and the
behavior of car drivers are optimized using machine-learning methods.
Generally when the traffic signaling post is reached and if a RED signal is
displayed, all the vehicles will stop. But the human tendency is that the vehicle
engines will not be switched off. This leads to fuel combustion even the vehicle
isnt travelling which leads to more pollution. This project presents an automated
solution that reduces the pollution as well as saves the fuel of the vehicles. As
mentioned in the abstract the signal post acts as the transmitter, transmitting the
time duration to turn the RED signal to GREEN. The vehicle receives the signal
and displays the information of time duration in the LCD. If the time duration is
more than the set value in the program, automatically the vehicle engine will be
stopped by the controller.
This project has been designed by using IR sensors for approaching road
at a signal junction. The IR sensor gives a signal indication that the vehicle has

approached the signal junction to the controller at the signal post. By which the
controller transmits the seconds time duration of turning on the GREEN indicator
through the Zigbee RF transmitter. Depending on the information received, the
controller takes the decision to switch off the engine or not by taking the time
duration into account. And the rest of the signals will be in red for the duration of
period defined in the controller. Likewise in each direction all the vehicles can be
given information about the signaling time duration by which the vehicle engines
can be stopped to save fuel as well as reduce pollution to some extent.
The explosion in wireless technology has seen the emergence of many
standards, especially in the industrial, scientific and medical (ISM) radio band.
There have been a multitude of proprietary protocols for control applications,
which bottlenecked interfacing. Need for a widely accepted standard for
communication between sensors in low data rate wireless networks was felt. As
an answer to this dilemma Zigbee is designed. As ZigBee protocol provides
simple and robust wireless applications, this device can send and receive the
digital data. ZigBee is a specification for a suite of high level communication
protocols using small, low-power digital radios based on an IEEE 802 standard
for personal area networks.
Zigbee is one of the wireless protocols based on the IEEE 802.15.4
standard for wireless personal area networks (WPANs). Zigbee is designed to
use in embedded applications requiring low data rates and low power
consumption. The benefits of using Zigbee technology is to make the design as
simple as possible, cost-effective, Robust (Ensuring a reliable solution in noisy
environments), low-power wireless connectivity, etc. One main advantage of
using this technology is to cover large areas with routers. As each Zigbee module
can send and receive data, the received data received from one point can be
transported to the third point as a mediator.

Zigbee is widely used in an industrial control, an embedded sensor, and a


building and home automation. XBee is one of the ZigBee modules from MaxStream. The XBee provides a user friendly interface, minimal power
consumption, and reliability of data transferring between the modules. Several
topics related to the ZigBee protocol such as a selection of the module, a basic
concept of the module operation, and the implantation of the module in this
project work will be discussed in the following chapters.

Wireless Technology Comparison Chart

CHAPTER 3

FUNCTIONAL DESCRIPTION
The functional description of the project work is explained in this chapter.
For better understanding total project work is divided into various sections and
each section circuit description is provided in this chapter. The complete block
and circuit diagram of this project is provided in the next chapter.

Vehicle sensing circuit designed with LM 567 IC


The function or the operation of the project work starts with section. By
detecting the vehicle, this unit indicates to the controller by which the controller
transmits the time duration using Zigbee. The LM567 IC is a general-purpose
tone decoder designed to provide a saturated transistor switch to ground when
an input signal is present within the pass band. The circuit consists of two-phase
detectors i.e., Q and I detector that are driven by a voltage-controlled oscillator,
which determines the center frequency of the decoder. External components are
used to independently set center frequency, bandwidth and output delay.
As the IC is configured with a VCO internally, it will be generating the
frequency depending on the R and C values that are connected to the 5 and 6
pins of the 567-tone decoder IC. 5th pin is called as the timing resistor (RT) and
6th pin is called as the timing capacitor (CT). As the frequency is inversely
proportional to R and C values, by defining the RC network at the IC; the VCO
(Voltage Controlled Oscillator) along with the Q-phase detector will be generating
a particular frequency which will be coming out from the 5th pin of the tone
decoder IC. The I-phase detector is used to decode or compare the received
frequency with the generated frequency.

The frequency generated by the tone decoder IC can be calculated using


the formula:
F = [1 / (2 R C)]
Looking at the pin configuration in the circuit diagram of the 567-tone
decoder, 3rd pin of the IC is connected to the IR receiver (detector) and 5 th pin to
the IR transmitter by using a transistor. The PNP transistor SK 100 is used to
drive the high efficiency IR transmitting LED with the modulating frequency
generated by the IC. In simple words it can be explained like, as the signal
(frequency) generated by the IC will not be having great strength, the transistor is
used for amplifying the signal and the amplified signal is fed to IR transmitting
LED and in order to limit the current a 470 ohms resistor is connected.
The IR is having the characteristics of a laser i.e., it almost travels in a
straight line with minimum expansion and like laser light it is also a
monochromatic light. Another important feature of IR is that while the
transmission is being done the IR transmitter and the IR receiver (detector) both
should be in line of sight.
The IR receiver is connected to the 3rd pin, which is the input pin of the IC.
As the IR signal is transmitted into the free space and the IR receiver detects the
signal. In the free space as lot of noise signals are present; the IR signal will be
received with some noise signals. So in order to eliminate the noise signals a
capacitor is connected in between the IR receiver and the 3 rd pin of the 567-tone
decoder IC. And thus the IR received signal is fed to the IC, which will compare
the received frequency signal with that of the generated frequency. The I-phase
detector does this comparison and the output will be enabled when both the
frequencies matches i.e., transmitted frequency is equal to the received
frequency. And if the frequencies do not match the output will not be enabled.

When both the transmitted and the received frequencies are matched, the
I-phase detector enables the output pin of the 567-tone decoder i.e., the 8 th pin.
So when the output is enabled the output from the IC is a logic low signal. And if
the frequencies do not match, the output will not be enabled and the 8th pin will
logic high signal. This is due to the fact that at the 8 th pin internally a transistor is
present whose emitter is grounded and the collector pin the output 8 th pin. And if
the circuit of the 567-tone decoder is observed, we can see the supply i.e., Vcc is
connected to the output pin of the IC through a resistor.
When the frequencies match, the output will be enabled by which the
transistor will be conducting (ON) and the Vcc supply will grounded through the
transistor internally in the IC 567 Tone decoder itself. So a logic low signal will be
received. And the same way if frequencies do not match output will not enabled
by which the transistor will not be conducting (OFF) and the supply will be
coming from the output pin, which is the logic high signal.
When the IR sensors are connected facing each other, every time the
output of the tone decoder IC will be a logic low signal until no obstacle comes in
between the IR transmitter and the IR receiver. Unless any obstacle is present
the transmitted frequency will be continuously received by the receiver and
frequency will be matched with that of the generated ones and the output will be
enabled. So a logic low will be the output. And if obstacle comes in between the
sensors the IR receiver will not receive the signal and the tone decoder IC
checks the received frequency. As there is no received frequency the output will
not be enabled, thus a logic high signal is received.
If the sensors are placed side by side, the IR transmitter will be
transmitting the IR signal continuously and the receiver will receive the reflected
signal when there is any obstacle. So until there is no obstacle, the receiver will
not receive the IR signal, so the frequencies do not match and the output will not

be enabled. So the output of the 567-tone decoder will be a logic high signal. If
obstacle comes in front of the sensors, the IR signal will be reflected back which
will be observed by the IR receiver and feeds the signal to the tone decoder,
which checks the frequency with the generated ones and as both of them match
the output will be enabled by which the internal will be in ON state and the supply
will be grounded internally in the IC. So a logic low signal will be received from
the output of the 567-tone decoder IC. And to indicate whether the output of the
sensing circuit is a logic low signal or a logic high signal, a LED is connected at
the output pin of the 567-tone decoder IC. If the output is high LED will be in ON
state and LED will be in OFF state if the output is low.

ZIGBEE TECHNOLOGY
Here for wireless communication purpose we use Zigbee technology.
ZigBee is a wireless technology developed as an open global standard to
address the unique needs of low-cost, low-power, wireless sensor networks.
Zigbee is the set of specs built around the IEEE 802.15.4 wireless protocol.
As Zigbee is the upcoming technology in wireless field, we had tried to
demonstrate its way of functionality and various aspects like kinds, advantages
and disadvantages using a small application of controlling the any kind of
electronic devices and machines. The Zigbee technology is broadly adopted for
bulk and fast data transmission over a dedicated channel.
After the birth of wireless LAN and Bluetooth, new International shortdistance wireless standard technology of ZigBee has applied rapidly in our life
and recognized as core technology to bring Ubiquitous life in near future.
Overview
Introduction

Terminology used to describe International standard of wireless


communication

(sensor

and

control)

and

short-distance

wireless

communication.
ZigBee is one of short-distance wireless communication standard IEE
802.15.4 used for wireless networking range of 10~20 meters mainly by
home and offices and International wireless communication standard for
Ubiquitous computing.
Origin of word
Word ZigBee was originated from word ZigZag indicating cross-shaped
network cables and Bee to indicate economical communication method.
Word ZigBee was proposed and decided by committee members in early phase
of standard committee of ZigBee.
Introduction and characteristics
ZigBee consumes low electricity supply and can be configured to large
scale sensor networks by integrating with sensor (Activity, light, temperature and
humidity, etc) and transmitter/receiver devices. This type of structure is defined
as foundation technology for sensing, monitoring and controlling.

ZigBee has recognized as next generation short-distance wireless


communication standard based on strong advantages including lowest costs,
lowest energy consumption which can be last 2 years with 2 AA type batteries,
scalability of up to 65,000 nodes, simple network configuration and reliability from
immediate recovery function from data transmission errors. Especially, ZigBee
supports multi-hop function to ensure highest transmission success rates.

Applicable fields
ZigBee, unlike other wireless communication technology, consumes low
electricity power and inexpensive to implement. These advantages allow to be
applied diverse Ubiquitous environments including intelligent home networks,
automated commercial devices, building automation industry, commercial
automation, environment monitoring, toy and industries and telematics.

Zigbee is one of the wireless protocols based on the IEEE 802.15.4


standard for wireless personal area networks (WPANs). Zigbee is designed to
use in embedded applications requiring low data rates and low power
consumption. The benefits of using Zigbee technology is to make the design as
simple as possible, cost-effective, Robust (Ensuring a reliable solution in noisy
environments), low-power wireless connectivity, etc. One main advantage of
using this technology is to cover large areas with routers. As each Zigbee module
can send and receive data, the received data received from one point can be
transported to the third point as a mediator.
Zigbee is widely used in an industrial control, an embedded sensor, and a
building and home automation. XBee is one of the ZigBee modules from MaxStream. The XBee provides a user friendly interface, minimal power
consumption, and reliability of data transferring between the modules. Several
topics related to the ZigBee protocol such as a selection of the module, a basic
concept of the module operation, and the implantation of the module in this
project work will be discussed in the following chapters. The main advantage of
using Zigbee is that it is a transceiver (trans-receiver). So it can act as a
transmitter as well as receiver. In this project this is important to maintain
communication link between the guard trolley and the train to avoid accidents.

XBee/XBee-Pro RF Modules Pin Numbers

Pin Assignments for the XBee and XBee-Pro Modules

Microcontroller unit
The entire system described here utilizes two microcontroller units and
these units are playing dominant role in this project work. The main processing
unit is designed with 89C51, as this controller is having 4 Kb memory the main
program is dumped in to this chip. The data acquired from this module is
transmitted to the other controller through wireless technology Zigbee.
So the roles of microcontrollers are increasingly being used to implement
in communication systems. It is therefore important to understand Microcontroller
based systems well. Today, microcontrollers have become an integral part of all
digital communication systems. Dedicated system that use microcontrollers, have
certainly

improved

the

functional,

operational

and

performance

based

specifications. The architectural changes in instrumentation and control systems


where and are due to the computing and communication capability of the Micro
controller devices. Micro controller must be treated as a tool for computing and
communication. Knowledge of microcontrollers is meaning full and very
rewarding if it is applied to design a product that is useful in the industry or for the
society in general. This is a subject, which has direct relevance to industrial
product development and automation. In this project work, microcontrollers are
programmed to perform the function of encoding and decoding techniques, which
is essential for any digital communication system.
Micro-controllers are dedicated to one task and run one specific program.
The program is stored in ROM (read-only memory) and generally does not
change. If there are any modifications in the function, or errors in the software,
the existing program must be erased from the chip & again modified program
must be loaded in the chip through chip burner.

The controller used here is belongs to 8051 family architecture & often it is
referred to as MCS-51. This microcontroller is having an 8-bit data bus. In this
family some of the controllers are capable of addressing 64K of program memory
and a separate 64K of data memory. The 8051 has 4K of code memory
implemented as on-chip Read Only Memory (ROM). The 8051 has 128 bytes of
internal Random Access Memory (RAM). The 8051 has two timer/counters, a
serial port, 4 general purpose parallel input/output ports, and interrupt control
logic with five sources of interrupts. Besides internal RAM, the 8051 has various
Special Function Registers (SFR), which are the control and data registers for
on-chip facilities. The SFRs also include the accumulator, the B register, and the
Program Status Word (PSW), which contains the CPU flags. Programming the
various internal hardware facilities of the 8051 is achieved by placing the
appropriate control words into the corresponding SFRs.
As stated, the 8051 can address 64K of external data memory and 64K of
external program memory. These may be separate blocks of memory, so that up
to 128K of memory can be attached to the microcontroller. Separate blocks of
code and data memory are referred to as the Harvard architecture. The 8051 has
two separate read signals, RD# and PSEN#. The first is activated when a byte is
to be read from external data memory, the other, from external program memory.
Both of these signals are so-called active low signals. That is, they are cleared to
logic level 0 when activated. All external code is fetched from external program
memory. In addition, bytes from external program memory may be read by
special read instructions such as the MOVC instruction. There are separate
instructions to read from external data memory, such as the MOVX instruction.
That is, the instructions determine which block of memory is addressed, and the
corresponding control signal, either RD# or PSEN# is activated during the
memory read cycle. A single block of memory may be mapped to act as both
data and program memory. This is referred to as the Von Neumann1 architecture.

In order to read from the same block using either the RD# signal or the PSEN#
signal, the two signals are combined with a logic AND operation. This way, the
output of the AND gate is low when either input is low. The advantage of the
Harvard architecture is not simply doubling the memory capacity of the
microcontroller. Separating program and data increases the reliability of the
microcontroller, since there are no instructions to write to the program memory. A
ROM device is ideally suited to serve as program memory. The Harvard
architecture is somewhat awkward in evaluation systems, where code needs to
be loaded into program memory. By adopting the Von Neumann architecture,
code may be written to memory as data bytes, and then executed as program
instructions.
The 8052 has 256 bytes of internal RAM and 8K of internal code ROM.
The 8051 and 8052 internal ROM cannot be programmed by the user. The user
must supply the program to the manufacturer, and the manufacturer programs
the microcontrollers during production. Due to the setup costs, the factory
masked ROM option is not economical for small quantity productions. The 8751
and 8752 are the Erasable Programmable Read Only Memory (EPROM)
versions of the 8051 and 8052. Many manufacturers offer the EPROM versions
in windowed ceramic and non-windowed plastic packages. These are user
programmable. However, the non-windowed versions cannot be erased. These
are usually referred to as One-Time- Programmable (OTP) microcontrollers,
which are more suitable for experimental work or for small production runs. The
8951 and 8952 contain FLASH EEPROMs (Electrically Erasable Programmable
Read Only Memory). These chips can be programmed as the EPROM versions,
using a chip programmer. Moreover, the memory may be erased. Similar to
EPROMs, Erasing FLASH memory sets all data bits (data bytes become FFh). A
bit may be cleared (made 0) by programming. However, a zero bit may not be
programmed to a one. This requires erasing the chip. Some larger FLASH

memories are organized in banks or sectors. Rather than erasing the entire chip,
you may erase a given sector and keep the remaining sectors unchanged.
During the past decade, many manufacturers introduced enhanced
members of the 8051 microcontroller. The enhancements include more memory,
more ports, analog to - digital converters, more timers with compare, reload
and capture facilities, more interrupt sources, higher precision multiply and divide
units, idle and power down mode support, watchdog timers, and network
communication subsystems. All microcontroller of the family use the same set of
machine instructions, the MCS-51. The enhanced features are programmed and
controlled by additional SFRs. In the remainder of this chapter, the hardware
architecture of the 8051 is presented. The enhancements brought by the 8052
and 80C515 follow. The reader is referred to the manufacturers' data books for
the specifics of other enhanced members.

LCD DISPLAY
The LCD panel used in the project work is aimed to display the information
that is generated by the PC keyboard. The LCD used here is having two rows
and each row contains 16 characters, depending up on the availability of LCD
panel 3 lines or 4 lines panels can be used for the purpose, so that more
information can be displayed simultaneously. LCD Displays are dominating LED
displays, because these displays can display alphabets, numbers and some kind
of special symbols, where as LEDs (seven segment display) can display only
numbers. These LCD displays are very useful for displaying user information and
communication. LCD displays are available in various formats. Most common
are 2 x 16, is that two lines with 16 alphanumeric characters. Other formats are
3x16, 2x40, 3x40 etc;

In recent years LCD is finding widespread use replacing LEDs, because of


the ability to display numbers, characters, and graphics. Another advantage is,
because of its compactness and ease of programming for characters and
graphics, more information in the form of text message or graphics can be
displayed. Generally, the LCD modules have an 8-bit interface, besides the 8-bit
data bus; the interface has a few other control lines. The 8-bit data bus is
connected to port 0 and the control lines are connected to port 2. The default
data transfer between the LCD module and an external device is 8-bits, however
it is possible to communicate with the LCD module using only four of the 8-data
lines. The R/W line is connected to ground and hence the processor cannot read
any status information from the LCD module, but can only write data to the LCD.
The LCD panel used in this project work is having 16 pins. The function of
each pin description with table is provided in the next page:

The following is the circuit diagram of LCD that is interfaced with 89C51
microcontroller.

Pin No.

Name

Description

Pin no. 1

D7

Data bus line 7 (MSB)

Pin no. 2

D6

Data bus line 6

Pin no. 3

D5

Data bus line 5

Pin no. 4

D4

Data bus line 4

Pin no. 5

D3

Data bus line 3

Pin no. 6

D2

Data bus line 2

Pin no. 7

D1

Data bus line 1

Pin no. 8

D0

Data bus line 0 (LSB)

Pin no. 9

EN1

Pin no. 10

R/W

Enable signal for row 0 and 1


(1 controller)
st

0 = Write to LCD module

1 = Read from LCD module


Pin no. 11

RS

0 = Instruction input
1 = Data input

Pin no. 12 VEE

Contrast adjust

Pin no. 13 VSS

Power supply (GND)

Pin no. 14 VCC

Power supply (+5V)

Pin no. 15 EN2


Pin no. 16 NC

Enable signal for row 2 and 3


(2 controller)
nd

Not Connected

Vcc, Vss, and VEE: While Vcc and Vss provide +5V and ground,
respectively; VEE is used for controlling LCD contrast.
RS - register select:
There are two very important registers inside the LCD. The RS pin is used
for their selection as follows. If RS = 0, the instruction command code register is
selected, allowing the user to send a command such as clear display, cursor at
home, etc. If RS = 1 the data register is selected, allowing the user to send data
to be displayed on the LCD.
R/W - read/write:
R/W input allows the user to write information to the LCD or read
information from it. R/W = 1 when reading; R/W =0 when writing.
E - Enable:
The enable pin is used by the LCD to latch information presented to its
data pins. When data is supplied to data pins, a high to low pulse must be

applied to this pin in order for the LCD to latch in the data present at the data
pins. This pulse must be a minimum of 450 ns wide.
D0 D7: The 8 bit data pins, D0 D7, are used to send information to the
LCD or read the contents of the LCDs internal registers. To display letters and
numbers, we send ASCII codes for the letters A Z, a z, and numbers 0 9 to
these pins while making RS = 1. There are also instructions command codes that
can be sent to the LCD to clear the display or force the cursor to the home
position or blink the cursor. Table below lists the instruction command codes.

DC Motor
DC motors are widely used, inexpensive, small and poweful for their size.
They are most easy to control. One DC motor requires only two singals for its
operation. They are non-polarized, means you can reverse the voltage without
any damage to motor. DC motors have +ve and ve leads. Connecting them to a
DC voltage source moves motor in one direction (clockwise) and by reversing the
polarity, the DC motor will move in opposite direction (counter clockwise). The
maximum speed of DC motor is specified in rpm (rotation per minute). It has two
rpms: no load and loaded. The rpm is reduces when moving a load or decreases
when load increases. Other specifications of DC motors are voltage and current
ratings. Below table shows the specifications of the motor used in the project.
Operating Voltage

12V DC

Operating Current

150 milli
Amps

Speed

30 RPM

DC Motor Specifications

Speed of the motor can be changed by changing the applied voltage


across motor. DC motors dont have enough torque to drive the mechanism
directly by connecting mechanism with it. The motor driving circuit is designed
with L293D chip; this is popularly known as H bridge device generally used to
drive the low power DC motors.To drive these two motors independently in both
directions, drive sequence is programmed depending up on the information
gathered from the sensors.

RELAY
A relay is an electrical switch that opens and closes under the control of
another electrical circuit. In the original form, the switch is operated by an
electromagnet to open or close one or many sets of contacts. These contacts
can be either Normally Open (NO), Normally Closed (NC), or changeover contacts. A relay is able to control an output circuit of higher power than
the input circuit, it can be considered to be, in a broad sense, a form of an
electrical

amplifier.

So

relay

can

be

defined

as

an

automatic

electromagnetic/electronic switch, which can be used to make or break the


circuit. In this project a relay are used to control the drilling motor to dig a hole on
the surface of the soil.
Normally-open contacts connect the circuit when the relay is
activated; the circuit is disconnected when the relay is inactive. It is
also called Form A contact or "make" contact. Form A contact is ideal
for applications that require to switch a high-current power source from
a remote device.
Normally-closed contacts disconnect the circuit when the relay is
activated; the circuit is connected when the relay is inactive. It is also
called Form B contact or "break" contact. Form B contact is ideal for

applications that require the circuit to remain closed until the relay is
activated.
Change-over contacts control two circuits: one normally-open
contact and one normally-closed contact with a common terminal. It is
also called Form C contact.
The electromagnetic relay, one of mankinds first electrical device, was
used practically in telegraphy as early as 1850. The modern relay, properly
applied, is one of the most simple, effective and dependable component
available. In the majority of instances, it can achieve better reliability at lesser
cost than an equivalent solid-state complex type of relay. The term relay was
used for the first time to describe an invention made by Samuel Morse in 1836.
The device invented by Morse was a Telegraph Amplifying Electromagnetic
Device which enabled a small current flowing in a coil to switch on a large
current in another circuit and thus helped in relay of signals.

OPERATION
The relay used in this project work is electromagnetic relay.

The

electromagnetic relay is basically a switch (or a combination of switches)


operated by the magnetic force generated by a current flowing through a coil.
Essentially, it consists of four parts: an electromagnet comprising a coil and a
magnetic circuit, a movable armature, a set of contacts and a frame to mount all
these components. However, very wide ranges of relays have been developed to
meet the requirements of the industry. This relay is nothing but a switch, which
operates electromagnetically. It opens or closes a circuit when current through
the coil is started or stopped. When the coil is energized armature is attracted by
the electromagnet and the contacts are closed.

The construction of the typical relay contains a code surrounded by a coil


of copper wire. The core is mounted on a metal frame. The movable part of the
relay is called armature. When a voltage is applied to the coil terminals, the
current flowing through the coil produces a magnetic field in the core. In other
words, the core acts as an electromagnet and attracts the metal armature. On
removing the voltage the spring attached to the armature returns the armature to
its original position. In this position, there is a small air-gap in the magnetic path.
Hence, more power is needed to pull in the armature than that needed to keep it
held in the attracted position.

CHAPTER 5

BRIEF DESCRIPTION ABOUT ZIGBEE TECHNOLOGY


Introduction
When we hold the TV remote and wish to use it we have to necessarily
point our control at the device. This one-way, line-of-sight, short-range
communication uses infrared (IR) sensors to enable communication and control
and it is possible to operate the TV remotely only with its control unit.
Add other home theatre modules, an air- conditioner and remotely enabled
fans and lights to our room, and we become a juggler who has to handle not only
these remotes, but also more numbers that will accompany other home
appliances we are likely to use.
Some remotes do serve to control more than one device after
memorizing' access codes, but this interoperability is restricted to LOS, that too
only for a set of related equipment, like the different units of a home
entertainment system
Now picture a home with entertainment units, security systems including
fire alarm, smoke detector and burglar alarm, air-conditioners and kitchen
appliances all within whispering distance from each other and imagine a single
unit that talks with all the devices, no longer depending on line-of-sight, and
traffic no longer being one-way.
This means that the devices and the control unit would all need a common
standard to enable intelligible communication. ZIGBEE is such a standard for

embedded application software and has been ratified in late 2004 under IEEE
802.15.4 Wireless Networking Standards.
ZIGBEE is an established set of specifications for wireless personal area
networking (WPAN), i.e., digital radio connections between computers and
related devices. This kind of network eliminates use of physical data buses like
USB and Ethernet cables. The devices could include telephones, hand-held
digital assistants, sensors and controls located within a few meters of each other.
ZIGBEE is one of the global standards of communication protocol
formulated by the relevant task force under the IEEE 802.15 working group. The
fourth in the series, WPAN Low Rate/ZIGBEE is the newest and provides
specifications for devices that have low data rates, consume very low power and
are thus characterized by long battery life.
Other standards like Blue tooth and IrDA address high data rate
applications such as voice, video and LAN communications.
The ZIGBEE Alliance has been set up as an association of companies
working together to enable reliable, cost-effective, low-power, wirelessly
networked, monitoring and control products based on an open global standard.
Once a manufacturer enrolls in this Alliance for a fee, he can have access
to the standard and implement it in his products in the form of ZIGBEE chipsets
that would be built into the end devices. Philips, Motorola, Intel, HP are all
members of the Alliance. The goal is to provide the consumer with ultimate
flexibility, mobility, and ease of use by building wireless intelligence and
capabilities into every day devices.

ZIGBEE technology will be embedded in a wide range of products and


applications across consumer, commercial, industrial and government markets
worldwide. For the first time, companies will have a standards-based wireless
platform optimized for the unique needs of remote monitoring and control
applications, including simplicity, reliability, low-cost and low-power.
The target networks encompass a wide range of devices with low data
rates in the Industrial, Scientific and Medical (ISM) radio bands, with buildingautomation controls like intruder/fire alarms, thermostats and remote (wireless)
switches, video/audio remote controls likely to be the most popular applications.
So far sensor and control devices have been marketed as proprietary
items for want of a standard. With acceptance and implementation of ZIGBEE,
interoperability will be enabled in multi-purpose, self-organizing mesh networks.
ZigBee is a wireless technology developed as an open global standard to
address the unique needs of low-cost, low-power, wireless sensor networks.
Zigbee is the set of specs built around the IEEE 802.15.4 wireless protocol.

As Zigbee is the upcoming technology in wireless field, we had tried to


demonstrate its way of functionality and various aspects like kinds, advantages
and disadvantages using a small application of controlling the any kind of
electronic devices and machines. The Zigbee technology is broadly adopted for
bulk and fast data transmission over a dedicated channel.

Architecture

Though WPAN implies a reach of only a few meters, 30 feet in the case of
ZIGBEE, the network will have several layers, so designed as to enable
interpersonal communication within the network, connection to a network of
higher level and ultimately an uplink to the Web.
The ZIGBEE Standard has evolved standardized sets of solutions, called
layers'. These layers facilitate the features that make ZIGBEE very attractive:
low cost, easy implementation, reliable data transfer, short-range operations,
Very low power consumption and adequate security features.

Network and Application Support layer


The network layer permits growth of network sans high power transmitters.
This layer can handle huge numbers of nodes. This level in the ZIGBEE
architecture includes the ZIGBEE Device Object (ZDO), user-defined application
profile(s) and the Application Support (APS) sub-layer.
The APS sub-layer's responsibilities include maintenance of tables that
enable matching between two devices and communication among them, and
also discovery, the aspect that identifies other devices that operate in the
operating space of any device.
The responsibility of determining the nature of the device (Coordinator /
FFD or RFD) in the network, commencing and replying to binding requests and
ensuring a secure relationship between devices rests with the ZDO (ZIGBEE
Define Object). The user-defined application refers to the end device that
conforms to the ZIGBEE Standard.

Physical (PHY) layer

The IEEE802.15.4 PHY physical layer accommodates high levels of


integration by using direct sequence to permit simplicity in the analog circuitry
and enable cheaper implementations.

Media Access Control (MAC) layer


The IEEE802.15.4 MAC media access control layer permits use of several
topologies without introducing complexity and is meant to work with large
numbers of devices.

Figure: ZIGBEE Stack Architecture

Device Types
There are three different ZIGBEE device types that operate on these layers
in any self-organizing application network. These devices have 64-bit IEEE
addresses, with option to enable shorter addresses to reduce packet size, and
work in either of two addressing modes star and peer-to-peer.

The ZIGBEE coordinator node: There is one, and only one, ZIGBEE
coordinator in each network to act as the router to other networks, and can
be likened to the root of a (network) tree. It is designed to store information
about the network.
The full function device FFD: The FFD is an intermediary router
transmitting data from other devices. It needs lesser memory than the
ZIGBEE coordinator node, and entails lesser manufacturing costs. It can
operate in all topologies and can act as a coordinator.
The reduced function device RFD: This device is just capable of talking in
the network; it cannot relay data from other devices. Requiring even less
memory, (no flash, very little ROM and RAM), an RFD will thus be cheaper
than an FFD. This device talks only to a network coordinator and can be
implemented very simply in star topology.

Zigbee Characteristics
The focus of network applications under the IEEE 802.15.4 / ZIGBEE
standard include the features of low power consumption, needed for only two
major modes (Tx/Rx or Sleep), high density of nodes per network, low costs and
simple implementation.
2.4GHz and 868/915 MHz dual PHY modes. This represents three licensefree bands:
2.4- 2.4835 GHz, 868-870 MHz and 902-928 MHz The number of channels
allotted to each frequency band is fixed at sixteen (numbered 11-26), one
(numbered 0) and ten (numbered 1-10) respectively.
The higher frequency band is applicable worldwide, and the lower band in the
areas of North America, Europe, Australia and New Zealand.

Low power consumption, with battery life ranging from months to years.
Considering the number of devices with remotes in use at present, it is easy
to see that more numbers of batteries need to be provisioned every so often,
entailing regular (as well as timely), recurring expenditure.
In the ZIGBEE standard, longer battery life is achievable by either of two
means: continuous network connection and slow but sure battery drain, or
intermittent connection and even slower battery drain.
Maximum data rates allowed for each of these frequency bands are fixed as
250 kbps @2.4 GHz, 40 kbps @ 915 MHz, and 20 kbps @868MHz.
High throughput and low latency for low duty-cycle applications (<0.1%)
Channel access using Carrier Sense Multiple Access with Collision
Avoidance
(CSMA - CA)
Addressing space of up to 64 bit IEEE address devices, 65,535 networks
50m typical range
Fully reliable hand shaked data transfer protocol.
Different topologies as illustrated below: star, peer-to-peer, mesh

Figure: ZIGBEE Topologies

Traffic Types
ZIGBEE /IEEE 802.15.4 addresses three typical traffic types. IEEE
802.15.4 MAC can accommodate all the types.
Data is periodic is The application dictates the rate, and the sensor
activates, checks for data and deactivates.
Data is intermittent is The application, or other stimulus, determines the
rate, as in the case of say smoke detectors. The device needs to connect to
the network only when communication is necessitated. This type enables
optimum saving on energy.
Data is repetitive, and the rate is fixed a priori. Depending on allotted time
slots, called GTS (guaranteed time slot), devices operate for fixed
durations.
ZIGBEE employs either of two modes, beacon or non-beacon to enable
the to-and-fro data traffic. Beacon mode is used when the coordinator runs on
batteries and thus offers maximum power savings, whereas the non-beacon
mode finds favor when the coordinator is mains powered. In the beacon mode, a
device watches out for the coordinator's beacon that gets transmitted at
periodically, locks on and looks for messages addressed to it.
If message transmission is complete, the coordinator dictates a schedule
for the next beacon so that the device goes to sleep'; in fact, the coordinator
itself switches to sleep mode.

Network Model

The functions of the Coordinator, which usually remains in the receptive


mode, encompass network set-up, beacon transmission, node management,
storage of node information and message routing between nodes.
The network node, however, is meant to save energy (and so sleeps' for
long periods) and its functions include searching for network availability, data
transfer, checks for pending data and queries for data from the coordinator.

Figure : ZIGBEE Network Model


For the sake of simplicity without jeopardizing robustness, this particular
IEEE standard defines a quartet frame structure and a super-frame structure
used optionally only by the coordinator.
The four frame structures are
Beacon frame for transmission of beacons
Data frame for all data transfers
Acknowledgement frame for successful frame receipt confirmations
MAC command frame

These frame structures and the coordinator's super-frame structure play


critical roles in security of data and integrity in transmission.
All protocol layers contribute headers and footers to the frame structure,
such that the total overheads for each data packet range are from 15 octets (for
short addresses) to 31 octets (for 64-bit addresses).
The coordinator lays down the format for the super-frame for sending
beacons after every 15.38 ms or/and multiples thereof, up to 252s.
This interval is determined a priori and the coordinator thus enables
sixteen time slots of identical width between beacons so that channel access is
contention-less. Within each time slot, access is contention-based. Nonetheless,
the coordinator provides as many as seven GTS (guaranteed time slots) for
every beacon interval to ensure better quality.

Technology Comparisons
The Why ZIGBEE question has always had an implied, but never quite
worded follower phrase when there is Blue tooth. A comparative study of the
two can be found in ZIGBEE 'Wireless Control That Simply Works.
The bandwidth of Blue tooth is 1 Mbps; ZIGBEE is one-fourth of this value.
The strength of Blue tooth lies in its ability to allow interoperability and
replacement of cables, ZIGBEE, of course, is low costs and long battery life.

In terms of protocol stack size, ZIGBEE 32 KB is about one-third of the


stack size necessary in other wireless technologies (for limited capability end
devices, the stack size is as low as 4 KB).
Most important in any meaningful comparison are the diverse application
areas of all the different wireless technologies. Blue tooth is meant for such
target areas as wireless USB's, handsets and headsets, whereas ZIGBEE is
meant to cater to the sensors and remote controls market and other battery
operated products.
In a gist, it may be said that they are neither complementary standards
nor competitors, but just essential standards for different targeted applications.
The earlier Blue tooth targets interfaces between PDA and other device (mobile
phone / printer etc) and cordless audio applications.
The IEEE 802.15.4based ZIGBEE is designed for remote controls and
sensors, which are very many in number, but need only small data packets and,
mainly, extremely low power consumption for (long) life. Therefore they are
naturally different in their approach to their respective application arenas.

ZIGBEE Applications
The ZIGBEE Alliance targets applications "across consumer, commercial,
industrial and government markets worldwide".
Unwired applications are highly sought after in many networks that are
characterized by numerous nodes consuming minimum power and enjoying long
battery lives.

ZIGBEE technology is designed to best suit these applications, for the


reason that it enables reduced costs of development, very fast market adoption,
and rapid ROI.
AIRBEE Wireless Inc has tied up with Radio crafts AS to deliver "out-ofthe-box"ZIGBEE ready solutions, the former supplying the software and the latter
making the module platforms. With even light controls and thermostat producers
joining the ZIGBEE Alliance, the list is growing healthily and includes big OEM
names like HP, Philips, Motorola and Intel.
With ZIGBEE designed to enable two-way communications, not only will
the consumer be able to monitor and keep track of domestic utilities usage, but
also feed it to a computer system for data analysis.
A recent analyst report issued by West Technology Research Solutions
estimates that by the year 2008, "annual shipments for ZIGBEE chipsets into the
home automation segment alone will exceed 339 million units," and will show up
in "light switches, fire and smoke detectors, thermostats, appliances in the
kitchen, video and audio remote controls, landscaping, and security systems."

CHAPTER 6

DESCRIPTION ABOUT MICRO CONTROLLERS

INTRODUCTION
A Micro controller consists of a powerful CPU tightly coupled with memory,
various I/O interfaces such as serial port, parallel port timer or counter, interrupt
controller, data acquisition interfaces-Analog to Digital converter, Digital to Analog
converter, integrated on to a single silicon chip. If a system is developed with a
microprocessor, the designer has to go for external memory such as RAM, ROM,
EPROM and peripherals.
But controller is provided all these facilities on a single chip. Development
of a Micro controller reduces PCB size and cost of design. One of the major
differences between a Microprocessor and a Micro controller is that a controller
often deals with bits not bytes as in the real world application.
Intel has introduced a family of Micro controllers called the MCS-51.The
microcontroller plays the major role in any embedded project. In this my project
we use two microcontrollers they are made by the ATMEL Company. That is
AT89S52.

NECESSITY OF MICROCONTROLLERS
Microprocessors brought the concept of programmable devices and
made many applications of intelligent equipment. Most applications, which do not
need large amount of data and program memory, tended to be costly.

The microprocessor system had to satisfy the data and program


requirements so; sufficient RAM and ROM are used to satisfy most
applications .The peripheral control equipment also had to be satisfied.
Therefore, almost all-peripheral chips were used in the design. Because of these
additional peripherals cost will be comparatively high.
An example:
8085 chip needs:
An Address latch for separating address from multiplex address and
data.32-KB RAM and 32-KB ROM to be able to satisfy most applications. As also
Timer / Counter, Parallel programmable port, Serial port, and Interrupt controller
are needed for its efficient applications.
In comparison a typical Micro controller 8051 chip has all that the 8051 board has
except a reduced memory as follows.
4K bytes of ROM as compared to 32-KB, 128 Bytes of RAM as compared to 32KB.
Bulky
On comparing a board full of chips (Microprocessors) which is bulky with
one chip with all components in it (Micro controller) which is very simple.
Debugging
Lots of Microprocessor circuitry and program to debug. In Micro controller
there is no Microprocessor circuitry to debug.

Slower Development time


As we have observed Microprocessors need a lot of debugging at board
level and at program level, whereas, Micro controller do not have the excessive
circuitry and the built-in peripheral chips are easier to program for operation.
So peripheral devices like Timer/Counter, Parallel programmable port,
Serial Communication Port, Interrupt controller and so on, which were most often
used were integrated with the Microprocessor to present the Micro controller
.RAM and ROM also were integrated in the same chip. The ROM size was
anything from 256 bytes to 32Kb or more. RAM was optimized to minimum of 64
bytes to 256 bytes or more.

Typical Micro controller has all the following features


8/16/32 CPU
Instruction set rich in I/O & bit operations.
One or more I/O ports.
One or more timer/counters.
One or more interrupt inputs and an interrupt controller
One or more serial communication ports.
Analog to Digital /Digital to Analog converter
One or more PWM output
Network controlled interface

ADVANTAGES OF MICRO CONTROLLERS


1. If system is developed with a microprocessor, the designer has to go for
external memory such as RAM, ROM or EPROM and peripherals and hence the

size of PCB will be large enough to hold all the required peripherals. But, the
micro controller has got all this peripheral facility on a single chip o development
of a similar system with a micro controller reduces PCB size and cost of the
design.
2. One of the major differences between a micro controller and a microprocessor
is that a controller often deals with bits, not bytes as in the real world application,
for example switch contacts can only be open or close, indicators should be lit or
dark and motors can be either turned on or off and so forth.
The system requirements and control specifications clearly rule out the use
of 16, 32 or 64 bit micro controllers or microprocessors. Systems using these
may be earlier to implement due to large number of internal features. They are
also faster and more reliable but, the above application is satisfactorily served by
8-bit micro controller. Using an inexpensive 8-bit Microcontroller will doom the 32bit product failure in any competitive market place.
Coming to the question of why to use P89V51RD2 of all the 8-bit
Microcontroller available in the market the main answer would be because it has
64 kB Flash and 1024 bytes of data RAM. . The Flash program memory supports
both parallel programming and in serial In-System Programming (ISP). The
P89V51RD2 is also In-Application Programmable (IAP), allowing the Flash
program memory to be reconfigured even while the application is running.
The generic 8051 architecture supports a Harvard architecture, which
contains two separate buses for both program and data. So, it has two distinctive
memory spaces of 64K X 8 size for both programmed and data.
It is based on an 8 bit central processing unit with an 8 bit Accumulator
and another 8 bit B register as main processing blocks. Other portions of the
architecture include few 8 bit and 16 bit registers and 8 bit memory locations.

FEATURES OF 8051 ARCHITECTURE


Optimized 8 bit CPU for control applications and extensive Boolean
processing capabilities.
64K Program Memory address space.
64K Data Memory address space.
128 bytes of on chip Data Memory.
32 Bi-directional and individually addressable I/O lines.
Two 16 bit timer/counters.
Full Duplex UART.
6-source / 5-vector interrupt structure with priority levels.
On chip clock oscillator.
Now we may be wondering about the non-mentioning of memory
space meant for the program storage, the most important part of any
embedded controller. Originally this 8051 architecture was introduced with
on-chip, one time programmable version of Program Memory of size 4K
X 8.
Intel delivered all these microcontrollers (8051) with users program
fused inside the device. The memory portion was mapped at the lower
end of the Program Memory area. But, after getting devices, customers
couldnt change anything in their program code, which was already made
available inside during device fabrication.

8051 micro controller architecture


The 8051 architecture consists of these specific features:
Eight bit CPU with registers A (the accumulator) and B
Sixteen-bit program counter (PC) and data pointer (DPTR)
Eight- bit stack pointer (PSW)
Eight-bit stack pointer (Sp)
Internal ROM or EPROM (8751) of 0(8031) to 4K (8051)
Internal RAM of 128 bytes:
1. Four register banks, each containing eight registers
2. Sixteen bytes, which may be addressed at the bit level
3. Eighty bytes of general- purpose data memory
Thirty two input/output pins arranged as four 8-bit ports:p0-p3
Two 16-bit timer/counters: T0 and T1
Full duplex serial data receiver/transmitter: SBUF
Control registers: TCON, TMOD, SCON, PCON, IP, and IE
Two external and three internal interrupts sources.
Oscillator and clock circuits.

PIN DIAGRAM

PIN DIAGRAM OF 89C51 IC

FUNCTIONAL BLOCK DIAGRAM OF MICROCONTROLLER

Functional block diagram of micro controller

Port Pin Alternate Function: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)

VCC: -Supply voltage


VSS: -Circuit ground potential
All four ports in the 89C51 are bidirectional. Each consists of a latch
(Special Function Registers P0 through P3), an output driver, and an input buffer.
The output drivers of Ports 0 and 2, and the input buffers of Port 0, are used in
accesses to external memory. In this application, Port 0 outputs the low byte of
the external memory address, time-multiplexed with the byte being written or
read. Port 2 outputs the high byte of the external memory address when the
address is 16 bits wide. Otherwise, the Port 2 pins continue to emit the P2 SFR
content.
All the Port 3 pins are multifunctional. They are not only port pins, but also
serve the functions of various special features as listed below:
Port Pin

Alternate Function

P3.0

RxD (serial input port)

P3.1

TxD (serial output port)

P3.2

INT0 (external interrupt)

P3.3

INT1 (external interrupt)

P3.4

T0 (Timer/Counter 0 external input)

P3.5

T1 (Timer/Counter 1 external input)

P3.6

WR (external Data Memory write strobe)

P3.7

RD (external Data Memory read strobe)

The 8051 Oscillator and Clock

The heart of the 8051 circuitry that generates the clock pulses by which all
the internal all internal operations are synchronized. Pins XTAL1 And XTAL2 is
provided for connecting a resonant network to form an oscillator. Typically a
quartz crystal and capacitors are employed. The crystal frequency is the basic
internal clock frequency of the microcontroller. The manufacturers make 8051
designs that run at specific minimum and maximum frequencies typically 1 to 16
MHz.

Oscillator and timing circuit

Types of memory
The 8051 have three general types of memory. They are on-chip memory,
external Code memory and external Ram. On-Chip memory refers to physically
existing memory on the micro controller itself. External code memory is the code
memory that resides off chip. This is often in the form of an external EPROM.

External RAM is the Ram that resides off chip. This often is in the form of
standard static RAM or flash RAM.

Code memory
Code memory is the memory that holds the actual 8051 programs that is to
be run. This memory is limited to 64K. Code memory may be found on-chip or
off-chip. It is possible to have 4K of code memory on-chip and 60K off chip
memory simultaneously. If only off-chip memory is available then there can be
64K of off chip ROM. This is controlled by pin provided as EA.

Internal RAM
The 8051 have a bank of 128 bytes of internal RAM. The internal RAM is
found on-chip. So it is the fastest Ram available. And also it is most flexible in
terms of reading and writing. Internal Ram is volatile, so when 8051 is reset, this
memory is cleared. 128 bytes of internal memory are subdivided. The first 32
bytes are divided into 4 register banks. Each bank contains 8 registers. Internal
RAM also contains 128 bits, which are addressed from 20h to 2Fh. These bits
are bit addressed i.e. each individual bit of a byte can be addressed by the user.
They are numbered 00h to 7Fh. The user may make use of these variables with
commands such as SETB and CLR.

Special Function registered memory


Special function registers are the areas of memory that control specific
functionality of the 8051 micro controller.
Accumulator (0E0h)
As its name suggests, it is used to accumulate the results of large no of
instructions. It can hold 8 bit values.

B register (0F0h)
The B register is very similar to accumulator. It may hold 8-bit value. The b
register is only used by MUL AB and DIV AB instructions. In MUL AB the higher
byte of the product gets stored in B register. In div AB the quotient gets stored in
B with the remainder in A.

Stack pointer (81h)


The stack pointer holds 8-bit value. This is used to indicate where the next
value to be removed from the stack should be taken from. When a value is to be
pushed onto the stack, the 8051 first stores the value of SP and then store the
value at the resulting memory location. When a value is to be popped from the
stack, the 8051 returns the value from the memory location indicated by SP and
then decrements the value of SP.

Data pointer
The SFRs DPL and DPH work together work together to represent a 16-bit
value called the data pointer. The data pointer is used in operations regarding
external RAM and some instructions code memory. It is a 16-bit SFR and also
an addressable SFR.

Program counter
The program counter is a 16 bit register, which contains the 2 byte
address, which tells the 8051 where the next instruction to execute to be found
in memory. When the 8051 is initialized PC starts at 0000h. And is incremented
each time an instruction is executes. It is not addressable SFR.

PCON (power control, 87h)

The power control SFR is used to control the 8051s power control modes.
Certain operation modes of the 8051 allow the 8051 to go into a type of sleep
mode which consumes much less power.

PCON
REGISTER

TCON (timer control, 88h)


The timer control SFR is used to configure and modify the way in which the
8051s two timers operate. This SFR controls whether each of the two timers is
running or stopped and contains a flag to indicate that each timer has
overflowed. Additionally, some non-timer related bits are located in TCON SFR.
These bits are used to configure the way in which the external interrupt flags are
activated, which are set when an external interrupt occurs.

TCON REGISTERS

TMOD (Timer Mode, 89h)


The timer mode SFR is used to configure the mode of operation of each of
the two timers. Using this SFR your program may configure each timer to be a
16-bit timer, or 13 bit timer, 8-bit auto reload timer, or two separate timers.
Additionally you may configure the timers to only count when an external pin is
activated or to count events that are indicated on an external pin.

TMOD

TO (Timer 0 low/high, address 8A/8C h)


These two SFRs taken together represent timer 0. Their exact behavior
depends on how the timer is configured in the TMOD SFR; however, these
timers always count up. What is configurable is how and when they increment in
value.

T1 (Timer 1 Low/High, address 8B/ 8D h)


These two SFRs, taken together, represent timer 1. Their exact behavior
depends on how the timer is configured in the TMOD SFR; however, these
timers always count up.

P0 (Port 0, address 90h, bit addressable)


This is port 0 latch. Each bit of this SFR corresponds to one of the pins on
a micro controller. Any data to be outputted to port 0 is first written on P0
register. For e.g., bit 0 of port 0 is pin P0.0, bit 7 is pin p0.7. Writing a value of 1
to a bit of this SFR will send a high level on the corresponding I/O pin whereas a
value of 0 will bring it to low level.

P1 (port 1, address 90h, bit addressable)


This is port latch1. Each bit of this SFR corresponds to one of the pins on
a micro controller. Any data to be outputted to port 0 is first written on P0
register. For e.g., bit 0 of port 0 is pin P1.0, bit 7 is pin P1.7. Writing a value of 1

to a bit of this SFR will send a high level on the corresponding I/O pin whereas a
value of 0 will bring it to low level.

P2 (port 2, address 0A0h, bit addressable)


This is a port latch2. Each bit of this SFR corresponds to one of the pins
on a micro controller. Any data to be outputted to port 0 is first written on P0
register. For e.g., bit 0 of port 0 is pin P2.0, bit 7 is pin P2.7. Writing a value of 1
to a bit of this SFR will send a high level on the corresponding I/O pin whereas a
value of 0 will bring it to low level.

P3 (port 3, address B0h, bit addressable)


This is a port latch3. Each bit of this SFR corresponds to one of the pins
on a micro controller. Any data to be outputted to port 0 is first written on P0
register. For e.g., bit 0 of port 0 is pin P3.0, bit 7 is pin P3.7. Writing a value of 1
to a bit of this SFR will send a high level on the corresponding I/O pin whereas a
value of 0 will bring it to low level.

IE (interrupt enable, 0A8h)


The Interrupt Enable SFR is used to enable and disable specific
interrupts. The low 7 bits of the SFR are used to enable/disable the specific
interrupts, where the MSB bit is used to enable or disable all the interrupts. Thus,
if the high bit of IE is 0 all interrupts are disabled regardless of whether an
individual interrupt is enabled by setting a lower bit.

IE Registers

IP (Interrupt Priority, 0B8h)


The interrupt priority SFR is used to specify the relative priority of each
interrupt. On 8051 an interrupt may be either low or high priority. An interrupt may
interrupt interrupts. For e.g., if we configure all interrupts as low priority other
than serial interrupt. The serial interrupt always interrupts the system, even if
another interrupt is currently executing. However, if a serial interrupt is executing
no other interrupt will be able to interrupt the serial interrupt routine since the
serial interrupt routine has the highest priority.

IP registers

PSW (Program Status Word, 0D0h)


The program Status Word is used to store a number of important bits that
are set and cleared by 8051 instructions. The PSW SFR contains the carry flag,
the auxiliary carry flag, the parity flag and the overflow flag. Additionally, it also
contains the register bank select flags, which are used to select, which of the R
register banks currently in use.

PSW registers
SBUF (Serial Buffer, 99h)
SBUF is used to hold data in serial communication. It is physically two
registers. One is writing only and is used to hold data to be transmitted out of
8051 via TXD. The other is read only and holds received data from external
sources via RXD. Both mutually exclusive registers use address 99h.

I/O Ports
One major feature of a microcontroller is the versatility built into the
input/output (I/O) circuits that connect the 8051 to the outside world. The main
constraint that limits numerous functions is the number of pins available in the
8051 circuit. The DIP had 40 pins and the success of the design depends on the
flexibility incorporated into use of these pins. For this reason, 24 of the pins may
each used for one of the two entirely different functions which depend, first, on
what is physically connected to it and, then, on what software programs are used
to program the pins.

PORT 0
Port 0 pins may serve as inputs, outputs, or, when used together, as a bi
directional low-order address and data bus for external memory. To configure a
pin as input, 1 must be written into the corresponding port 0 latch by the program.
When used for interfacing with the external memory, the lower byte of address is
first sent via PORT0, latched using Address latch enable (ALE) pulse and then
the bus is turned around to become the data bus for external memory.

PORT 1
Port 1 is exclusively used for input/output operations. PORT 1 pins have
no dual function. When a pin is to be configured as input, 1 is to be written into
the corresponding Port 1 latch.

PORT 2
Port 2 maybe used as an input/output port. It may also be used to supply
a high order address byte in conjunction with Port 0 low-order byte to address
external memory. Port 2 pins are momentarily changed by the address control
signals when supplying the high byte a 16-bit address. Port 2 latches remain

stable when external memory is addressed, as they do not have to be turned


around (set to 1) for data input as in the case for Port 0.

PORT 3
Port 3 may be used to input /output port. The input and output functions
can be programmed under the control of the P3 latches or under the control of
various special function registers. Unlike Port 0 and Port 2, which can have
external addressing functions and change all eight-port b se, each pin of port 3
maybe individually programmed to be used as I/O or as one of the alternate
functions. The Port 3 alternate uses are:
Port 3 Alternate Uses

Pin (SFR)

Alternate Use

P3.0-RXD (SBUF)

Serial data input

P3.1-TXD (SBUF)

Serial data output

P3.2-INTO 0 (TCON.1)

External interrupt 0

P3.3 - INTO 1 (TCON.3)

External interrupt 1

P3.4 - T0 (TMOD)

External Timer 0 input

P3.5 T1 (TMOD)

External timer 1 input

P3.6 - WR

External memory write pulse

P3.7 - RD

External memory read pulse

INTERRUPTS
Interrupts are hardware signals that are used to determine conditions that
exist in external and internal circuits. Any interrupt can cause the 8051 to perform
a hardware call to an interrupt handling subroutine that is located at a
predetermined absolute address in the program memory.

Five interrupts are provided in the 8051. Three of these are generated
automatically by the internal operations: Timer flag 0, Timer Flag 1, and the serial
port interrupt (RI or TI) Two interrupts are triggered by external signals provided
by the circuitry that is connected to the pins INTO 0 and INTO1. The interrupts
maybe enable or disabled, given priority or otherwise controlled by altering the
bits in the Interrupt Enabled (IE) register, Interrupt Priority (IP) register, and the
Timer Control (TCON) register. . These interrupts are mask able i.e. they can be
disabled. Reset is a non maskable interrupt which has the highest priority. It is
generated when a high is applied to the reset pin. Upon reset, the registers are
loaded with the default values.
Each interrupt source causes the program to do store the address in PC
onto the stack and causes a hardware call to one of the dedicated addresses in
the program memory. The appropriate memory locations for each for each
interrupt are as follows:
Interrupts

Interrupt

Address

RESET

0000

IE0 (External interrupt 0) 0003


TF0 (Timer 0 interrupt)

000B

IE1 (External interrupt 1) 0013


TF1 (Timer 1 interrupt)

001B

SERIAL

0023

CHAPTER 7

DESCRIPTION ABOUT LCD INTERFACING


The display section is designed with LCD panel; this panel is interfaced
with microcontroller through its output port. This panel is having two rows, and
each row contains 16 characters. These panels are capable of display numbers,
characters, and graphics. The display contains two internal byte-wide registers,
one for commands (RS=0) and the second for characters to be displayed
(RS=1), it also contains a user. Programmed RAM area (the character RAM), that
can be programmed to generate any desired character can be formed using a
dot matrix. To distinguish between these two data areas, the hex command byte
80 will be used to signify that the display RAM address 00h is chosen.
The LCD circuit is constructed with 89C51 microcontroller. The LCD
contains 16 pins of which 8 are data pins and 3 are control pins. The
microcontroller used in this project work is having 32 I/O lines and 10 I/O lines
are interfaced with LCD panel, D0 D7 of LCD panel are called as 8 bit data
pins and this panel acquires the information from microcontroller through this
data pins. The following figure shows how the display unit is interfaced to the
Microcontroller.

Interfacing the display unit to the microcontroller:

As seen from the above figure, Pins from 7 to 14 are data pins used for the
selection of a particular character and pins 4 to 6 are Control signal pins used for
performing Register bank selection, Read / Write and Enable pins respectively.
By adjusting the voltage at pin number 3 we can change the contrast of the
display. To display a particular character its associated logic sequence has to be
placed on the data pins and write signal (Pin-6) has to be enabled.
Microcontroller takes care of all these things based on the program loaded into it.
In the receiving end, Microcontroller places the logic sequence on the data pins
based on the information obtained from the decoder output.
The function of each pin is given in the following table.
Pin

Symbol

I/O

Description

Vss

--

Ground

Vcc

--

+5V Power Supply

VEE

--

Power supply to Control Contrast

RS

RS = 0 to select command

register, RS=1 to select data register


5

R/W

R/W =0 for write, R/W=1 for read

I/O

Enable

DB0

I/O

The 8-bit data bus

DB1

I/O

The 8-bit data bus

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

In the above table Vcc and Vss are supply pins and VEE (Pin no.3) is used
for controlling LCD contrast. Pin No.4 is Rs pin for selecting the register, there
are two very important registers are there inside the LCD. The RS pin is used for
their selection as follows. If RS = 0, the instruction command code register is
selected, allowing the user to send a command such as clear display. If RS=1,
the data register is selected, allowing the user to send data to be displayed on
the LCD.
R/W is a read or writes Pin, which allows the user to write information to the
LCD or read information from it. R/W=1 when reading, R/W=0 when writing. The
enable (E) pin is used by the LCD to latch information presented to its data pins.
When data is supplied to data pins, a high to-low pulse must be applied to this
pin in order for the LCD to latch in the data present at the data pins. This pulse
must be a minimum of 450 ns wide.
The 8-bit data pins, D0-D7, are used to send information to the LCD or read
the contents of the LCDS internal registers. To display letters and numbers, we

must send ASCII (Antenna Standard Code for Information Inter Change,
Pronounced ask E) codes for the letters A Z, and numbers 0 - 9 to these
pins while making RS=1.

DESCRIPTION ABOUT LCD INTERFACING


This section explains about how to interface the LCD to Microcontroller,
before interfacing we have to study the operation modes of LCDs and how to
program using assembly language and C.

In recent years the LCD panels became very popular because of their
widespread use in various electronic systems like instruments to read the
parameter values, digital communications for sending or receiving the text
information, data acquisition systems, etc. These display units dominating seven
segment displays by providing more features to the user. The LCD system can
display numbers, characters, and graphics, where as seven segments LEDs
displays only numbers, therefore most of the engineers prefers LCDs. The data
fed to the LCD remains as it is and the same will be displayed until it gets an
erase signal from the controller. The data can be stored and it can be refreshed
for the next task.
The instruction command codes from microcontroller can be sent to the
LCD to clear the display, depending up on the command the cursor can be
brought to home position or blink the cursor. The LCD is having two important
resistors internally, command resistor and data register; RS pin is used to select
either command register or data register. If RS = 0, the instruction command
code register is selected and allowing the user to send a command to clear the
display. If RS = 1 the data register is selected, there by the user is allowed to

send data that is to be displayed on LCD screen. By making RS pin to zero, we


can also check the busy flag bit to see if the LCD is ready to receive information.
As already mentioned that D0 D7 of LCD pins are 8 bit data pins and the
busy flag is D7, it can be read when R/W (Read or Write) pin is high (R/W = 0)
and RS = 0, as follows; if R/W = 1, R/S = 1. When D7 pin is high, the LCD is busy
taking care of internal operations and will not accept any new information. When
D7 = 0, the LCD is ready to receive new information. It is recommended to check
the busy flag before writing any data to the LCD. The following is the table
shows the list of instruction command codes.

Code

Command to LCD Instruction

Clear display screen

Return home

Decrement cursor (shift cursor to left)

Increment cursor (shift cursor to right)

Shift display right

Shift display left

Display off, cursor off

Display off, cursor on

Display on, cursor off

Display on, cursor blinking

Display on, cursor blinking

10

Shift cursor position to left

14

Shift cursor position to right

18

Shift the entire display to the left

IC

Shift the entire display to the right

80

Force cursor to beginning of first line

CO

Force cursor to beginning of second line

38

2 Lines and 5x7 Matrix

To send any commands from instruction command code table to the LCD,
make RS pin to zero. For data, feed high signal to RS pin, then send a high to
low pulse to the E pin to enable the internal latch of the LCD. For this, the
suitable program is to be prepared for LCD connections. Another suitable
program is to be prepared for sending code to the LCD with checking busy flag.
Depending up on the program the busy flag can be D7 of the command resistor,
to read command register R/W pin must be high and RS pin must be low, and a
low to high pulse for the enable pin will provide the command register. After
reading the command register, if bit D7 (busy flag) is high, the LCD is busy and
no information (either command or data) should be issued to it. During D7 is
zero; at that time we can send data or commands to the LCD. In this method time
delays are not required in the program, because we are checking the busy flag
before issuing commands to the LCD. Enable line must be negative-edge
triggered for the write and it should be positive-edge triggered for the read.

CHAPTER 8

BRIEF DESCRIPTION ABOUT LCD PANELS


Thin- Film Transistor LCD Displays Introduction and Operation
In 1968, the first liquid crystal display (LCD) was developed by RCA
Laboratories. Since then, LCDs have been implemented on almost all types of
digital devices, from watches to computer to projection TVs. LCDs operate as a
light "valve", blocking light or allowing it to pass through. An image in an LCD is
formed by applying an electric field to alter the chemical properties of each LCC
(Liquid Crystal Cell) in the display in order to change a pixel's light absorption
properties. These LCCs modify the image produced by the backlight into the
screen output requested by the controller. Though the end output may be in
color, the LCCs are monochrome, and the color is added later through a filtering
process. Modern laptop computer displays can produce 65,536 simultaneous
colors at a resolution of 800 x 600.
To understand the operation of an LCD, it is easiest to trace the path of a
light ray from the backlight to the user. The light source is usually located directly
behind the LCD, and can use either LED or conventional flourescent technology.
From this source, the light ray will pass through a light polarizer to uniformily
polarize the light so it can be acted upon by the liquid crystal (LC) matrix. The
light beam will then pass through the LC matrix, which will determine whether this
pixel should be "on" or "off". If the pixel is "on", the liquid crystal cell is electrically
activated, and the molecules in the liquid will allign in a single direction. This will
allow the light to pass through unchanged. If the pixel is "off", the electric field is
removed from the liquid, and the molecules within scatter. This dramatically
reduces the light that will pass through the display at that pixel.

In a color display, after the light passes through the liquid crystal matrix, it
passes through a color filter (usually glass). This filter blocks all wavelengths of
light except those within the range of that pixel. In a typical RGB display, the
color filter is integrated into the upper glass colored microscopically to render
each individual pixel either red, green or blue. The areas in between the colored
pixel filter areas are printed black to increase contrast. After a beam of light
passes through the color filter, it passes through yet another polarizer to sharpen
the image and eliminate glare. The image is then available for viewing.

In an AMLCD, each LCC is stimulated individually by a dedicated transistor


or diode. The two existing AMLCD technologies are Thin Film Transistor (TFT)
and metal-insulator-metal (MIM). In an MIM display, dedicated diodes are
fabricated at each pixel, whereas a TFT display uses a thin film transistor matrix,
with one transistor at each pixel. MIM displays, currently being manufactured by
Toshiba and Seiko-Epson, are not advantageous in terms of performance,
although they cost somewhat less to manufacture than TFT displays
("Amorphous Silicon"). This document will focus on TFT technology.
Different LCD addressing modes

LCD material became a display medium first in 1971. Several methods


since then have been developed for sending signals to LCDs, called "addressing
schemes". The three most important are direct, multiplex and active matrix.

Direct addressing, usually used in watches and calculators, is great for simple
alphanumeric characters, since one signal controls many segments. However,
direct addressing is not realistic for larger systems due to the interfacing difficulty
the large number of wires would present. In a multiplexed interface, the number
of wires can be greatly reduced because one wire can be "shared" by several
pixels through a "matrix" wiring scheme. Multiplex addressing is similar to active
matrix, where a separate signal is sent to each pixel. The display is split up into a
grid of "wires", with cross- points at each pixel. The only difference between the
two addressing schemes (multiplex and active matrix) is in the charge storage.
Multiplex stores no charge at each pixel. Active addressing, however, frequently
refreshes each pixel to "store" the charge, allowing displays to show real- time
video in larger screens than multiplex addressing. TFT displays use active matrix
addressing. (Sarif Primer 1)
There are many advantages to the active matrix (AM) approach. The first
AM display was invented by Lechner et al. in 1971 to circumvent an inherent
problem in passive-matrix displays - their contrast decreases with increased
resolution (Yaniv). In addition to solving this problem, AMLCDs virtually eliminate
an effect known to many users of PMLCDs as "ghosting". This happens when the
display is expected to refresh its output faster than it is able, leaving "ghost"
images on the screen. Although this effect is a mere annoyance in some
systems, todays laptop computers are often expected to play full- motion MPEG
video, and "ghosting" would all but destroy the quality of playback. Faster video
speed is desireable in virtually all LCD applications including laptop computers,
integrated systems, and is perhaps most important in the development of a flatpanel TV.
Manufacturing and Display Configurations

The process of manufacturing a TFT is similar to the process used to


manufacture a silicon IC. Extremely thin insulators; conductors and transistors
must be laid into a glass substrate, which becomes the lower glass of the LCD. A
technique called photolithography is used to accomplish this. In this process,
metal and silicon are progressively added and etched away from the substrate,
forming a matrix of "wires", transistors, and insulators.
TFT AMLCDs do nothing more than modify an image from a backlight, so
they are useful in projection systems as well as direct-view systems. This allows
computer manufacturers to give the LCD display a dual purpose, as a
conventional laptop display, and as an overlay for overhead projectors. This
technology can bring full-motion video into a boardroom without having to
transfer it to videotape and lug in a TV, or buy a separate LCD projector screen.
Because a TFT requires a transistor at each pixel, it is obviously desirable to limit
the number of pixels in the display without compromising image quality
(Takahashi 1115). Conventional color displays use a pixel arrangement called
RGB. In this arrangement, red, green and blue pixels are arranged in equal
proportion. Although at high pixel densities, RGB is adequate, when the number
of pixels is limited, the image may appear fuzzy. To compensate for this, a GRGB
arrangement can be used (Takahashi 1115). This arrangement utilizes the
knowledge that the human eye is more sensitive to green than red or blue, and
doubles the number of green pixels in the display. When the pixel density is
decreased with this arrangement, the apparent resolution remains adequate.
Interfacing Example - 16 Character x 2 Line LCD Description
This is the first interfacing example for the Parallel Port. We will start with
something simple. This example doesn't use the Bi-directional feature found on
newer ports, thus it should work with most, if not all Parallel Ports. It however
doesn't show the use of the Status Port as an input. So what are we interfacing?

A 16 Character x 2 Line LCD Module to the Parallel Port. These LCD Modules
are very common these days, and are quite simple to work with, as all the logic
required running them is on board.
Schematic

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.

The 10k Potentiometer controls the contrast of the LCD panel. Nothing
fancy here. As with all the examples, I've left the power supply out. 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. The one I used to
test this circuit was a Power tip PC-1602F and an old Philips LTN211F-10 which
was extracted from a Poker Machine! The diagram to the right shows the pin
numbers for these devices. When viewed from the front, the left pin is pin 14 and
the right pin is pin 1.

The LCD panel requires a few instructions to be sent, to order to turn on


the display and initialize it. This is what the first for loop does. These instructions
must be sent to the LCD's Instruction Register, which is controlled by the
Register Select (Pin 4). When pin 4 is low the instruction register is selected, thus
when high the data register must be selected. We connect this to the Parallel
Port's Select Printer line, which happens to be hardware inverted. Therefore if we
write a '1' to bit 3 of the Control Register the Select Printer line goes low.

CHAPTER 9
RELAYS AND THEIR APPLICATIONS
The electromagnetic relay, one of mankinds first electrical device, was
used practically in telegraphy as early as 1850. The modern relay, properly
applied, is one of the most simple, effective and dependable component
available. In the majority of instances, it can achieve better reliability at lesser
cost than an equivalent solid-state complex type of relay.
The term relay was used for the first time to describe an invention made
by Samuel Morse in 1836. The device invented by Morse was a Telegraph
Amplifying Electromagnetic Device which enabled a small current flowing in a
coil to switch on a large current in another circuit and thus helped in relay of
signals.
A relay is a device that opens or closes an auxiliary circuit under some
predetermined condition in the main circuit. The object of a relay is generally to
act as a sort of electric magnifier, that is to say, it enables a comparatively weak
current to bring into operation a much stronger current. It also provides complete
electrical isolation between the controlling circuit and the controlled circuit.
Relays are widely used in industry. Railroads, pipelines and heavy-duty
signaling operations have relied for many years to handle their automatic and
remote control problems. Most of the traffic control signals on our streets use
relays. Telephone, telegraph and telemetry systems depend on relays to provide
circuit selection and switching. Complete automatic and many semi-automatic
control processes in industrial plants use relays extensively. In computer circuit,

relays can be arranged to provide mathematical functions and to count. In short,


relays are used to perform a wide variety of tasks in electrical and electronics
engineering activities.
Though relays are simple devices, they are rarely fully understood by
electronic equipment designers because there are so many varieties.

They

have been developed to meet a wide range of requirements. A relay, when used
properly under good climatic conditions, can have a very long life. Under other
conditions, it can give considerable trouble.
The relays used in this project work are electromagnetic relays. The
electromagnetic relay is basically a switch (or a combination of switches)
operated by the magnetic force generated by a current flowing through a coil.
Essentially, it consists of four parts an electromagnet comprising a coil and a
magnetic circuit, a movable armature, a set of contacts, and a frame to mount all
these components. However, very wide ranges of relays have been developed to
meet the requirements of the industry.
This relay is nothing but a switch, which operates electro-magnetically. It
opens or closes a circuit when current through the coil is started or stopped.
When the coil is energized armature is attracted by the electromagnet and the
contacts are closed. That is how the power is applied to the signals (indicators).
The construction of the typical relay contains a code surrounded by a coil
of copper wire. The core is mounted on a metal frame. The movable part of the
relay is called armature. When a voltage is applied to the coil terminals, the
current flowing through the coil produces a magnetic field in the core. In other
words, the core acts as an electromagnet and attracts the metal armature. When
the armature is attracted to the core, the magnetic path is from the core through

armature, through the frame, and back to the core. On removing the voltage the
spring attached to the armature returns the armature to its original position. In
this position, there is a small air-gap in the magnetic path. Hence, more power is
needed to pull in the armature than that needed to keep it held in the attracted
position.
The relay contacts and the terminals are mounted on an insulated board.
When no current flows through the relay coil, the contact arm, or pole as it is
called, mounted on the armature, touches the top contact.

When the coil is

energized by flow of current, the armature along with the contact arm assembly
moves downwards so that the contact arm touches the bottom contact.
When an electric current is flowing through a relay coil, it is said to be
energized, and when the current flow stops, the relay is said to be de-energized.
They have a set of parallel contacts, which are all pulled in when the
electromagnet pulls in the armature. On being energized, whether a relay makes
contact(s) or breaks them depends on the design of contact arrangements.
Though the contacts are open or close simultaneously, the sequence of
operation cannot be guaranteed in this of construction.

To have a definite

switching sequence, stacked contacts are used.

RELAY CHARACTERSTICS
A relay is a device that opens or closes an auxiliary circuit under
predetermined condition in the main circuit. The object of a relay is generally to
act as a sort of electrical magnifier; that is to say, it enables a comparatively
weak current to bring into operation a much stronger current. It also provides
complete electrical isolation between the controlling circuit and the controlled
circuit.

Relays are extensively used in electronics, electrical engineering and


many other fields. A wide variety of relays have been developed to meet the
varied requirements of industry. There are relays that are sensitive to conditions
of voltage, current, temperature, frequency, or some combination of these
conditions. The basic working of an electromagnetic relay is easy to understand.
However, in order to select a relay to perform a particular function efficiently and
that too for a long time requires knowledge of relay characteristics and that of the
circuits in which the relay is used.

CHAPTER 10

SOFTWARE DESCRIPTION WITH CHIP BURNING PROCESS


In our project we used software that is Keil micro vision for the simulation
of the program.

Keil Software
Keil development tools for the 8051 Microcontroller Architecture support
every level of software developer from the professional applications engineer to
the student just learning about embedded software.
The industry-standard Keil C Compilers, Macro Assemblers, Debuggers,
Real-time Kernels, Single-board Computers, and Emulators support all 8051
derivatives and help you get your projects completed on schedule.

Simulation
The Vision Simulator allows you to debug programs using only your PC
using simulation drivers provided by Keil and various third-party developers. A
good simulation environment, like Vision, does much more than simply simulate
the instruction set of a microcontroller it simulates your entire target system
including interrupts, startup code, on-chip peripherals, external signals, and I/O.

Use of software for execution of microcontroller programs

Keil development tools for the MC architecture support every level of


software developer from the professional applications engineer to the student just
learning about embedded software development.
The industry-standard Keil-C compilers, macro assemblers, debuggers,
real, time Kernels, Single-board computers and emulators support all
microcontroller derivatives and help you to get more projects completed on
schedule. The Keil software development tools are designed to solve the
complex Problems facing embedded software developers. Those are listed
below.

Problems faced by embedded software developers


When starting a new project, simply select the microcontroller you
the device database and the vision IDE sets all compiler,
assembler, linker, and memory options for you.
The Keil Vision debugger accurately simulates on-chip peripherals
(PC, CAN, UART, SPI, Interrupts, I/O ports, A/D converter, D/A
converter and PWM modules)of your aver device.
Simulation helps you understand h/w configurations and avoids time
wasted on setup problems. Additionally, with simulation, you can
write and test applications before target h/w is available.
When you are ready to begin testing your s/w application with target
h/w, use the MON51, MON390, MONADI, or flash MON51 target
monitors, the ISD51 In-System Debugger, or the ULINK USB-JTAG
adapter to download and test program code on your target system.

Developing software and hardware for micro controller based Embedded


systems involves the use of a range of tools that can include editors, assemblers,
Compilers, debuggers, simulators, emulators and Flash/OTP programmers. To
the Newcomer to micro controller development it is often not clear how all of
these Different components play together in the development cycle and what
differences There are for example between Trainer kits, emulators and simulator.
The basic operations that are involved in above micro controller development
cycle are:
1. Writing Micro controller Code.
2. Translating the Code.
3. Debugging the code.

Writing micro controller code:

Software Code for a micro controller is written in a programming language


of choice (often Assembler or C). This source code is written with a standard
ASCII text editor and saved as an ASCII text file. Programming in assembler
involves learning a micro controllers specific instruction set (assembler
mnemonics), but results in the most compact and fastest code. A higher-level
language like C is for the most part independent of a micro controllers specific
architecture, but still requires some controller specific extensions of the standard
language to be able to control all of a chip's peripherals and functionality. The
penalty for more portable code and faster program development is a larger code
size (20%...40% compared to assembler).
Translating the code:

Next the source code needs to be translated into instructions the micro
controller can actually execute. A microcontrollers instruction set is represented
by "op codes". Op codes are unique sequences of bits ("0" and "1") that are
decoded by the controller's instruction decode logic and then executed. Instead
of writing op-codes in bits, they are commonly represented as hexadecimal
numbers, whereby one hex number represents 4 bits within a byte, so it takes
two hex numbers to represent 8 bits or 1 byte. For that reason a micro
controllers firmware in Machine-readable form is also called Hex-Code and the
file that stores that code Hex-File.
Debugging the Code
A debugger is a piece of software running on the PC, which has to be
tightly integrated with the emulator that you use to validate your code. For that
reason all emulator manufacturers ship their own debugger software with their
tools, but also compiler manufacturers frequently include debuggers, which work
with certain emulators, into their development suites.
ADVANTAGES
1. One of the advantages of an embedded system is to decrease power
consumption and space.
2. All embedded systems that are based on micro controller have low power
consumption in addition to some form of I/O, COM port and ROM all on a
single chip.
CHIP BURNING PROCESS
The process of chip burning depends up on the compiler kit, the CA51
Compiler Kit for the 8051 micro controller family supports all 8051 derivatives
including those from

companies like Analog Devices, Atmel, Cypress

Semiconductor, Dallas Semiconductor, Goal, Hynix, Infineon, Intel, OKI, Philips,


Silicon Labs, SMSC, ST Microelectronics, Synopsis, TDK, Temic, Texas
Instruments, and Winbond.
The following components are included in the CA51 8051 C-compiler &
Assembler Kit:

C51 C Compiler
The Keil C51 C Compiler for the 8051 micro controller is the most popular
8051 C compiler in the world. It provides more features than any other 8051 C
compiler available today.
The C51 Compiler allows you to write 8051 micro controller applications in
C that have the efficiency and speed of assembly language. Language
extensions in the C51 Compiler give you full access to all resources of the 8051.
C51 translates C source files into a re-locatable object module. When the
DEBUG control is used, the object file contains full symbolic information for
debugging with the Vision3 Debugger or an in-circuit emulator. In addition to the
object file, the C51 Compiler generates a listing file, which optionally may include
symbol table and cross-reference information.

Features

Nine basic data types, including 32-bit IEEE floating-point

Flexible variable allocation with bit, data, bdata, idata, xdata, and pdata
memory types

Interrupt functions may be written in C

Full use of the 8051 register banks

Complete symbol and type information for source-level debugging

Use of AJMP and ACALL instructions

Bit-addressable data objects

Built-in interface for the RTX51 real-time operating system

Support

for

dual

data

pointers

on

Atmel,

AMD,

Cypress,

Dallas

Semiconductor, Infineon, Philips, and Triscend micro controllers

Support for the Philips 8xC750, 8xC751, and 8xC752 limited instruction sets

Support for the Infineon 80C517 arithmetic unit

A51 Macro Assembler


The A51 Assembler is a macro assembler for the 8051 family of micro
controllers. It supports all 8051 derivatives. It translates symbolic assembly
language mnemonics into relocatable object code where the utmost speed, small
code size, and hardware control are critical. The macro facility speeds
development and conserves maintenance time since common sequences need
only be developed once. The A51 assembler supports symbolic access to all
features of the 8051 architecture.
The A51 assembler translates assembler source files into a relocatable
object module. The DEBUG control adds full symbolic information to the object
module and supports debugging with the Vision3 Debugger or an in-circuit
emulator. In addition to object files, the A51 assembler generates list files, which
optionally may include symbol table and cross reference information.

Vision3 IDE
The Vision3 IDE from Keil Software combines project management; make
facilities, source code editing, program debugging, and complete simulation in

one powerful environment. Vision3 helps you get programs working faster than
ever while providing an easy-to-use development platform. The editor and
debugger are integrated into a single application and provide a seamless
embedded project development environment.
Vision3 features include:

The Device Database, which automatically sets the assembler, compiler, and
linker options for the chip, you select. This prevents you from wasting your
time configuring the tools and helps you get started writing code faster.

A robust Project Manager, which lets you create several different


configurations of your target from a single project file. The Keil Vision3 IDE
allows you to create an output file for simulating, an output file for debugging
with an emulator, and an output file for programming an EPROM -- all from
the same Project file.

An integrated Make facility with automatic dependency generation. You don't


have to figure out which header files and include files are used by which
source files. The Keil compilers and assemblers do that automatically.

Interactive Error Correction. As your project compiles, errors and warnings


appear in an output window. You may make corrections to the files in your
project while Vision3 continues to compile in the background. Line numbers
associated with each error or warnings are automatically resynchronized
when you make changes to the source.

OH51 Object-HEX Converter


The OH51 Object-HEX converter creates Intel HEX files from absolute
OMF51 object modules, created by the Keil A51 assembler, BL51 code banking
linker, or OC51 banked object converter.

Intel HEX files are ASCII files that contain a hexadecimal representation of
your program. They easily may be loaded into a device programmer for writing
EPROMs or other memory devices.
KEIL Compiler
It's very easy to work with Keil if you know how to write the programs in c or
assembly language. The basic steps to compile and run a program in
assembly language:
1. Open the Keil
2. Open project window and then select a new project and save it by any name
like exam1.
3.

Now

"select

device

for

target

'target1'

"

window

will

appear.

Select the name of the chip vendor (Intel, Philips, Siemens, etc.) in the Vendor
box. Select the device family from the drop down menu in the Family box.
Enter the part number for the device in the Device box. I select ATMEL, after
clicking on Atmel it will give device no. I select AT89C51.
4. Now in "project workspace"(window on the left side), target1 will appear. Click
on target1, source group1 will appear.
5. Open new file and write a program in assembly. Save it with .asm (like
'exam.asm').
6. Now right click on the "source group1. Select "add files to group 'source
group1' "
7. Give the file name like 'exam.asm and add it and close that window. Again left
click on the source group1; you can see the added file.

8. Right click on this added file and select build target. By this you can compile
your program. Check the output window. If youre pro is compiled properly
then go to 'Debug'.
9. Select 'start/stop debug session'.
10. In project workspace you can see how your program is running.
11. Again go to 'Debug' and see F11 is there for running your program step-bystep.
12. Press F11 or F5.
13. Again go to Debug and select 'start/stop debug session' to stop the program.

CHAPTER 11

HARDWARE DETAILS
The ICs and other important components used in this project work,
procured from the Hyderabad Electronics Market. The details or data sheets of
the ICs are down loaded from the Internet. The following are the web sites that
can be browsed for collecting the data sheets.
1.

www. Texas Instruments.com

2.

www. National semiconductors.com

3.

www. Fairchild semiconductors.com

The following are the components used in the project work:


1. Atmel 89C51 Micro Controller IC
2. LM 567 Tone Decoder Chip
3. Zigbee modules
4. Voltage Regulator IC (7805)
5. BC 547 NPN Transistor
6. Relay

The required PCBS (Printed Circuit boards) for the project work fabricated
by SUN RISE CIRCUITS, Kushaiguda Industrial Estate, Hyderabad. Kushaiguda
Industrial Estate is very famous for fabricating the Industrial grade PCBs.

CHAPTER 12

CONCLUSIONS AND REFERENCES

CONCLUSION

The project work designed and developed successfully, for the


demonstration purpose prototype module is constructed & results are found to be
satisfactory. While designing and developing this proto type module, we have
consulted few experts those who are having knowledge in appropriate fields,
these professionals working at different organizations belong to Hyderabad
helped us while designing the project work. For demo purpose this traffic
signaling system is designed for a single direction only. The same mechanism
can be implemented for all the vehicles in all the four directions at the signaling
post with little modifications.
The Zigbee modules used in the project work are purchased from the
market, they are working fine. During the trail run we have tested the range and
we found that the transmitter is able transmit data from a distance of 60 feet as
well.

REFERENCES:
The following are the references made during the development of this
project work.
Text Books:
1. Linear Integrated Circuits By: D. Roy Choudhury, Shail Jain
2. Digital Electronics. By JOSEPH J.CARR
3. Digital and Analog Communication System By: K. sam Shanmugam
4. Communication - Four-Wire, Resistive-Type Touch Screen with USB
Interface by SVYATOSLAV PALIY.
5. System level solutions Lab manual, a study on Touch Screen by JOHN J
ROVE.
6. The concepts and Features of Micro-controllers - By: Raj Kamal
7. The 8051 Micro-controller Architecture, programming & Applications - By:
Kenneth J. Ayala
8. Programming and Customizing the 8051 Micro-controller - By: Myke
Predko
Catalogs:
(1) TEXAS

- LINEAR ICs manual

(2) SIGNETICS - DIGITAL ICs manual


Journals:
(1) Electronic Design
(2) Electronics for you
(3) Electronics Text.
(4) Practical Electronics

S-ar putea să vă placă și