Sie sind auf Seite 1von 52

ABSTRACT

In the present scenario, vehicular traffic is increasing throughout the world, especially in
large urban areas. As the number of road users constantly increase and resources provided by
current infrastructures being limited, a smart traffic control will become a very important issue in
the future. These needs have led to an ever increasing demand for an “intelligent” traffic control
system. Therefore, optimization of traffic control to better accommodate this increasing demand
is needed. In this project, we will demonstrate the optimization of traffic light controller in a
city using wireless sensors.

Traffic light optimization is a complex problem. With multiple junctions, the problem
becomes even more complex as the state of one light node influences the flow of traffic towards
many other nodes. We have proposed a traffic light controller and simulator that allow us to
study different situations of traffic density. Using wireless sensors, we can easily sense the
density of traffic because the general architecture of wireless sensors is an infrastructure -less
communication network.

The brain behind the implementation is an 8051 programmed using Embedded C, which
performs processing of the real time data provided by the wireless sensors, eventually controlling
the traffic flow via the LED traffic lights.
CHAPTER 1

INTRODUCTION TO EMBEDDED SYSTEMS

1.1History:
In the present scenario, vehicular traffic is increasing throughout the world, especially in
large urban areas. As the number of road users constantly increase and resources provided by
current infrastructures being limited, a smart traffic control will become a very important issue
in the future. These needs have led to an ever increasing demand for an “intelligent” traffic
control system. Therefore, optimization of traffic control to better accommodate this increasing
demand is needed. In this project, we will demonstrate the optimization of traffic light controller
in a city using wireless sensors.
Traffic light optimization is a complex problem. With multiple junctions, the problem
becomes even more complex as the state of one light node influences the flow of traffic towards
many other nodes. We have proposed a traffic light controller and simulator that allow us to
study different situations of traffic density. Using wireless sensors, we can easily sense the
density of traffic because the general architecture of wireless sensors is an infrastructure -less
communication network.
it is observed that the proposed intelligent Traffic Light controller is more efficient than
the convenctional controller in respect of less waiting time, more distance travelled by average
vehicles and efficient operation during emergency mode and GSM designed system as simple
architecture, fast response time,user friendliness and scope for further expansion.
1.2 Overview
The main objective of this project to control the traffic lights based on the density of the
vehicles .In this system IR sensors are used to measure the density of the vechicles which are
fixed with in a fixed distance. All the sensors are interfaced with the microcontroller which in
turn controls the traffic signals system according to density detected by the sensors. The traffic
density is high on particular side more priority is given for that side
The sensors continuously keep sensing density on all sides and the green signal is given
to the side on priority basis, where the sensors detect high density.The side with next priority
level follows the first priority level. By using this system traffic can be cleared without
irregularities and time delay seven though there is on the other side can be avoided

1.3 Embedded System:

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


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

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

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

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

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


fixed in capability or programmable, that is specifically designed for a particular kind of
application device. Industrial machines, automobiles, medical equipment, cameras, household
appliances, airplanes, vending machines, and toys (as well as the more obvious cellular phone
and PDA) are among the myriad possible hosts of an embedded system. Embedded systems that
are programmable are provided with a programming interface, and embedded systems
programming is a specialized occupation.

Certain operating systems or language platforms are tailored for the embedded market,
such as Embedded Java and Windows XP Embedded. However, some low-end consumer
products use very inexpensive microprocessors and limited storage, with the application and
operating system both part of a single program. The program is written permanently into the
system's memory in this case, rather than being loaded into RAM (Random Access Memory), as
programs on a personal computer.

In recent days, you are showered with variety of information about these embedded
controllers in many places. All kinds of magazines and journals regularly dish out details about
latest technologies, new devices; fast applications which make you believe that your basic
survival is controlled by these embedded products. Now you can agree to the fact that these
embedded products have successfully invaded into our world. You must be wondering about
these embedded controllers or systems. The computer you use to compose your mails, or create a
document or analyze the database is known as the standard desktop computer. These desktop
computers are manufactured to serve many purposes and applications.

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

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


based hardware and the suitable software to undertake a specific task. These days designers have
many choices in microprocessors/microcontrollers. Especially, in 8 bit and 32 bit, the available
variety really may overwhelm even an experienced designer. Selecting a right microprocessor
may turn out as a most difficult first step and it is getting complicated as new devices continue to
pop-up very often.
1.4 Basic Blocks of Embedded System:

Now, the details of the various building blocks of the hardware of an embedded system as
shown in Fig 1.1 are

. Central Processing Unit (CPU)

· Memory (Read-only Memory and Random Access Memory)

· Input Devices

· Output devices

· Communication interfaces

· Application-specific circuitry

Central Processing Unit (CPU):

The Central Processing Unit (processor, in short) can be any of the following:
microcontroller, microprocessor or Digital Signal Processor (DSP). A micro-controller is a low-
cost processor. Its main attraction is that on the chip itself, there will be many other components
such as memory, serial communication interface, analog-to digital converter etc. So, for small
applications, a micro-controller is the best choice as the number of external components required
will be very less. On the other hand, microprocessors are more powerful, but you need to use
many external components with them. DSP is used mainly for applications in which signal
processing is involved such as audio and video processing.
Figure.1.1: Block Diagram of Embedded System

Memory:

The memory is categorized as Random Access Memory (RAM) and Read Only Memory
(ROM). The contents of the RAM will be erased if power is switched off to the chip, whereas
ROM retains the contents even if the power is switched off. So, the firmware is stored in the
ROM. When power is switched on, the processor reads the ROM; the program is executed.

Input devices:

Unlike the desktops, the input devices to an embedded system have very limited
capability. There will be no keyboard or a mouse, and hence interacting with the embedded
system is not an easy task. Many embedded systems will have a small keypad-you press one key
to give a specific command. A keypad may be used to input only the digits. Many embedded
systems used in process control do not have any input device for user interaction; they take
inputs from sensors or transducers and produce electrical signals that are in turn fed to other
systems.

Output devices:

The output devices of the embedded systems also have very limited capability. Some
embedded systems will have a few Light Emitting Diodes (LEDs) to indicate the health status of
the system modules, or for visual indication of alarms. A small Liquid Crystal Display (LCD)
may also be used to display some important parameters.

Communication interfaces:

The embedded systems may need to, interact with other embedded systems at they may
have to transmit data to a desktop. To facilitate this, the embedded systems are provided with one
or a few communication interfaces such as RS232, RS422, RS485, Universal Serial Bus (USB),
and IEEE 1394, Ethernet etc.

Application-specific circuitry:

Sensors, transducers, special processing and control circuitry may be required for an
embedded system, depending on its application. This circuitry interacts with the processor to
carry out the necessary work. The entire hardware has to be given power supply either through
the 230 volts main supply or through a battery. The hardware has to design in such a way that the
power consumption is minimized.

Security is the condition of being protected against danger or loss. In the general sense,
security is a concept similar to safety. The nuance between the two is an added emphasis on
being protected from dangers that originate from outside. Individuals or actions that encroach
upon the condition of protection are responsible for the breach of security. The word "security"
in general usage is synonymous with "safety," but as a technical term "security" means that
something not only is secure but that it has been secured. One of the best options for providing
good security is by using a technology named EMBEDDED SYSTEMS.
1.5 Microcontroller:

In the Literature discussing microprocessors, we often see the term Embedded System.
Microprocessors and Microcontrollers are widely used in embedded system products. An
embedded system product uses a microprocessor (or Microcontroller) to do one task only. A
printer is an example of embedded system since the processor inside it performs one task only,
namely getting the data and printing it. Contrast this with a Pentium based PC can be used for
any number of applications such as word processor, print-server, bank teller terminal, Video
game, network server, or Internet terminal. Software for a variety of applications can be loaded
and run. Of course the reason a pc can perform myriad tasks is that it has RAM memory and an
operating system that loads the application software into RAM memory and lets the CPU run it.

In an Embedded system, there is only one application software that is typically burned
into ROM. An x86 PC contains or is connected to various embedded products such as keyboard,
printer, modem, disk controller, sound card, CD-ROM drives, mouse, and so on. Each one of
these peripherals has a Microcontroller inside it that performs only one task. For example, inside
every mouse there is a Microcontroller to perform the task of finding the mouse position and
sending it to the PC.

Application Areas

Nearly 99 per cent of the processors manufactured end up in embedded systems. The
embedded system market is one of the highest growth areas as these systems are used in very
market segment- consumer electronics, office automation, industrial automation, biomedical
engineering, wireless communication, data communication, telecommunications, transportation,
military and so on.

Consumer appliances: At home we use a number of embedded systems which include digital
camera, digital diary, DVD player, video recorders etc.

Office automation: The office automation products using embedded systems are copying
machine, fax machine, key telephone, modem, printer, scanner etc
Industrial automation: Today a lot of industries use embedded systems for process control. In
hazardous industrial environment, where human presence has to be avoided, robots are used,
which are programmed to do specific jobs.

Medical electronics: Almost every medical equipment in the hospital is an embedded system.
These equipments include diagnostic aids such as ECG, EEG, blood pressure measuring devices,
radiation, colonoscopy, endoscopy etc.

Computer networking: Computer networking products such as bridges, routers, Integrated


Services Digital Networks (ISDN), Asynchronous Transfer Mode (ATM), X.25 and frame relay
switches are embedded systems which implement the necessary data communication protocols

Telecommunications: In the field of telecommunications, the embedded systems can be


categorized as subscriber terminals and network equipment. The subscriber terminals such as key
telephones, ISDN phones, terminal adapters, web cameras are embedded systems. The network
equipment includes multiplexers, multiple access systems, Packet Assemblers Dissemblers
(PADs), sate11ite modems etc.

Security: Security of persons and information has always been a major issue. We need to
protect our homes and offices; and also the information we transmit and store. Developing
embedded systems for devices at homes, offices, airports etc. for authentication and verification
are embedded systems security applications is one of the most lucrative businesses nowadays.

Microprocessors Vs Microcontrollers:

• Microprocessors are single-chip CPUs used in microcomputers.

• Microcontrollers and microprocessors are different in 3 main aspects: hardware architecture,


applications, and instruction set features.

• Hardware architecture: A microprocessor is a single chip CPU while a microcontroller is a


single IC contains a CPU and much of remaining circuitry of a complete computer (e.g., RAM,
ROM, serial interface, parallel interface, timer, interrupt handling circuit).
• Applications: Microprocessors are commonly used as a CPU in computers while
microcontrollers are found in small, minimum component designs performing control oriented
activities.

• Microprocessor instruction sets are processing Intensive.

• Their instructions operate on nibbles, bytes, words, or even double words.

• Addressing modes provide access to large arrays of data using pointers and offsets.

• They have instructions to set and clear individual bits and perform bit operations.

• They have instructions for input/output operations, event timing, enabling and setting priority
levels for interrupts caused by external stimuli.

• Processing power of a microcontroller is much less than a microprocessor.


CHAPTER 2

EMBEDDED SYSTEMS FOR TRAFFIC CONTROL

2.1 INTRODUCTION

In the present scenario the vehicle problem is increasing and Traffic congestion is a
severe problem in many modern cities all over the world. To overcome the problem, we have
come up with an exclusive idea for a dynamic and automatic traffic light control expert system
combined with a simulation mode.
Traffic research has the goal to optimize traffic flow, as the roads have become
overloaded with increasing number of vehicles and resources are limited. However, still there
are some limitations in existing traffic control which are not environmental and economical.
There are several models which give solutions for traffic simulation. In our research we have
focussed on optimization of traffic light controller in a city using wireless sensor.

Traffic light optimization is a big problem. Even for single junction there is no optimal
solution. The problem becomes even more complex with multiple junctions, as the state of one
light is responsible for the flow of traffic of that road only. Another complication is that the flow
of traffic density frequently changes, depending on the time of day, the day of the week, and the
time new year.
Nowadays congestion in traffic is a serious issue. The traffic congestion can also be
caused by large Red light de-lays, etc. The delay of respective light is hard coded in the traffic
light and it is not dependent on traffic. Therefore for simulating and optimizing traffic control to
better accommodate this increasing demand is arises. In this paper we studied the optimization of
traffic light controller in a City using microcontroller. Thus I propose multiple traffic light
control and monitoring system. The system tries to reduce possibilities of traffic jams, caused by
traffic lights, to an extent. The system is based on microcontroller. The micro-controller used in
the system is 89C51 which is MCS-51 family based.
The system contains IR transmitter and IR receiver which are mounted on the either sides
of roads respectively. The IR system gets activated whenever any vehicle passes on road
between IR transmitter and IR receiver. Microcontroller controls the IR system and counts
number of vehicles passing on road. Microcontroller also store vehicles count in its memory.
Based on different vehicles count, the microcontroller takes decision and updates the traffic light
delays as a result. The traffic light is situated at a certain distance from the IR system. Thus
based on vehicle count, microcontroller defines different ranges for traffic light delays and
updates those accordingly.
In this system IR sensors are used to measure the density of the vehicles which are fixed
within a fixed distance. All the sensors are interfaced with the microcontroller which in turn
controls the traffic signals system according to density detected by the sensors if the traffic
density is high on particular side more priority is given for that side.
The sensors continuously keep sensing density on all sides and the green signal is given
on priority basis, where the sensors detect high density. The side with next priority level follows
the first priority level. By using this system traffic can be cleared without irregularities and time
delay even though there is no traffic on the other side can be avoided

2.2 SYSTEM MODELLING


In this section, we focus on the use of ULTRASONIC SENSOR and wireless N/W in
traffic control. A lot of scope can be gained in this idea, and intelligent traffic control attracted
several governments and commercial companies. Our main aim is to provide more secure roads
with less travel time. Such improvements will lead to health benefits, economy, and the
environment.
Figure 2.1: Prototype Of Road

 Basically in our proposed system on one side of a single lane road, the ultrasonic sound
transmitters are placed which produces ultrasonic waves and these ultrasonic transmitters
are placed at a distance ( approx 10- 15 meter gap). On the opposite side of same road the
ultrasonic receivers are placed at the same gap as that of irtransmitters which receives
the waves .
 This system will keep track of the road and whenever the series of irreceivers does not
receive the sound than it indicates the microcontroller about the density of traffic jam.
 In our proposed system ultrasonic sensors are placed on the road. When their
transmittance is disturbed by the moving vehicles they convey that message to the
microcontroller for generating results. Which will be described below in upcoming
topics.
 Unlike all others system for measuring traffic density where sensors are placed on the
road here we are installing ir sensors above the road on the foot-path and railings in
between the roads.
 The advantage of this technique is that the ultrasound will not pass below the vehicles
and conveying a wrong message to controller is be avoided.
 After that this system will also work when there is excess of water flowing on road
during rain or also above the sensors , because ultrasound can also travel in water or we
say travels faster in water according to science.
 The chances of failing this technique is very less because this system overcomes all the
possibilities that affects a signalling system.

BLOCK DIAGRAM

 In this paper we are mainly interested in the optimization of traffic flow, thus effectively
minimizing the Average travelling time of cars. A common tool for analyzing traffic is
the traffic simulator. In this section we will first describe block diagram to model traffic
controllers. We will then describe how this models can be used to obtain real-time traffic
information or predict traffic conditions. After that in this paper we describe how
information is communicated as a means of controlling traffic, and what is the effect of
the communicated data on traffic conditions will be.
Figure 2.2. Block Diagram

Basics of IR transmitter and receiver

Transmitter and receiver are commonly used in Engineering projects for remote control
of objects. In particularly, in Robotic system uses transmitter and receiver. Here i would like to
describe the basics if IR transmitter and receiver.
2.3Transmitter:

An electro luminescent IR LED is a product which requires care in use. IR LEDs are
fabricated from narrow band hetero structures with energy gap from 0.25 to 0.4 eV. Infra red
transmitter emits IR rays in planar wave front manner.

Even though Infrared rays spreads in all directions, it propagates along straight line in
forward direction. IR rays have the characteristics of producing secondary wavelets when it
collides with any obstacles in its path. This property of IR is used here.
When IR rays gets emitted from LED, it moves in the direction it is angled. When any
obstacle interferes in the path, the IR rays get cut and it produces secondary wavelets which
propagates mostly in return direction or in a direction opposite to that of the primary waves,
which produces the net result like reflection of IR rays.

2.4 IR receiver.
Infrared photo receiver is a two terminal PN junction device, which operates in a reverse
bias. It has a small transparent window, which allows light to strike the PN junction. A
photodiode is a type of photo detector capable of converting light into either current or voltage,
depending upon the mode of operation. Most photodiodes will look similar to a light emitting
diode. They will have two leads, or wires, coming from the bottom. The shorter end of the two is
the cathode, while the longer end is the anode.
A photodiode consists of PN junction or PIN structure. When a photon of sufficient
energy strikes the diode, it excites an electron thereby creating a mobile electron and a positively
charged electron hole. If the absorption occurs in the junction's depletion region, or one diffusion
length away from it, these carriers are swept from the junction by the built-in field of the
depletion region. Thus holes move toward the anode, and electrons toward the cathode, and a
photocurrent is produced.
2.5 POWER SUPPLIES
The present chapter introduces the operation of power supply circuits built using filters,
rectifiers, and then voltage regulators. Starting with an ac voltage, a steady dc voltage is obtained
by rectifying the ac voltage, then filtering to a dc level, and finally, regulating to obtain a desired
fixed dc voltage. The regulation is usually obtained from an IC voltage regulator unit, which
takes a dc voltage and provides a somewhat lower dc voltage, which remains the same even if
the input dc voltage varies, or the output load connected to the dc voltage changes.
Block diagram
The ac voltage, typically 220V rms, is connected to a transformer, which steps that ac
voltage down to the level of the desired dc output. A diode rectifier then provides a full-wave
rectified voltage that is initi-+ally filtered by a simple capacitor filter to produce a dc voltage.
This resulting dc voltage usually has some ripple or ac voltage variation.
Figure 2.3: Block diagram (Power supply)

TRANSFORMER:
Transformers convert AC electricity from one voltage to another with little loss of power.
Transformers work only with AC and this is one of the reasons why mains electricity is AC.
Step-up transformers increase voltage, step-down transformers reduce voltage. Most power
supplies use a step-down transformer to reduce the dangerously high mains voltage (230V in
UK) to a safer low voltage.
The input coil is called the primary and the output coil is called the secondary. There is
no electrical connection between the two coils, instead they are linked by an alternating magnetic
field created in the soft-iron core of the transformer. The two lines in the middle of the circuit
symbol represent the core.
Transformers waste very little power so the power out is (almost) equal to the power in.
Note that as voltage is stepped down current is stepped up.

Turns ratio = Vp / Vs = Np / Ns

Power out = power in => Vs x Is = Vp x Ip

Where, Vp = primary (input) voltage

Vs = secondary (output) voltage


Np = number of turns on primary coil

Ns = number of turns on secondary coil

Ip = primary (input) current

Is = secondary (output) current

Figure 2.4: Transformer and its output

The low voltage AC output is suitable for lamps, heaters and special AC motors. It is not
suitable for electronic circuits unless they include a rectifier and a smoothing capacitor.
A regulator circuit removes the ripples and also remains the same dc value even if the
input dc voltage varies, or the load connected to the output dc voltage changes. This voltage
regulation is usually obtained using one of the popular voltage regulator IC units.

Bridge rectifier

When four diodes are connected as shown in figure, the circuit is called as bridge
rectifier. The input to the circuit is applied to the diagonally opposite corners of the network, and
the output is taken from the remaining two corners.

Let us assume that the transformer is working properly and there is a positive potential, at
point A and a negative potential at point B. the positive potential at point A will forward bias D3
and reverse bias D4.

The negative potential at point B will forward bias D1 and reverse D2. At this time D3
and D1 are forward biased and will allow current flow to pass through them; D4 and D2 are
reverse biased and will block current flow.
The path for current flow is from point B through D1, up through RL, through D3,
through the secondary of the transformer back to point B. this path is indicated by the solid
arrows. Waveforms (1) and (2) can be observed across D1 and D3.

One-half cycle later the polarity across the secondary of the transformer reverse, forward
biasing D2 and D4 and reverse biasing D1 and D3. Current flow will now be from point A
through D4, up through RL, through D2, through the secondary of T1, and back to point A. This
path is indicated by the broken arrows. Waveforms (3) and (4) can be observed across D2 and
D4. The current flow through RL is always in the same direction. In flowing through RL this
current develops a voltage corresponding to that. Since current flows through the load (RL)
during both half cycles of the applied voltage, this bridge rectifier is a full-wave rectifier.

One advantage of a bridge rectifier over a conventional full-wave rectifier is that with a
given transformer the bridge rectifier produces a voltage output that is nearly twice that of the
conventional full-wave circuit.
This may be shown by assigning values to some of the components shown in views A
and B. assume that the same transformer is used in both circuits. The peak voltage developed
between points X and y is 1000 volts in both circuits. In the conventional full-wave circuit
shown—in view A, the peak voltage from the center tap to either X or Y is 500 volts. Since only
one diode can conduct at any instant, the maximum voltage that can be rectified at any instant is
500 volts.
The maximum voltage that appears across the load resistor is nearly-but never exceeds-
500 v0lts, as result of the small voltage drop across the diode. In the bridge rectifier shown in
view B, the maximum voltage that can be rectified is the full secondary voltage, which is 1000
volts. Therefore, the peak output voltage across the load resistor is nearly 1000 volts. With both
circuits using the same transformer, the bridge rectifier circuit produces a higher output voltage
than the conventional full-wave rectifier circuit.
Smoothing circuit
Smoothing is performed by a large value electrolytic capacitor connected across the DC
supply to act as a reservoir, supplying current to the output when the varying DC voltage from
the rectifier is falling. The diagram 2.11 shows the unsmoothed varying DC (dotted line) and the
smoothed DC (solid line). The capacitor charges quickly near the peak of the varying DC, and
then discharges as it supplies current to the output.

Figure 2.5 smoothing capacitor and its output

Smoothing is not perfect due to the capacitor voltage falling a little as it discharges,
giving a small ripple voltage.
IC voltage regulators

Voltage regulators comprise a class of widely used ICs. Regulator IC units contain the
circuitry for reference source, comparator amplifier, control device, and overload protection all
in a single IC. IC units provide regulation of either a fixed positive voltage, a fixed negative
voltage, or an adjustably set voltage. The regulators can be selected for operation with load
currents from hundreds of milli amperes to tens of amperes, corresponding to power ratings from
milli watts to tens of watts. A fixed three-terminal voltage regulator has an unregulated dc
input voltage, Vi, applied to one input terminal, a regulated dc output voltage, Vo, from a second
terminal, with the third terminal connected to ground.

The series 78 regulators provide fixed positive regulated voltages from 5 to 24 volts.
Similarly, the series 79 regulators provide fixed negative regulated voltages from 5 to 24 volts.

Voltage regulators comprise a class of widely used ICs. Regulator IC units contain the
circuitry for reference source, comparator amplifier, control device, and overload protection all
in a single IC. IC units provide regulation of either a fixed positive voltage, a fixed negative
voltage, or an adjustably set voltage. The regulators can be selected for operation with load
currents from hundreds of milli amperes to tens of amperes, corresponding to power ratings from
milli watts to tens of watts.

A fixed three-terminal voltage regulator has an unregulated dc input voltage, Vi, applied
to one input terminal, a regulated dc output voltage, Vo, from a second terminal, with the third

The series 78 regulators provide fixed positive regulated voltages from 5 to 24 volts.
Similarly, the series 79 regulators provide fixed negative regulated voltages from 5 to 24 volts.

Output Voltage (V) Minimum Vi (V)


IC Part

7805 +5 7.3

7806 +6 8.3

7808 +8 10.5

7810 +10 12.5

7812 +12 14.6

7815 +15 17.7

7818 +18 21.0

7824 +24 27.1

Table 2.1. Positive Voltage Regulators in 7800 series


Voltage regulator ICs are available with fixed (typically 5, 12 and 15V) or variable
output voltages. They are also rated by the maximum current they can pass. Negative voltage
regulators are available, mainly for use in dual supplies. Most regulators include some automatic
protection from excessive current ('overload protection') and overheating ('thermal protection').
Figure 2.6 Regulator

 For ICs, microcontroller, LCD --------- 5 volts


 For alarm circuit, op-amp, relay circuits ---------- 12 volts

Figure2.7 Circuit diagram (Power supply)


CHAPTER 3
AT89S52 Controller
AT89S52 is an 8-bit microcontroller and belongs to Atmel's 8051 family. ATMEL
89S52 has 4KB of Flash programmable and erasable read only memory (PEROM) and 128 bytes
of RAM. It can be erased and program to a maximum of 1000 times.
In 40 pin AT89S52, there are four ports designated as P1, P2, P3 and P0. All these ports
are 8-bit bi-directional ports, i.e., they can be used as both input and output ports. Except
P0 which needs external pull-ups, rest of the ports have internal pull-ups. When 1s are written to
these port pins, they are pulled high by the internal pull-ups and can be used as inputs. These
ports are also bit addressable and so their bits can also be accessed individually.
Port P0 and P2 are also used to provide low byte and high byte addresses, respectively,
when connected to an external memory. Port 3 has multiplexed pins for special functions
like serial communication, hardware interrupts, timer inputs and read/write operation from
external memory. AT89S52 has an inbuilt UART for serial communication. It can be
programmed to operate at different baud rates. Including two timers & hardware interrupts, it has
a total of six interrupts.
Pin Diagram:
Figure 5.1 AT89C51

5.1 Pin Description:


Pin No Function Name

1 P1.0

2 P1.1

3 P1.2

4 P1.3
8 bit input/output port (P1) pins
5 P1.4

6 P1.5

7 P1.6

8 P1.7

9 Reset pin; Active high Reset

Input (receiver) for serial


10 RxD P3.0
communication

Output (transmitter) for serial


11 TxD P3.1
communication

12 External interrupt 1 Int0 P3.2


8 bit input/output
13 External interrupt 2 Int1 P3.3
port (P3) pins
14 Timer1 external input T0 P3.4

15 Timer2 external input T1 P3.5

16 Write to external data memory Write P3.6

17 Read from external data memory Read P3.7

18 Crystal 2
Quartz crystal oscillator (up to 24 MHz)
19 Crystal 1

20 Ground (0V) Ground

21 8 bit input/output port (P2) pins P2.0/ A8

22 / P2.1/ A9

23 High-order address bits when interfacing with external memory P2.2/ A10

24 P2.3/ A11
25 P2.4/ A12

26 P2.5/ A13

27 P2.6/ A14

28 P2.7/ A15

29 Program store enable; Read from external program memory PSEN

Address Latch Enable ALE


30
Program pulse input during Flash programming Prog

External Access Enable; Vcc for internal program executions EA


31
Programming enable voltage; 12V (during Flash programming) Vpp

32 P0.7/ AD7

33 P0.6/ AD6

34 8 bit input/output port (P0) pins P0.5/ AD5

35 P0.4/ AD4

36 Low-order address bits when interfacing with external memory P0.3/ AD3

37 P0.2/ AD2

38 P0.1/ AD1

39 P0.0/ AD0

40 Supply voltage; 5V (up to 6.6V) Vcc

Table 5.1 AT89C51pin


CHAPTER 4
IR SENSORS

Basics of IR transmitter and receiver

Transmitter and receiver are commonly used in Engineering projects for remote control
of objects. In particularly, in Robotic system uses transmitter and receiver. Here i would like to
describe the basics if IR transmitter and receiver.
6.1 Transmitter:

An electro luminescent IR LED is a product which requires care in use. IR LEDs are
fabricated from narrow band hetero structures with energy gap from 0.25 to 0.4 eV. Infra red
transmitter emits IR rays in planar wave front manner.

Even though Infra red rays spreads in all directions, it propagates along straight line in
forward direction. IR rays have the characteristics of producing secondary wavelets when it
collides with any obstacles in its path. This property of IR is used here.

When IR rays gets emitted from LED, it moves in the direction it is angled. When any
obstacle interferes in the path, the IR rays get cut and it produces secondary wavelets which
propagates mostly in return direction or in a direction opposite to that of the primary waves,
which produces the net result like reflection of IR rays.
6.2 IR receiver.
Infrared photo receiver is a two terminal PN junction device, which operates in a reverse
bias. It has a small transparent window, which allows light to strike the PN junction. A
photodiode is a type of photo detector capable of converting light into either current or voltage,
depending upon the mode of operation. Most photodiodes will look similar to a light emitting
diode. They will have two leads, or wires, coming from the bottom. The shorter end of the two is
the cathode, while the longer end is the anode.
A photodiode consists of PN junction or PIN structure. When a photon of sufficient
energy strikes the diode, it excites an electron thereby creating a mobile electron and a positively
charged electron hole. If the absorption occurs in the junction's depletion region, or one diffusion
length away from it, these carriers are swept from the junction by the built-in field of the
depletion region. Thus holes move toward the anode, and electrons toward the cathode, and a
photocurrent is produced.

They do dozens of different jobs and are found in all kinds of devices. Among other things, they form
the numbers on digital clocks, transmit information from remote controls, light up watches and tell you when
your appliances are turned on. Collected together, they can form images on a jumbo television screen or illuminate
a traffic light.
Figure 6.1 IR Sensors
CHAPTER 6
SOFTWARE DESCRIPTION

6.1 KEIL COMPILER

Keil compiler is software used where the machine language code is written and compiled.
After compilation, the machine source code is converted into hex code which is to be dumped
into the microcontroller for further processing. Keil compiler also supports C language code.

It’s important that you know C language for microcontroller which is commonly known
as Embedded C. As we are going to use Keil C51 Compiler, hence we also call it Keil C.

Keil C is not much different from a normal C program. If you know assembly, writing a C
program is not a crisis. In keil, we will have a main function, in which all your application
specific work will be defined. In case of embedded C, you do not have any operating system
running in there. So you have to make sure that your program or main file should never exit. This
can be done with the help of simple while (1) or for (;;) loop as they are going to run infinitely.

We have to add header file for controller you are using, otherwise you will not be able to
access registers related to peripherals.

#include <REG51.h> //header file for 89C51

To create a project, write and test the previous example source code, follow the following steps:

1. Open Keil and start a new project as shown in figure 6.1


Figure 6.1 Creating new project

2. You will be prompted to choose a name for your new project, Create a separate folder where
all the files of your project will be stored, choose a name and click save. The following figure 6.2
will appear where you will be asked to select a device for Target 'Target 1':
Figure 6..2 Creating target

3. From the list at the left, seek for the brand name ATMEL, then under ATMEL, select
AT89S52. You will notice that a brief description of the device appears on the right. Leave the
two upper check boxes unchecked and click OK. The AT89S52 will be called your 'Target
device', which is the final destination of your source code. You will be asked whether to 'copy
standard 8051 startup code' click No.
4. Click File, New, and something similar to the following figure 6.3 should appear. The box
named 'Text1' is where your code should be written later.

Figure 6.3 Creating a file

5. Now you have to click 'File, Save as' and choose a file name for your source code ending with
the letter '.c'. You can name as 'code.c' for example and click save. Then you have to add this file
to your project work space at the left as shown in the following figure 6.4.
Fig 6.4 Adding files to the source group

6.After right-clicking on 'source group 1', click on 'Add files to group...', then you will be
prompted to browse the file to add to 'source group 1', choose the file that you just saved,
eventually 'code.c' and add it to the source group. You will notice that the file is added to the
project.
7. In some versions of this software you have to turn ON manually the option to generate HEX
files. make sure it is turned ON, by right-clicking on target 1, Options for target 'target 1',
then under the 'output' tab, by checking the box 'generate HEX file'. This step is very important
as the HEX file is the compiled output of your project that is going to be transferred to the
microcontroller.
8. You can then start to write the source code in the figure 6.5 titled 'code.c' then before testing
your source code; you have to compile your source code, and correct eventual syntax errors. In
KEIL IDE, this step is called 'rebuild all targets' and has this icon.

Fig 6.5 Rebuilding targets

9. If after rebuilding the targets, the 'output window' shows that there is 0 errors, then you are
ready to test the performance of your code. In keil, like in most development environment, this
step is called Debugging, and has this icon. After clicking on the debug icon, you will notice that
some part of the user interface will change; some new icons will appear, like the run icon circled
in the following figure 6.6.

Figure 6.6Debugging

10. You can click on the 'Run' icon and the execution of the program will start. In our example,
you can see the behavior of the pin 0 or port one, but clicking on 'peripherals, I/O ports, Port 1'.
You can always stop the execution of the program by clicking on the stop button and you can
simulate a reset by clicking on the 'reset' button. You can also control the execution of the
program using the following icons: which allows you to follow the execution step by step. Then,
when you're finished with the debugging, you can always return to the programming interface
by clicking again on debug button
6.2 PROLOAD

Proload is software which accepts only hex files. Once the machine code is converted
into hex code, that hex code has to be dumped into the microcontroller and this is done by the
Proload. Proload is a programmer which itself contains a microcontroller in it other than the one
which is to be programmed. This microcontroller has a program in it written in such a way that it
accepts the hex file from the keil compiler and dumps this hex file into the microcontroller which
is to be programmed. As the proload programmer kit requires power supply to be operated, this
power supply is given from the power supply circuit designed above. It should be noted that this
programmer kit contains a power supply section in the board itself but in order to switch on that
power supply, a source is required. Thus this is accomplished from the power supply board with
an output of 12volts.

CHAPTER 7
Result Analysis
Results include the successful operation of the traffic control and monitoring system. The
system contains three IR transmitter and IR receiver for traffic density measurement which are
mounted on the either sides of roads respectively. The IR system gets activated whenever any
vehicle passes on road between IR sensors.

When one sensor will be ON at that time density will be less when two sensors will be
ON at that traffic density is medium when all 3 sensor will be ON at that time density will be
high. Microcontroller controls the IR system and counts number of vehicles passing on road.
Based on different vehicles count, the microcontroller takes decision and updates the traffic light
delays as a result.

Case 1:In the first case road one has density and green light appears for road 1

Figure 7.1 Road 1 analysis


Case 2:In this case density occurs at road 2 and remaining road 1, road 3, road 4 has red
lights.

Figure 7.2 Road 2 analysis

Case 3:In this case density occurs at road 3 and red light occurs for road1,road2,road4.

Figure 7.3 Road 3 analysis


Case4:In this case density occurs at road 4 and red light occurs for road 1,road2 road3.

Figure 7.4 Road 4 analysis

CODE:
#include<reg52.h>
#include<lcddisplay.h>

sbit r_led1=P1^0;
sbit g_led1=P1^1;

sbit r_led2=P1^2;
sbit g_led2=P1^3;

sbit r_led3=P1^4;
sbit g_led3=P1^5;

sbit r_led4=P1^6;
sbit g_led4=P1^7;

sbit ir1=P3^0;
sbit ir2=P3^1;
sbit ir3=P3^2;
sbit ir4=P3^3;

unsigned int k,W=0,E=0,i;


void delay(unsigned int );
void East(void);
void West(void);
void North(void);
void South(void);

void main()
{
r_led1=r_led2=r_led3=r_led4=1;
g_led1=g_led2=g_led3=g_led4=1;
lcd_init();
lcdcmd(0x01);
msgdisplay(" WELCOME TO ");
lcdcmd(0x01);
msgdisplay(" DENSITY BASED ");
lcdcmd(0xc0);

msgdisplay("TRAFFIC SIGNAL SYSTM");


delay(200);
lcdcmd(0x01);
lcdcmd(0x88);
msgdisplay("V:");
while(1)
{
start:

E=W=0;
lcdcmd(0xca);
msgdisplay(" ");
lcdcmd(0x8a);
lcddata(E/1000+48); //// for disply adc data.....
lcddata((E/100)%10+48);
lcddata((E/10)%10+48);
lcddata(E%10+48);

lcdcmd(0xc0);
lcddata(E/1000+48); //// for disply adc data.....
lcddata((E/100)%10+48);
lcddata((E/10)%10+48);
lcddata(E%10+48);

if(ir1==1 || ir2==1)
goto density;
East();
delay(200);

if(ir1==1 || ir2==1)
goto density;
North();
delay(200);

if(ir1==1 || ir2==1)
goto density;
West();
delay(200);

if(ir1==1 || ir2==1)
goto density;
South();
delay(200);

density:
if(ir1==1 && ir2==0)
{
for(i=0;i<=9;i++)
{
if(ir1==1 && ir2==0)
{
lcdcmd(0x80);
msgdisplay("EAST ");
lcdcmd(0xca);
msgdisplay("EAST ");
E++;
lcdcmd(0x8a);
lcddata(E/1000+48); //// for disply adc data.....
lcddata((E/100)%10+48);
lcddata((E/10)%10+48);
lcddata(E%10+48);
}
}
for(i=1;i<=E;i++)
{
East();
lcdcmd(0xc0);
lcddata(i/1000+48); //// for disply adc data.....
lcddata((i/100)%10+48);
lcddata((i/10)%10+48);
lcddata(i%10+48);
}
}
if(ir1==0 && ir2==1)
{
for(i=0;i<=9;i++)
{
if(ir1==0 && ir2==1)
{
lcdcmd(0xca);
msgdisplay("WEST ");
lcdcmd(0x80);
msgdisplay("WEST ");
W++;
lcdcmd(0x8a);
lcddata(W/1000+48); //// for disply adc data.....
lcddata((W/100)%10+48);
lcddata((W/10)%10+48);
lcddata(W%10+48);

}
}
for(i=1;i<=W;i++)
{
West();
lcdcmd(0xc0);
lcddata(i/1000+48); //// for disply adc data.....
lcddata((i/100)%10+48);
lcddata((i/10)%10+48);
lcddata(i%10+48);
}
}

else
goto start;

}
}

/*
void delay(unsigned int i)
{
unsigned int j,k;
for(j=0;j<=i;j++)
for(k=0;k<=1275;k++);
}
*/
void East(void)
{
lcdcmd(0x80);
msgdisplay("EAST ");

g_led1=0;
g_led2=1;
g_led3=1;
g_led4=1;
r_led1=1;
r_led2=0;
r_led3=0;
r_led4=0;
}

void West(void)
{
lcdcmd(0x80);
msgdisplay("WEST ");

g_led1=1;
g_led2=0;
g_led3=1;
g_led4=1;

r_led1=0;
r_led2=1;
r_led3=0;
r_led4=0;
}

void North(void)
{
lcdcmd(0x80);
msgdisplay("NORTH");
g_led1=1;
g_led2=1;
g_led3=0;
g_led4=1;

r_led1=0;
r_led2=0;
r_led3=1;
r_led4=0;
}

void South(void)
{
lcdcmd(0x80);
msgdisplay("SOUTH ");
g_led1=1;
g_led2=1;
g_led3=1;
g_led4=0;

r_led1=0;
r_led2=0;
r_led3=0;
r_led4=1;
}
/*
lcddata(i/1000+48); //// for disply adc data.....
lcddata((i/100)%10+48);
lcddata((i/10)%10+48);
lcddata(i%10+48);
*/

CONCLUSIONS AND FUTURE SCOPE

In this paper we have studied the optimization of traffic light controller in a City using
8051 and microcontroller. The 8051 based traffic control system works on traffic related
problems such as traffic jam; unreasonable latency time of stoppage of vehicle, emergency
vehicles or forcibly passing, etc can be solved.

By using this system configuration we tries to reduce the possibilities of traffic jams,
caused by traffic lights. Number of passing vehicle in the fixed time slot on the road decide the
density range of traffics and on the basis of vehicle density calculation, microcontroller decide
the traffic light delays.
Bibiliography

 Fundamentals of Micro processors and Micro computers -B.Ram


 Electronic Components -D.V. Prasad
 Wireless Communications - Theodore S .Rappaport
 Embedded System By Raj Kamal

Web References:

 http://www.national.com
 http://www.nxp.com
 http://www.microsoftsearch.com
 http://www.geocities.com
 http://www.Electronic projects.com

Das könnte Ihnen auch gefallen