Top Banner
1 CHAPTER 1 INTRODUCTION 1.1 OBJECTIVE OF THE PROJECT Our project aims at reducing traffic congestion and unwanted long time delay during the traffic light switch overs especially when the traffic is very low. It is designed to be implemented in places nearing the junctions where the traffic signals are placed, in order to reduce the congestion in these junctions. It keeps a track of the vehicles in each road and accordingly adjusts the time for each traffic light signals. The higher the number of vehicles on the road the longer will be the time delay allotted for that corresponding traffic light signal. 1.2 OVERVIEW The overview of this project is to implement Density based traffic control system using IR technology and 89C51 microcontroller. 89C51 has very efficient architecture which can be used for low end security systems and IR is widely adapted technology for communication. 1.3 PURPOSE Purpose of the current work is to study and analyse the counting and controlling system by using 89C51 controller. 1.4 SCOPE Current work focuses on how to use effectively IR and 89C51 controllers for digital security systems.
70
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Density based traffic light control

1

CHAPTER 1

INTRODUCTION

1.1 OBJECTIVE OF THE PROJECT

Our project aims at reducing traffic congestion and unwanted long time delay during the

traffic light switch overs especially when the traffic is very low. It is designed to be implemented in

places nearing the junctions where the traffic signals are placed, in order to reduce the congestion in

these junctions. It keeps a track of the vehicles in each road and accordingly adjusts the time for

each traffic light signals. The higher the number of vehicles on the road the longer will be the time

delay allotted for that corresponding traffic light signal.

1.2 OVERVIEW

The overview of this project is to implement Density based traffic control system using IR

technology and 89C51 microcontroller. 89C51 has very efficient architecture which can be used

for low end security systems and IR is widely adapted technology for communicat ion.

1.3 PURPOSE

Purpose of the current work is to study and analyse the counting and controlling system by

using 89C51 controller.

1.4 SCOPE

Current work focuses on how to use effectively IR and 89C51 controllers for digital

security systems.

Page 2: Density based traffic light control

2

1.5 PROBLEM FORMULATION

The problem with the traffic system is that for every minute the vehicles at the 4-way road

will be heavy and the traffic lights shall be changed to each side for some fixed time. Even though

there are no vehicles at particular side, the traffic signals will glow for given fixed time. Due to

that there is time waste process. Due to this other side vehicles have to wait for the time to

complete the process. So to reduce the wastage of time, we can implement the system that

controls the traffic based on the heavy flow of vehicles at any particular side. With this system,

we shall count the number of vehicles at each side at the junction and give the path to the

particular side which has heavy flow of vehicles and keep remaining stop position. So that for

this to count the number of vehicles at side of the junction, we shall use IR technology

1.6 DESCRIPTION OF PROJECT

1.6.1 Existing System

Nowadays traffic lights are set on in the different directions with fixed time delay, following a

particular cycle while switching from one signal to other. This creates unwanted congestion during

peak hours. This is a time consuming system.

1.6.2 Proposed System

Our project density based traffic light control is an automated way of controlling signals in

accordance to the density of traffic in the roads. IR sensors are placed in the entire intersecting road

at fixed distances from the signal placed in the junction. The time delay in the traffic signal is set

based on the density of vehicles on the roads.

The IR sensors are used to sense the number of vehicles on the road. According to the IR count,

microcontroller takes appropriate decisions as to which road is to be given the highest priority and

the longest time delay for the corresponding traffic light.

Page 3: Density based traffic light control

3

1.7 PROCESS DESCRIPTION

As per our process diagram, initially the signals are started by giving the power supply. The

first step is to make sure that the signals are all in ON condition. During this all the traffic signals

will blink in yellow light. This indicates that they are all in the working condition.

The next step is to check for the density of traffic in these roads. By density what we are

trying to mean in that the number of vehicles available in a particular at a certain period of time.

The density is calculated over here by means of using an IR circuit. Depending on the number of

vehicles that cut the light travelling from the receiver to transmitter of the IR circuit the count of the

vehicles is registered in the microcontroller.

This is followed by the next step in which the microcontroller decides as to which road should

be given the highest priority. This is based on the density of traffic on each road and also it depends

on the speed at which an IR circuit registers the count.

The very next step is to assign time delays for each road. The time delays have already been

set for certain specific counts in the microcontroller. As soon as the microcontroller receives the

counts from the IR circuit it will immediately detect the density of each road and accordingly allot

the time delays for which each signal will show the green light. The higher the traffic density, the

longer will be the time delay allotted.

In the final step, the microcontroller makes sure that the lowest density road is also opened

and that the delay of the green light for that particular signal also comes to an end. Once all the

roads are opened in a sequence, then the microcontroller again goes back to the second step where it

checks for the density of traffic in each road. The whole process is repeated like a cycle. The main

point that is to be noted regarding this process is that, whenever a particular road has no traffic,

correspondingly, the yellow light in the traffic signal will glow.

Page 4: Density based traffic light control

4

FIGURE 1.1: Process diagram

Page 5: Density based traffic light control

5

1.8 PARAMETERS CONSIDERED

Density of roads

Density of roads is classified as:

Low

Medium

High

Priority of roads

If two or more roads of equal high priority any one road is opened.

If all roads are having no traffic, yellow signal appears.

No road is allowed to be closed continuously for more than maximum duration

Without considering the density.

Delay of roads

The delay of each road is chosen according to the density

Low-20seconds

Medium-30seconds

High-60seconds

Page 6: Density based traffic light control

6

1.9 BLOCK DIAGRAM

FIGURE 1.2: BLOCK DIAGRAM

Page 7: Density based traffic light control

7

CHAPTER-2

SURVEY REPORT

2.1 SUFFERINGS

FIGURE 2.1: SUFFERED FROM TRAFFIC CONGESTION VS NOT SUFFERED

FROM TRAFFIC CONGESTION

97%

3%

0

20

40

60

80

100

120

suffered traffic congestion not suffered

Series 1

Page 8: Density based traffic light control

8

2.2 TROUBLE VS SATISFACTION

FIGURE 2.2: TROUBLE VS SATISFACTION WITH THE CURRENT SYSTEM

94%

6%

problem with the current system

satisfied with the current system

Page 9: Density based traffic light control

9

2.3 PUBLIC’S OPINION

FIGURE 2.3: WASTING FUEL VS WASTING TIME

0

10

20

30

40

50

60

70

80

wasting timewasting fuel

79%

21%

publics opinion

Page 10: Density based traffic light control

10

CHAPTER-3

LITERATURE SURVEY

3.1 EMBEDDED SYSTEMS

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

dedicated functions, often 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 control many of the common devices in use today.

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 economics of scale. Physically, embedded

systems range from portable devices such as digital watches and mp4 players, to large stationary

installations like traffic lights, factory controllers, or the systems controlling nuclear power

stations. 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.

Page 11: Density based traffic light control

11

3.2 CHARACTERISTICS

1. Embedded systems are designed to do some specific task, rather than be a general-purpose

computer for multiple tasks. Some also have real-time performance constraints that must be met,

for reasons such as safety and usability; others may have low or no performance requirements,

allowing the system hardware to be simplified to reduce costs.

2. Embedded systems are not always standalone devices. Many embedded systems consist of

small, computerized parts within a larger device that serves a more general purpose. For example,

the features an embedded system for tuning the strings, but the overall purpose of the Robot Guitar

is, of course, to play music. Similarly, an embedded system in automobiles provides a specific

function as a subsystem of the car itself.

3. The program instructions written for embedded systems are referred to as firmware, and are

stored in read-only memory or flash memory chips. They run with limited computer hardware

resources: little memory, small or non-existent keyboard and/or screen.

FIGURE 3.1 A TYPICAL EMBEDDED SYSTEM BLOCK DIAGRAM

Page 12: Density based traffic light control

12

3.3 MICROCONTROLLER

Microcontroller is a general purpose device, which integrates a number of the components

of a microprocessor system on to a single chip. It has inbuilt CPU, memory and peripherals to

make it as a mini computer. A microcontroller combines on to the same microchip:

The CPU core

Memory (both ROM and RAM)

Some parallel digital i/o

Microcontrollers will combine other devices such as:

A timer module to allow the microcontroller to perform tasks certain time periods.

A serial I/O port to allow data to flow between the controller and other devices such as a

PIC or another microcontroller.

An ADC to allow the microcontroller to accept analog input data processing.

Microcontrollers are:

Smaller in size

Consume less power

Inexpensive

Microcontroller is a standalone unit, which can perform functions on its own without any

requirement for additional hardware like I/O ports and external memory.

The heart of the microcontroller is the CPU core. In the past, this has traditionally been

based on an 8-bit microprocessor unit. For example, Motorola uses a basic 6800 microprocessor

core in their 6805/6808 microcontroller devices.

In the recent years microcontrollers have been developed around specifically designed CPU

cores, for example the microchip PIC range of microcontrollers.

The micro controller, nowadays, is an indispensable device for electrical/electronic

engineers and also for technicians in the area, because of its versatility and its enormous

application. .Born of parallel developments in computer architecture and integrated circuit

fabricat ion, the microprocessor or computer on chip first becomes a commercial reality in 1971.

Page 13: Density based traffic light control

13

With the introduction of the 4 bit 4004 by a small, unknown company by the name of Intel

Corporation. Other, well established, semiconductor firms soon followed Intel's pioneering

technology so that by the late 1970's we could choose from a half dozen or so micro processor

type. The 1970s also saw the growth of the number of personal computer users from a Handful of

hobbyists and hackers to millions of business, industrial, governmental, defense, and educational

and private users now enjoying the advantages of inexpensive computing.

A bye product of microprocessor development was the micro controller. The same

fabrication techniques and programming concepts that make possible general-purpose

microprocessor also yielded the micro controller.

Among the applications of a micro controller we can mention industrial automation,

mobile telephones, radios, microwave ovens and VCRs. Besides, the present trend in digital

electronics is toward restricting to micro controllers and chips that concentrate a great quantity of

logical circuits, like PLDs (Programmable Logic Devices) and GALs (Gate Array Logic). In

dedicated systems, the micro controller is the best solution, because it is cheap and easy to

manage.

3.4 COMMUNICATION

Communication refers to the sending, receiving and processing of information by

electric means. As such, it started with wire telegraphy in the early 80's, developing with

telephony and radio some decades later. Radio communication became the most widely used

and refined through the invention of and use of transistor, integrated circuit, and other semi-

conductor devices. Most recently, the use of satellites and fiber optics has made

communication even more wide spread, with an increasing emphasis on computer and other

data communications.

A modern communications system is first concerned with the sorting, processing and

storing of information before its transmission. The actual transmission then follows, with

further processing and the filtering of noise. Finally we have reception, which may include

processing steps such as decoding, storage and interpretation. In this context, forms of

communications include radio, telephony and telegraphy, broadcast, point to point and mobile

communications (commercial and military), computer communications, radar, radio telemetry

and radio aids to navigation. It is also important to consider the human factors influencing a

particular system,

Page 14: Density based traffic light control

14

Since they can always affect its design, planning and use. Wireless communication has

become an important feature for commercial products and a popular research topic within the last

ten years. There are now more mobile phone subscriptions than wired-line subscriptions. Lately,

one area of commercial interest has been low-cost, low-power, and short-distance wireless

communication used for personal wireless networks." Technology advancements are providing

smaller and more cost effective devices for integrating computational processing, wireless

communication, and a host of other functionalities. These embedded communications devices will

be integrated into applications ranging from homeland security to industry automation and

monitoring. They will also enable custom tailored engineering solutions, creating a

revolutionary way of disseminating and processing information. With new technologies and

devices come new business activities, and the need for employees in these technological areas.

Engineers who have knowledge of embedded systems and wireless communications will be in

high demand. Unfortunately, there are few adorable environments available for development and

classroom use, so students often do not learn about these technologies during hands-on lab

exercises. The communication mediums were twisted pair, optical fiber, infrared, and generally

wireless radio.

3.5 IR REMOTE THEORY

IR sensor is the combination of IR LED with Photo Diode. After this combination we

are connecting the Darlington Pair Transistor. End of the IR sensor we have to connect a

NOT gate for the inverting purpose means low input have corresponding low output. At last

this entire connector is connected to any one external interrupt to generating the interruption

of the main program.

Infra-Red actually is normal light with a particular colour. We humans can't see this

colour because its wave length of 950nm is below the visible spectrum. That's one of the reasons

why IR is chosen for remote control purposes, we want to use it but we're not interested in seeing

it. Another reason is because IR LEDs are quite easy to make, and therefore can be very cheap.IR

LED wave length range 1.6m to 7.4m. Materials used for IR LED are InSB, Ge,Si, GaAs, CdSe .

This IR is not in visible range for observation purpose.

Page 15: Density based traffic light control

15

CHAPTER-4

SYSTEM SPECIFICATION

4.1 89C51 MICROCONTROLLER

4.1.1 Features

Compatible with MCS 51™ Products

4K Bytes of In System Reprogrammable Flash Memory

Endurance: 1,000 Write/Erase Cycles

Fully Static Operation: 0 Hz to 24 MHz

Three level Program Memory Lock

128 x 8·bit Internal RAM

32 Programmable I/O Lines

Two 16·bit Timer/Counters

Six Interrupt Sources

Programmable Serial Channel

Low power Idle and Power down Modes

4.1.2 Description

The AT89C51 is a low-power, high-performance CMOS 8-bit microcomputer with 4K

bytes of Flash programmable and erasable read only memory (PEROM). The device is

manufactured using Atmel's high-density non-volatile memory technology and is compatible

with the industry-standard MCS-51 instruction set and pinout. The on-chip Flash allows the

program memory to be reprogrammed in-system or by a conventional non-volatile memory

programmer. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel

AT89C51 is a powerful microcomputer which provides a highly-flexible and cost-effective

solution to many embedded control applications.

Page 16: Density based traffic light control

16

4.1.3 Architecture

FIGURE4.1 ARCHITECTURE OF 89C51 MICROCONTROLLER

Page 17: Density based traffic light control

17

4.1.4 Pin configurations

FIGURE 4.2: PIN CONFIGURATION

Page 18: Density based traffic light control

18

4.1.5 Pin descriptions

VCC

Pin 40 provides +5v input supply voltage

PORT 0

Port 0 is an 8-bit open drain bidirectional I/O port. As an output port, each pin can sink

eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high impedance

inputs. Port 0 can also be configured to be the multiplexed low order address/data bus during

accesses to external program and data memory. In this mode, P0 has internal pull ups. Port 0 also

receives the code bytes during Flash programming and outputs the code bytes during program

verification. External pull ups are required during program verification.

PORT 1

Port 1 is an 8-bit bidirectional I/O port with internal pull ups. The Port 1 output buffers

can sink/source four TTL inputs. When 1s are written to Port 1 pins, they are pulled high by the

internal pull ups and can be used as inputs. As inputs, Port 1 pins that are externally being

pulled low will source current (IIL) because of the internal pull ups. In addition, P1.0 and P1.1

can be configured to be the timer/counter 2 external count input (P1.0/T2) and the timer/counter 2

trigger input (P1.1/T2EX).Port 1 also receives the low-order address bytes during Flash

programming and verification

PORT 2

Port 2 is an 8-bit bidirectional I/O port with internal pull ups. The Port 2 output buffers

can sink/source four TTL inputs. When 1s are written to Port 2 pins, they are pulled high by the

internal pull- ups and can be used as inputs. As inputs, Port 2 pins that are externally being

pulled low will source current (IIL) because of the internal pull-ups.

Page 19: Density based traffic light control

19

Port 2 emits the high-order address byte during fetches from external program

memory and during accesses to external data memory that uses 16-bit addresses (MOVX

@ DPTR). In this application, Port 2 uses strong internal pull-ups when emitting 1s. During

accesses to external data memory that uses 8-bit addresses (MOVX @ RI), Port 2 emits the

contents of the P2 Special Function Register.

Port 2 also receives the high-order address bits and some control signals during

Flash programming and verification.

PORT 3

Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 3 output buffers

can sink/source four TTL inputs. When 1s are written to Port 3 pins, they are pulled high by the

internal pull- ups and can be used as inputs. As inputs, Port 3 pins that are externally being

pulled low will source current (IIL) because of the pull-ups.

Port 3 also serves the functions of various special features of the AT89S52, as shown in the

following table.

TABLE 4.1: PORT 3 FUNCTIONS

Port Pin Alternate Functions

P3.0 RXD (serial input port)

P3.1 TXD (serial output port)

P3.2 INT0 (external interrupt 0)

P3.3 INT1 (external interrupt 1)

P3.4 T0 (timer 0 external input)

P3.5 T1 (timer 1 external input)

P3.6 WR (external data memory write

strobe) P3.7 RD (external data memory read strobe)

Port 3 also receives some control signals for Flash programming and verification.

RST

Reset input. A high on this pin for two machine cycles while the oscillator is running

resets the device. This pin drives High for 96 oscillator periods after the Watchdog times out.

The DISRTO bit in SFR AUXR (address 8EH) can be used to disable this feature. In the

default state of bit DISRTO, the RESET HIGH out feature is enabled

Page 20: Density based traffic light control

20

ALE/PROG

Address Latch Enable (ALE) is an output pulse for latching the low byte of the

address during accesses to external memory. This pin is also the program pulse input

(PROG) during flash programming.

In normal operation, ALE is emitted at a constant rate of 1/6 the oscillator frequency and

may be used for external timing or clocking purposes. Note, however, that one ALE pulse is

skipped during each access to external data memory.

.

PSEN

Program Store Enable (PSEN) is the read strobe to external program memory. When the

AT89S52 is executing code from external program memory, PSEN is activated twice each

machine cycle, except that two PSEN activations are skipped during each access to external data

memory.

EA/VPP

External access enables. EA must be strapped to GND in order to enable the device to

fetch code from external program memory locations starting at OOOOH up to FFFFH. Note,

however, that if lock bit 1 is programmed, EA will be internally latched on reset. EA should be

strapped to VCC for internal program executions. This pin also receives the 12-volt

programming enable voltage (VPP) during Flash programming.

XTALl

Input to the inverting oscillator amplifier

XTAL2

Output from the inverting oscillator amplifier

4.1.6 Oscillator Characteristics

XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier which

can be configured for use as an on-chip oscillator, as shown in Figure 4.3. Either a quartz crystal or

ceramic resonator may be used. To drive the device from an external clock source, XTAL2

should be left unconnected while XTAL1 is driven as shown in Figure 4.4.

Page 21: Density based traffic light control

21

There are no requirements on the duty cycle of the external clock signal, since the input to the

internal clocking circuitry is through a divide by two flip-flops, but minimum and maximum voltage

high and low time specificatio ns must be observed.

4.1.7 Power memory lock bits

On the chip are three lock bits which can be left unprogrammed (U) or can be programmed

(P) to obtain the additional features listed in the table below.

When lock bit is programmed, the logic level at the EA pin is sampled and latched during

reset. If the device is powered up without a reset, the latch initializes to a random value, and holds

the value until reset is activated. It is necessary that the latched value of EA be in agreement wi

the current logic level at that pin in order for the device to function properly.

TABLE 4.2: PROGRAM LOCK BITS AND ITS PROTECTION

Program Lock Bits

Protection Type LB

1

LB

2

LB

3

1 U u u No program lock features

2 P u u MOV instructions executed from external program memory

are disabled from fetching code bytes from internal memory,

EA is sampled and latched on reset, and further programming

of the Flash is disabled

3 P p u Same as mode 2, also verify is disabled

4 P p p Same as mode 3, also external execution is disabled

FIGURE 4. 3: OSCILLATOR CONNECTIONS

C2

C1

XTAL1

XTAL1

GND

FIGURE 4. 4: EXTERNAL CLOCK DRIVE

CONFIGURATION

NC

Page 22: Density based traffic light control

22

4.2 MODES

4.2.1 Idle Mode

In idle mode, the CPU puts itself to sleep while all the on- chip peripherals remain

active. The mode is invoked by software. The content of the on-chip RAM and all the special

functions registers remain unchanged during this mode. The idle mode can be terminated

by any enabled interrupt or by a hardware reset.

It should be noted that when idle is terminated by a hard ware reset, the device normally

resumes program execution, from where it left off, up to two machine cycles before the internal

reset algorithm takes control. On-chip hardware inhibits access to internal RAM in this event,

but access to the port pins is not inhibited.

To eliminate the possibility of an unexpected write to a port pin when Idle is terminated by

reset, the instruction following the one that invokes Idle should not be one that writes to a

port pin or to external memory.

4.2.2 Power-down Mode

In the power-down mode, the oscillator is stopped, and the instruction that invokes power-

down is the last instruction executed. The on-chip RAM and Special Function Registers retain

their values until the power-down mode is terminated. The only exit from power-down is a

hardware reset. Reset redefines the SFRs but does not change the on-chip RAM. The reset

should not be activated before VCC is restored to its normal operating level and must be held

active long enough to allow the oscillator to restart and stabilize.

TABLE 4.3: Status of External Pins during Idle and Power-down Modes

Mode Program

Memory

ALE PSEN PORTO PORT1 PORT2 PORT3

Idle Internal 1 1 Data Data Data Data

Idle External 1 1 Float Data Address Data

Power-

down

Internal 0 0 Data Data Data Data

Power-

down

External 0 0 Float Data Data Data

Page 23: Density based traffic light control

23

4.3 PROGRAMMING THE FLASH

The AT89C51 is normally shipped with the on-chip Flash memory array in the erased

state (that is, contents = FFH) and ready to be programmed. The programming interface accepts

either a high-voltage (12-volt) or a low-voltage (VCC) program enable signal. The low-

voltage programming mode provides a convenient way to program the AT89C51 inside the

user's system, while the high-voltage programming mode is compatible with conventional third-

party Flash or EPROM programmers.

The AT89C51 is shipped with either the high-voltage or low-voltage programming

mode enabled. The respective top-side marking and device signature codes are listed in the

following table.

TABLE 4.4: DEVICE SIGNATURE CODES

VPP = 12V

VPP = 5V

Top-side

Mark

AT89C51

xxxx yyww

AT89C51

xxxx-5 yyww

Signature

(030H) = 1EH

(031H) = 51H

(032H) = FFH

(030H) = 1EH

(031H) = 51H

(032H) = 05H

Page 24: Density based traffic light control

24

4.4 UART

Serial data communication uses two methods, asynchronous and synchronous. The

synchronous method transfers a block of data (characters) at a time, while the asynchronous

method transfers a single byte at a time. It is possible to write software to use either of these

methods, but programs can be tedious and long. For this reason, there are special IC chips made

by the manufacturers for the serial data communications. These chips are commonly referred to as

UART (universal asynchronous receiver- transmitter) and USART (universal synchronous

receiver-transmitter).

Page 25: Density based traffic light control

25

CHAPTER-5

PERIPHERAL DEVICES

5.1 INFRARED LED

IR sensor is the combination of IR LED with PHOTO DIODE. After this combination

we are connecting the DARLINGTON PAIR TRANSISTOR. End of the IR sensor we have to

connect a NOT gate for the inverting purpose means low input have corresponding low output

Infra-Red actually is normal light with a particular colour. We humans can't see this colour

because its wave length of 950nm is below the visible spectrum. That's one of the reasons why

IR is chosen for remote control purposes, we want to use it but we're not interested in seeing it.

Another reason is because IR LEDs are quite easy to make, and therefore can be very cheap.

Although we humans can't see the Infra-Red light emitted from a remote control doesn't

mean we can't make it visible. A video camera or digital photo camera can "see" the Infra-Red

light as you can see in this picture. If you own a web cam, point your remote to it, press any

button and you‘ll see the LED flicker. They do dozens of different jobs and are found in all kind

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 from images on a jumbo television screen or illuminate a traffic

light.

FIGURE: 5.1 IR LED USED IN REMOTE CONTROL

Page 26: Density based traffic light control

26

5.1.1 Darlington pair

An emitter follower offers high impedance of 500Kohms. For applications requiring still

higher input impedance, we may use what is called Darlington in place of conventional transistor.

This Darlington pair basically consists of two transistors cascaded in cc configuration. In the

figure shown below the input impedance of the second transistor constitutes the load impedance

of the first.

We thus conclude that in comparison with a conventional single transistor emitter follower

has in higher current gain, higher input impedance and almost the same voltage gain lower out

put impedances.

FIGURE: 5.2 Darlington Pair

5.2 MODULATION

Modulation is the answer to make our signal stand out above the noise. With

modulation we make the IR light source blink in a particular frequency. The IR receiver will

be tuned to that frequency, so it can ignore everything else. You can think of this blinking as

attracting the receiver's attention. We humans also notice the blinking of yellow lights at

construction sites instantly, even in bright daylight.

Page 27: Density based traffic light control

27

In the picture above you can see a modulated signal driving the IR LED of the transmitter on

the left side. The detected signal is coming out of the receiver at the other side.

FIGURE 5.3: modulated signal driving LED

In serial communication we usually speak of 'marks' and 'spaces'. The 'space' is the

default signal, which is the off state in the transmitter case. No light is emitted during the

'space' state. During the 'mark' state of the signal the IR light is pulsed on and off at a

particular frequency. Frequencies between 30 kHz and 60 kHz are commonly used in

consumer electronics. At the receiver side a 'space' is represented by a high level of the

receiver's output. A 'mark' is then automatically represented by a low level.

Please note that the 'marks' and 'spaces' are not the I-s and 0-s we want to transmit. The

real relationship between the 'marks' and 'spaces' and the I-s and 0-s depends on the protocol

that's being used. More information about that can be found on the pages that describe the

protocols.

5.3 TRANSMITTER

In the picture below we can see a modulated signal driving the IR LED of the transmitter

on the left side. The detected signal is coming out of the receiver at the other side.

FIGURE 5.4: IR TRANSMITTER

Page 28: Density based traffic light control

28

The transmitter usually is a battery powered handset. It should consume as little power as

possible, and the IR signal should also be as strong as possible to achieve an acceptable control

distance. Preferably it should be shock proof as well.

Many chips are designed to be used as IR transmitters. The older chips were dedicated to

only one of the many protocols that were invented. Nowadays very low power microcontrollers

are used in IR transmitters for the simple reason that they are more flexible in their use. When no

button is pressed they are in a very low power sleep mode, in which hardly any current is

consumed. The processor when wakes up to transmit the appropriate IR command only a key is

pressed.

FIGURE 5.5: TRANSISTOR CIRCUIT USED TO DRIVE IR LED

Quartz crystals are seldom used in such handsets. They are very fragile and tend to break

easily when the handset is dropped. Ceramic resonators are much more suitable here, because

they can withstand larger physical shocks. The fact that they are a little less accurate is not

important.

The current through the LED (or LEDs) can vary from 100mA to well over IA! In order

to get an acceptable control distance the LED currents have to be as high as possible. A trade-off

should be made between LED parameters, battery lifetime and maximum control distance. LED

currents can be that high because the pulses driving the LEDs are very short. Average power

dissipation of the LED should not exceed the maximum value though. You should also see to it

that the maximum peek current for the LED is not exceeded. All these parameters can be found

in the LED's data sheet.

Page 29: Density based traffic light control

29

A simple transistor circuit can be used to drive the LED. A transistor with a suitable hfe

and switching speed should be selected for this purpose. The resistor values can simply be

calculated using Ohm’s law. Remember that the nominal voltage drop over an IR LED is

approximately 1.1V. The normal driver, described above, has one disadvantage. As the battery

voltage drops, the current through the LED will decrease as well. This will result in a shorter

control distance that can be covered.

An emitter follower circuit can avoid this. The 2 diodes in series will limit the pulses on

the base of the transistor to 1.2V. The base-emitter voltage of the transistor subtracts O.6V

from that, resulting in constant amplitude of O.6V at the emitter. This constant amplitude across

a constant resistor results in current pulses of a constant magnitude. Calculating the current

through the LED is simply applying ohm' law.

5.4 PHOTODIODES

Unfortunately for us there are many more sources of Infrared light. The sun is the brightest

source of all, but there are many others, like: light bulbs, candles, central heating system, and

even our body radiate Infrared light. In fact everything that radiates heat, also radiates Infrared

light. Therefore we have to take some precautions to guarantee that our IR message gets across to

the receiver without errors.

UV enhanced photodiodes are optimized for the UV and blue spectral regions,

Photodiodes are a two- electrode, radiation-sensitive junction formed in a semiconductor

material in which the reverse current varies with illumination. Photodiodes are used for the

detection of optical power and for the conversion of optical power to electrical power.

Photodiodes can be PN, PIN, or avalanche.

PN photodiodes feature a two-electrode, radiation-sensitive PN junction formed in a

semiconductor material in which the reverse current varies with illumination. PIN

photodiodes are diodes with a large intrinsic region sandwiched between P-doped and

N-doped semiconducting regions. Photons absorbed in this region create electron-hole pairs that

are then separated by an electric field, thus generating an electric current in a load circuit.

Page 30: Density based traffic light control

30

5.5 SEVEN SEGMENT DISPLAY

FIGURE 5.6: SEVEN SEGMENT DISPLAY

A seven-segment display (SSD), or seven-segment indicator, is a form of electronic display

device for displaying decimal numerals that is an alternative to the more complex dot-

matrix displays. Seven-segment displays are widely used in digital clocks, electronic meters, and

other electronic devices for displaying numerical information.

5.5.1 CONCEPT AND VISUAL STRUCTURE

FIGURE 5.7: THE SEGMENTS OF A SEVEN-SEGMENT DISPLAY

The seven elements of the display can be lit in different combinations to represent

the Arabic numerals. Often the seven segments are arranged in an oblique (slanted) arrangement,

which aids readability.

Page 31: Density based traffic light control

31

In most applications, the seven segments are of nearly uniform shape and size (usually

elongated hexagons, though trapezoids and rectangles can also be used), though in the case

of adding machines, the vertical segments are longer and more oddly shaped at the ends in an effort

to further enhance readability.

The numerals 0, 1, 6, 7 and 9 may be represented by two or more different glyphs on seven-

segment displays.

The seven segments are arranged as a rectangle of two vertical segments on each side with

one horizontal segment on the top, middle, and bottom. Additionally, the seventh segment bisects

the rectangle horizontally. There are also fourteen-segment displays and sixteen-segment

displays (for full alphanumeric); however, these have mostly been replaced by dot-matrix displays.

The segments of a 7-segment display are referred to by the letters A to G, where the

optional DP decimal point (an "eighth segment") is used for the display of non-integer numbers.

5.5.2 DISPLAYING LETTERS

FIGURE 5.8: LED BASED 7-SEGMENT DISPLAY

LED-based 7-segment display which cycles through the common glyphs of the ten decimal

numerals and the six hexadecimal" letter digits" (A–F)

Hexadecimal digits can be displayed on seven-segment displays. Both uppercase and

lowercase letters are used for A–F; this is done to obtain a unique, unambiguous shape for each

letter (otherwise, a capital D would look identical to an 0 (or less likely O) and a capital B would

look identical to an 8).

Similar displays with fourteen or sixteen segments are available allowing less-ambiguous

representations of the alphabet.

Using a restricted range of letters that look like (upside-down) digits, seven-segment

displays are commonly used by school children to form words and phrases using a technique

known as "calculator spelling".

Page 32: Density based traffic light control

32

TABLE 5.1: HEXADECIMAL ENCODINGS

Hexadecimal encodings for displaying the digits 0 to 9

Digit gfedcba abcdefg A b c d e f g

0 0×3F 0×7E On on on on on on off

1 0×06 0×30 Off on on off off off off

2 0×5B 0×6D On on off on on off on

3 0×4F 0×79 On on on on off off on

4 0×66 0×33 Off on on off off on on

5 0×6D 0×5B On off on on off on on

6 0×7D 0×5F On off on on on on on

7 0×07 0×70 On on on off off off off

8 0×7F 0×7F On on on on on on on

9 0×6F 0×7B On on on on off on on

Page 33: Density based traffic light control

33

TABLE 5.2: HEXADECIMAL ENCODINGS (A-F)

A 0×77 0×77 on on on off on On on

B 0×7C 0×1F off off on on on On on

C 0×39 0×4E on off off on on On off

D 0×5E 0×3D off on on on on off on

E 0×79 0×4F on off off on on On on

F 0×71 0×47 on off off off on On on

Page 34: Density based traffic light control

34

CHAPTER 6

POWER SUPPLY

6.1 INTRODUCTION

The present chapter introduces the operation of power supply circuits built using filters,

rectifiers and then voltage regulators. Starting with an ac voltage, then filtering to a 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 varies, or the output load connected to the dc voltage changes.

FIGURE 6.1: COMPONENTS OF LINEAR POWER SUPPLY

Page 35: Density based traffic light control

35

6.2 TRANSFORMER:

A transformer is an electrical device which is used to convert electrical power from

one Electrical circuit to another without change in frequency.

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 in output voltage, step-down transformers decrease in output

voltage. Most power supplies use a step-down transformer to reduce the dangerously high mains

voltage 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.

FIGURE 6.2: AN ELECTRICAL TRANSFORMER

The ratio of the number of turns on each coil, called the turn's ratio, determines the ratio

of the voltages. A step-down transformer has a large number of turns on its primary (input) coil

which is connected to the high voltage mains supply, and a small number of turns on its

secondary (output) coil to give a low output voltage.

Page 36: Density based traffic light control

36

Turns ratio = Vp/VS = Np/NS Power Out= Power In VS * IS=VP * IP Vp = primary (input) voltage

Np = number of turns on primary coil Ip = primary (input) current

6.3 RECTIFIER

A circuit which is used to convert ac to dc is known as RECTIFIER. The process of

conversion ac to dc is called "rectification"

6.3.1 Types of rectifiers

• Half wave Rectifier

• Full wave Rectifier

1. Centre tap full wave rectifier.

2. Bridge type full bridge rectifier.

Full-wave Rectifier:

From the above comparison we came to know that full wave bridge rectifier as more

advantages than the other two rectifiers. So, in our project we are using full wave bridge rectifier

circuit.

Page 37: Density based traffic light control

37

TABLE 6.1: COMPARISON OF RECTIFIER CIRCUITS

Parameter

Type of Rectifier

Half wave Full wave Bridge

Number of diodes

1

2

4

PIV of diodes

Vm

2Vm

Vm

D.C output voltage

Vm/z

2Vm/

2Vm/

Vdc at no-load

0.318Vm

0.636Vm

0.636Vm

Ripple factor

1.21

0.482

0.482

Ripple frequency

F

2f

2f

Rectification efficiency

0.406

0.812

0.812

Transformer Utilization

Factor{TUF)

0.287

0.693

0.812

RMS voltage Vrms

Vm/2

Vm/V2

Vm/V2

Page 38: Density based traffic light control

38

Bridge Rectifier:

A bridge rectifier makes use of four diodes in a bridge arrangement to achieve full-

wave rectification. This is a widely used configuration, both with individual diodes wired as

shown and with single component bridges where the diode bridge is wired internally.

A bridge rectifier makes use of four diodes in a bridge arrangement as shown in fig (6.3)

to achieve full-wave rectification. This is a widely used configuration, both with individual

diodes wired as shown and with single component bridges where the diode bridge is wired

internally.

FIGURE 6.3: BRIDGE RECTIFIER

6.3.1 Operation

During positive half cycle of secondary, the diodes D2 and D3 are in forward biased

while D1 and D4 are in reverse biased as shown in the fig(b). The current flow direction is

shown in the fig (6.4) with dotted arrows.

Page 39: Density based traffic light control

39

FIGURE 6.4: POSITIVE HALF CYCLE

During negative half cycle of secondary voltage, the diodes D1 and D4 are in forward

biased while D2 and D3 are in reverse biased as shown in the fig(c). The current flow direction

is shown in the fig (c) with dotted arrows.

FIGURE 6.5: NEGATIVE HALF CYCLE

6.4 FILTER

A Filter is a device which removes the ac component of rectifier output but allows the

dc component to reach the load.

Page 40: Density based traffic light control

40

6.4.1 Capacitor Filter

We have seen that the ripple content in the rectified output of half wave rectifier is 121%

or that of full-wave or bridge rectifier or bridge rectifier is 48% such high percentages of ripples

is not acceptable for most of the applications. Ripples can be removed by one of the following

methods of filtering.

(a) A capacitor, in parallel to the load, provides an easier by -pass for the ripples voltage

though it due to low impedance. At ripple frequency and leave the D.C. to appear at the load.

(b) An inductor, in series with the load, prevents the passage of the ripple current (due

to high impedance at ripple frequency) while allowing the dc (due to low resistance to dc).

(c) Various combinations of capacitor and inductor, such as L-section filter section filter,

multiple section filter etc. which make use of both the properties mentioned in (a) and (b) above.

Two cases of capacitor filter, one applied on half wave rectifier and another with full wave

rectifier.

Filtering 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 capacitor charges quickly near the peak of the varying DC, and

then discharges as it supplies current to the output. Filtering significantly increases the average

DC voltage to almost the peak value (1.4 x RMS value).

To calculate the value of capacitor(C), C = NOP3OfOrORl Where,

f =supply frequency,

r = ripple factor,

Rl = load resistance Note: In our circuit we are using 1000QF hence large value of capacitor is placed to reduce

ripples and to improve the DC component.

Page 41: Density based traffic light control

41

6.5 REGULATOR

Voltage regulator ICs is available with fixed (typically 5, 12 and 15V) or

variable output voltages. The maximum current they can pass also rates them. 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’). Many of the fixed voltage regulators ICs have 3 leads and look like power

transistors, such as the 7805 +5V 1A regulator shown on the right. The LM7805 is simple to

use. You simply connect the positive lead of your unregulated DC power supply (anything

from 9VDC to 24VDC) to the Input pin, connect the negative lead to the Common pin

and then when you turn on the power, you get a 5 volt supply from the output pin.

FIGURE 6.6: A THREE TERMINAL VOLTAGE REGULATOR

78XX

The Bay Linear LM78XX is integrated linear positive regulator with three terminals. The

LM78XX offer several fixed output voltages making them useful in wide range of applications.

When used as a zener diode/resistor combination replacement, the LM78XX usually results in an

effective output impedance improvement of two orders of magnitude, lower quiescent current.

The LM78XX is available in the TO-252, TO-220 & TO-263packages,

Page 42: Density based traffic light control

42

6.5.1 Features: Output Current of 1.54

Output voltage Tolerance of 5% Internal thermal overload protection Internal Short-Circuit Limited

Output Voltage 0V,6V,8V,9V,10V,12V,15V,18V,24V

Page 43: Density based traffic light control

43

CHAPTER-7

SYTEM DESIGN

Designing of this system is possible when you select the specific controller to suite.

For this we selected 89C51 controller. With the help of 89C51 controller traffic control

system can be implemented successfully with the help IR technology. To the controller we

connected IR transmitter and receiver circuit. Instead of IR transmitter and receiver we can

go with photo diode and photo transmitters also. Here we are using four IR pairs for each

side.

Whenever vehicles reach the junction on each side, then IR detects the vehicle by

sending signal to controller and the controller will counts the count of vehicles. And

calculate the maximum count from them and give the path to side which has maximum count

by glowing green LED and other LED and other three sides red LED shall be glow.

FIGURE 7.1: OVERALL BLOCK DIAGRAM

Page 44: Density based traffic light control

44

7.1 HARDWARE DESIGN

7.1.1 SCHEMATIC DIAGRAM

FIGURE 7.2:SCHEMATIC DIAGRAM

Page 45: Density based traffic light control

45

7.1.2 Schematic description

The main aim of this power supply is to convert the 230V AC into 5V DC in order to give

supply for the TTL. This schematic explanation includes the detailed pin connections of every

device with the microcontroller.

This schematic explanation includes the detailed pin connections of every device

with the microcontroller. Let us see the pin connections of each and every device with the

microcontroller in detail.

Power Supply

In this process we are using a step down transformer, a bridge rectifier, a smoothing

circuit and the RPS. At the primary of the transformer we are giving the 230V AC supply. The

secondary is connected to the opposite terminals of the Bridge rectifier as the input. From other

set of opposite terminals we are taking the output to the rectifier.

The bridge rectifier converts the AC coming from the secondary of the

Transformer into pulsating DC. The output of this rectifier is further given to the smoother

circuit which is capacitor in our project. The smoothing circuit eliminates the ripples from the

pulsating DC and gives the pure DC to the RPS to get a constant output DC voltage. The RPS

regulates the voltage as per our requirement.

Microcontroller

The microcontroller AT89S52 with Pull up resistors at Port0 and crystal oscillator of

11.0592MHz crystal in conjunction with couple of capacitors of is placed at 18th & 19th pins

of 89S51 to make it work (execute) properly.

Page 46: Density based traffic light control

46

IR Module:

The IR transmitter and receiver are input and output devices. This is connected to the port

P2 of the Microcontroller.

LEDs:

Here the LEDs are connected to one of microcontroller port by using resistor.

7.2 SOFTWARE COMPONENTS

7.2.1. ABOUT SOFTWARE

Software used is:

Keil software for C programming

Proteus for schematic design

KEIL µVision3

µVision3 is an IDE (Integrated Development Environment) that helps you write, compile,

and debug embedded programs. It encapsulates the following components:

Project Manager

Facility

Tool configuration

Editor

A powerful debugger

This software is used 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.

Page 47: Density based traffic light control

47

The industry-standard Keil C compilers, macro assemblers, debuggers, real, time Kernels,

Single-board computers and emulators support all 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.

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.

Numerous example programs are included to help you get started with the most

popular embedded avr devices.

The Keil µVision debugger accurately simulates on-chip peripherals (PC, CAN, and

UART, SPl, interrupts, I/O ports, A/D converter, D /A converter and PWM modules) of

your avr 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

MONS1, MON390, MONADl, or flash MONS1 target monitors, the lSDS1 in-System

Debugger or the ULlNK USB- RTAG adapter to download and test program code on

your target system.

PROTEUS

Proteus is software for microprocessor simulation, schematic capture, and printed circuit

board (PCB) design. It is developed by Labcenter Electronics.

Page 48: Density based traffic light control

48

EMBEDDED C:

The programming Language used here in this project is an Embedded C Language. This Embedded C Language is different from the generic C language in few things like a) Data types b) Access over the architecture addresses.

The Embedded C Programming Language forms the user friendly language with access

over Port addresses, SFR Register addresses etc.

Signed char: Used to represent the – or + values As a result, we have only 7 bits for the magnitude of the signed number, giving us values

from -128 to +127. Embedded C data types:

TABLE 7.1: DATA TYPES IN EMBEDDED C

Data Types

Size in Bits

Data Range/Usage

unsigned char 8-bit 0-255

signed char 8-bit -128 to +127

unsigned int 16-bit 0 to 65535

signed int 16-bit -32,768 to +32,767

Sbit 1-bit SFR bit addressable only

Bit 1-bit RAM bit addressable only

Sfr 8-bit RAM addresses 80-FFH only

Page 49: Density based traffic light control

49

CHAPTER-8

IMPLEMENTATION

The applications as discussed in the design are implemented and the source code related

to the current work is included the forthcoming chapter.

8.1 SOFTWARE

8.1.1 µVision3

µvision3 is an IDE (Integrated Development Environment) that helps you write,

compile, and debug embedded programs. It encapsulates the following components:

Project Manager

Facility

Tool configuration

Editor

A powerful debugger

To help you get started, several example programs (located in the \C51\Examples,

\C251\Examples,\C166\Examples, and \ARM\...\Examples) are provided.

! HELLO is a simple program that prints the string "Hello World" using the Serial Interface.

Page 50: Density based traffic light control

50

8.1.2 µVision2

Building an Application in µVision2

To build (compile, assemble, and link) an application in µvisionz, you must:

1. Select Project - (for example, 166\EXAMPLES\HELLO\HELLO.UV2). z. Select Project -

Rebuild all target files or Build target.

µvisionz compiles, assembles, and links the files in your project.

Creating Your Own Application in µVision2

To create a new project in µVision2 you must:

1. Select Project - New Project.

2. Select a directory and enter the name of the project file.

3. Select Project - Select Device and select an 8051, 251, or C16x/ST10 device from the

Device Database™.

4. Create source files to add to the project.

5. Select Project - Targets, Groups, Files, Add/Files, select Source Group1, and add the source

files to the project.

6. Select Project - Options and set the tool options. Note when you select the target device

from the Device Database™ all special options are set automatically. You typically only need

to configure the memory map of your target hardware. Default memory model settings are

optimal for most applications.

7. Select Project - Rebuild all target files or Build target.

Page 51: Density based traffic light control

51

Debugging an Application in µVision2

To debug an application created using uvision2, you must:

1. Select Debug - Start/Stop Debug Session.

2. Use the Step toolbar buttons to single-step through your program. You may enter G, main

in the Output Window to execute to the main C function.

3. Open the Serial Window using the Serial #1 button on the

toolbar. Debug your program using standard options like Step, Go,

Break, and so on.

Starting µVision2 and creating a Project

µVision2 is a standard Windows application and started by clicking on the program icon.

To create a new project file select from the uvision2 menu

Project - New Project. This opens a standard Windows dialog that asks you for the new

project file name.

We suggest that you use a separate folder for each project. You can simply use the icon

Create New Folder in this dialog to get a new empty folder. Then select this folder and enter

the file name for the new project, i.e. Project1.

µVision2 creates a new project file with the name PROJECT1.Uv2 which contains a

default target and file group name. You can see these names in the Project

Window - Files.

Now use from the menu Project - Select Device for Target and select a CPU for your

project. The Select Device dialog box shows the uvisionz device database. Just select the

microcontroller you use. We are using for our examples the Philips 80C51RD+ CPU. This

selection sets necessary tool options for the 80C51RD+ device and simplifies in this way the tool

Configuration

Page 52: Density based traffic light control

52

Building Projects and Creating a HEX Files

Typical, the tool settings under Options - Target are all you need to start a new

application. You may translate all source files and line the application with a click on the Build

Target toolbar icon. When you build an application with syntax errors, uvisionz will display

errors and warning messages in the Output Window - Build page. A double click on a message

line opens the source file on the correct location in a µvisionz editor window. Once you have

successfully generated your application you can start debugging.

After you have tested your application, it is required to create an Intel HEX file to

download the software into an EPROM programmer or simulator. uvisionz creates HEX files

with each build process when Create HEX files under Options for Target - Output is

enabled. You may start your PROM programming utility after the make process when you

specify the program under the option Run User Program #1.

CPU Simulation

µvisionz simulates up to 16 Mbytes of memory from which areas can be mapped

for read, write, or code execution access. The uvisionz simulator traps and reports illegal

memory accesses being done.

In addition to memory mapping, the simulator also provides support for the integrated

peripherals of the various 8051 derivatives. The on-chip peripherals of the CPU you have

selected are configured from the Device

Database selection

You have made when you create your project target. Refer to page 58 for more

Information about selecting a device. You may select and display the on-chip peripheral

components using the Debug menu. You can also change the aspects of each peripheral using

the controls in the dialog boxes.

Page 53: Density based traffic light control

53

Start Debugging

You start the debug mode of uvisionz with the Debug - Start/Stop Debug Session

command. Depending on the Options for Target - Debug Configuration, uvisionz will load the

application program and run the start up code uvisionz saves the editor screen layout and

restores the screen layout of the last debug session. If the program execution stops, uvisionz

opens an editor window with the source text or shows CPU instructions in the disassembly

window. The next executable statement is marked with a yellow arrow. During debugging,

most editor features are still available.

For example, you can use the find command or correct program errors. Program source text

of your application is shown in the same windows. The µvisionz debug mode differs from the

edit mode in the following aspects:

The "Debug Menu and Debug Commands" described on page z8 are Available. The

additional debug windows are discussed in the following.

The project structure or tool parameters cannot be modified. All build Commands

are disabled.

Disassembly Window

The Disassembly window shows your target program as mixed source and assembly

program or just assembly code. A trace history of previously executed instructions may be

displayed with Debug - view Trace Records. To enable the trace history, set Debug -

Enable/Disable Trace Recording.

If you select the Disassembly Window as the active window all program step commands

work on CPU instruction level rather than program source lines. You can select a text line and

set or modify code breakpoints using toolbar buttons or the context menu commands.

You may use the dialog Debug - Inline Assembly. to modify the CPU instructions. That

allows you to correct mistakes or to make temporary changes to the target program you are

debugging

Page 54: Density based traffic light control

54

CHAPTER-9

SYSTEM TESTING

Density based traffic control system is a system which shall be able to count the

vehicles at each side of the junction road when vehicles are reached near to that junction. After

connecting the circuit and writing the code, then test it by sensing the IR sensor dated term

used to describe an opto-electronic means of sensing something, most commonly a photo

detector of some type. The system can be tested with the use of KEIL compiler. This one we

are using to write programs for 89C51 controller. After writing programs using 89C51

programmer we can dump code into the controller. Now develop the system by using IR

transmitter and receiver, we can use photo diode and photo transistors.

After initializing all the devices connected to the controller, while testing keep the

transmitter & receiver aligned in a straight position facing each other about a distance more

than 2 meter but not less than that.

If the transmitter and receiver are not in a aligned position data communication is

not possible. Connect the output of IR receiver to the controller port pin. If there is no intruder

the output pin will show low value. If there is any introduce it will show high value.

Page 55: Density based traffic light control

55

CHAPTER-10

PROGRAMMING

Program code

# include<reg51.h>

# define density_level P1

//void green_delay();

//Lights declaration

sbit ar = P0^0;

sbit ag = P0^1;

sbit br = P0^2;

sbit bg = P0^3;

sbit cr = P0^4;

sbit cg = P0^5;

sbit dr = P0^6;

sbit dg = P0^7;

//sensors declarartion

sbit IRaa=P1^0;

sbit IRab=P1^1;

sbit IRba=P1^2;

sbit IRbb=P1^3;

sbit IRca=P1^4;

sbit IRcb=P1^5;

sbit IRda=P1^6;

sbit IRdb=P1^7;

int a[]={

void main()

{

P1=0XFF;

P3=0X00;

P0=0X00;

Page 56: Density based traffic light control

56

P2=0X00;

ar=1;

br=1;

cr=1;

dr=1;

while(1)

{

int check_high;

bit

a=0,b=0,c=0,d=0,hi

gh=0;

int

lane_a,lane_b,lane_

c,lane_d;

for

(check_high=0;chec

k_high<3;check_hig

h++)

{

switch

(density_level)

{

case 0XFC :

if(a==0)

{ ar = 0;

a=1;

for(lane_a=0;lane_a<9;lane_a++)

{

ag = 1;

}

ag = 0;

Page 57: Density based traffic light control

57

}

break;

case 0XF3 :

if(b==0)

{

br = 0;

b=1;

for(lane_b=0;lane_b<9;lane_b++)

{

bg = 1;

}

}

bg = 0;

break;

case 0XCF :

if(c==0)

{

cr = 0;

c=1;

for(lane_c=0;lane_c<9;lane_c++)

{

cg = 1;

}

}

cg = 0;

break;

case 0X3F :

if(d==0)

{

dr = 0;

d=1;

for(lane_d=0;lane_d<9;lane_d++)

Page 58: Density based traffic light control

58

{

dg = 1;

} }

dg = 0;

break;

}

P0 = P0&0XFF;

}

} }

/*{

while(high==1)

{

int check2;

for (check2=0;check2<2;check2++)

{

{

if(IRaa==0)

//check

lane a

{

if(IRab==0)

{

ar = 0;

ag = 1;

green_delay();

ag = 0;

}

else

{

ag = 0;

Page 59: Density based traffic light control

59

//ay = 1;

//yellow_delay();

//ay = 0;

ar = 1;

}}}

{

if(IRba==0)

//check lane b

{

if(IRbb==0)

{

br = 0;

bg = 1;

}

else

{

bg = 0;

//by = 1;

//yellow_delay();

//by = 0;

br = 1;

}}}

{

if(IRca==0)

//check lane c

{

if(IRcb==0)

{

cr = 0;

Page 60: Density based traffic light control

60

cg = 1;

}

else

{

cg = 0;

//cy = 1;

//yellow_delay();

//cy = 0;

cr = 1;

}}}

{

if(IRda==0)

//check lane d

{

if(IRdb==0)

{

dr = 0;

dg = 1;

}

else

{

dg = 0;

//dy = 1;

//yellow_delay();

//dy = 0;

dr = 1;

}}}}}}

}*/

/*void green_delay()

Page 61: Density based traffic light control

61

{

int y;

for (y=0; y<1000; y++);

} */

Page 62: Density based traffic light control

62

RESULTS

From the series of experiments we have conducted the following results were obtained:

Fuel is saved to about 70% compared to normal timer based traffic control

Traffic can be cleared without any irregularities

Time can be shared evenly for all intersections

Effective time management

Page 63: Density based traffic light control

63

CONCLUSION

To reduce the congestion and unwanted time delay in traffic, an advanced system is required.

One such advanced technology is automatic signalling using IR sensors. The sensors help in

Keeping Count of vehicles entering roads and subsequently allot time delay thereby giving

accurate priority to each road for the time being. With this technique we have entered a

new era of automatic traffic signal control.

Page 64: Density based traffic light control

64

BIBLIOGRAPHY

[Ben-Akiva et al., 2003] Ben-Akiva, M., Cuneo, D., Hasan, M., Jha, M., and Yang,

Q. (2003).Evaluation of freeway control using a microscopic simulation

la b o r a t o r y . Transportation research Part C: emerging technologies, 11-1:29-50.

[Broucke and Varaiya, 1996] Broucke, M. and Varaiya, P. (1996). A theory o f

traffic flow in automated highway systems. Transportation research Part C: emerging

technologies, V4:181-210.

[Choi et al., 2002] Choi, W., Yoon, H., Kim, K., Chung, I., and Lee, S. (2002). A

traffic light controlling FLC considering the traffic congestion. In Pal, N. and

Sugeno, M., editors, Advances in Soft Computing - AFSS 2002, International

Conference on Fuzzy Systems, pages 69-75.

[Findler and Stapp, 1992] Findler, N. and Stapp, J. (1992). A distributed approach

to Optimized control of street traffic signals. Journal of Transportation Engineering,

118-1:99-110.

[Horowitz and Varaiya, 2000] Horowitz, R . and Varaiya, P. (2000).

Control design of an automated highway system. In Proc. IEEE, v o l . 88.

[Jin and Zhang, 2003] Jin, W. L. and Zhang, H. M. (2003). The formation and

structure of vehicle clusters in the payne-whitham traffic flow model.

Transportat ion Research Part B: Methodological, 37-3:207-223.

Page 65: Density based traffic light control

65

[Levinson, 2003] Levinson, D. (2003). The value of advanced traveler information

systems for route choice. Transportation Research Part C: Emerging Technologies,

11-1:75-87.

[Lighthill and Whitham, 1955] Lighthill, M. J. and Whitham, G. B. (1955). On

kinematic waves: Ii. a theory of traffic flow on long crowded roads. Proceeding of

the Royal Society A, 229:317-345.

Page 66: Density based traffic light control

66

APPENDIX-A

QUESTIONNAIRES PREPARED FOR THE SURVEY

RESPONSE SHEET

Name: ________________________ date: ___________________

Age: ___________________________

Place ___________________________

Profession: ____________________

1.) Do you think traffic light controller is necessary? (Yes /no) ________________

2.) Have you suffered from traffic congestion?(Yes/no) ___________________

3.) Do you think that you are wasting your time and fuel while waiting in a signal? (Yes/no) ______

4.) Is there any need to change the current timer based traffic Light controller? (Yes/no) ______

5.) If so what is the trouble you feel?

_________________________________________________________________________

_________________________________________________________________________

Page 67: Density based traffic light control

67

Page 68: Density based traffic light control

68

Page 69: Density based traffic light control

69

APPENDIX-B

PHOTO COPY OF THE MODEL

Page 70: Density based traffic light control

70