Project Report On Microcontroller Based Traffic Light Controller
Project Report On Microcontroller Based Traffic Light Controller
Microcontroller Based
Traffic Light
Controller
CONTENTS
1. ABSTRACT
2. INTRODUCTION
4. CIRCUIT DIAGRAM
5. HARDWARE DESCRIPTION
MICROCONTROLLER UNIT
LIGHT EMITTING DIODE (LED)
DISPLAY
6. SOFTWARE
7. DATA SHEETS
8. COMPONENTS REQUIRED
9. FUTURE SCOPE
10. BIBLIOGRAPHY
Acknowledgement
project mentor, Mr. SANJOY BANERJEE for giving most valuable suggestion, helpful
I will like to give a special mention to my colleagues. Last but not the least I am
grateful to all the faculty members of Ardent Computech Pvt. Ltd. or their support.
ABSTRACT
This project is developed to meet the requirements of solid state traffic light
controller by adopting microcontroller as the main controlling element, and led’s as the
indication of light. A micro controller is interfaced to led’s provide for centralized control
of the traffic signals. Microcontroller is programmed in such a way to adjust their timing
and phasing to meet changing traffic conditions. The circuit besides being reliable and
Traffic congestion is a severe problem in many modern cities around the world.
Traffic congestion has been causing many critical problems and challenges in the
major and most populated cities. To travel to different places within the city is becoming
more difficult for the travelers in traffic. Due to these congestion problems, people lose
time, miss opportunities, and get frustrated. Traffic congestion directly impacts the
companies. Due to traffic congestions there is a loss in productivity from workers, trade
opportunities are lost, delivery gets delayed, and thereby the costs goes on increasing.
Microcontroller AT89c51 is the brain of the project which initiates the traffic
signal at a junction. The led’s are automatically on and off by making the corresponding
port pin of the micro controller high. A seven segment display also connected to display
the timing of each signal. At a particular instant only one green light holds and other
lights hold at red. During transition from green to red, the present group yellow led and
succeeding group yellow led glows and then succeeding group led changes to green.
This process continues as a cycle.
BLOCK DIAGRAM
POWER
SUPPLY
(+5v)
8051
MICRO
CONTROLL
LED
ER
(AT89C51)
HARDWARE DESCRIPTION
MICRO-CONTROLLER UNIT:
Fig-Block Diagram
Pin Description:-
Pins 1-8: Port 1: Each of these pins can be configured as an input or an output.
Pin 9: RS A logic one on this pin disables the microcontroller and clears the contents of
most registers. In other words, the positive voltage on this pin resets the
microcontroller. By applying logic zero to this pin, the program starts execution from the
beginning.
Pins10-17: Port 3 Similar to port 1, each of these pins can serve as general input or
output. Besides, all of them have alternative functions:
Pin 18, 19: X2, X1 : Internal oscillator input and output. A quartz crystal which specifies
operating frequency is usually connected to these pins. Instead of it, miniature
ceramics resonators can also be used for frequency stability. Later versions of
microcontrollers operate at a frequency of 0 Hz up to over 50 Hz.
Pin 21-28: Port 2 If there is no intention to use external memory then these port pins
are configured as general inputs/outputs. In case external memory is used, the higher
address byte, i.e. addresses A8-A15 will appear on this port. Even though memory with
capacity of 64Kb is not used, which means that not all eight port bits are used for its
addressing, the rest of them are not available as inputs/outputs.
Pin 29: PSEN If external ROM is used for storing program then a logic zero (0)
appears on it every time the microcontroller reads a byte from memory.
Pin 30: ALE Prior to reading from external memory, the microcontroller puts the lower
address byte (A0-A7) on P0 and activates the ALE output. After receiving signal from
the ALE pin, the external register (usually 74HCT373 or 74HCT375 add-on chip)
memorizes the state of P0 and uses it as a memory chip address. Immediately after
that, the ALU pin is returned its previous logic state and P0 is now used as a Data Bus.
As seen, port data multiplexing is performed by means of only one additional (and
cheap) integrated circuit. In other words, this port is used for both data and address
transmission.
Pin 31: EA By applying logic zero to this pin, P2 and P3 are used for data and address
transmission with no regard to whether there is internal memory or not. It means that
even there is a program written to the microcontroller, it will not be executed. Instead,
the program written to external ROM will be executed. By applying logic one to the EA
pin, the microcontroller will use both memories, first internal then external (if exists).
Pin 32-39: Port 0: Similar to P2, if external memory is not used, these pins can be
used as general inputs/outputs. Otherwise, P0 is configured as address output (A0-A7)
when the ALE pin is driven high (1) or as data output (Data Bus) when the ALE pin is
driven low (0).
Pin 40: VCC +5V power supply.
The five memory spaces of the 8051 are: Program Memory, External Data
Memory, Internal Data Memory, Special Function Registers and Bit Memory.
The Program Memory space contains all the instructions, immediate data and
constant tables and strings. It is principally addressed by the 16-bit Program Counter
(PC), but it can also be accessed by a few instructions using the 16-bit Data Pointer
(DPTR). The maximum size of the Program Memory space is 64K bytes. Several 8051
family members integrate on-chip some amount of either masked programmed ROM or
EPROM as part of this memory.
The Internal Data Memory of 8051’s on-chip memory consists of 256 memory
bytes organized as follows:
First 128 bytes: 00h to 1Fh Register Banks
20h to 2Fh Bit Addressable RAM
30 to 7Fh General Purpose RAM
Next 128 bytes: 80h to FFh Special Function Registers
The first 128 bytes of internal memory is organized as shown in figure and is
Referred to as Internal RAM, or IRAM.
Carry flag. C
This is a conventional carry, or borrows, flag used in arithmetic operations. The carry
flag is also used as the ‘Boolean accumulator’ for Boolean instruction operating at the
bit level. This flag is sometimes referenced as the CY flag.
Auxiliary carry flag. AC
This is a conventional auxiliary carry (half carry) for use in BCD arithmetic.
Flag 0. F0
This is a general-purpose flag for user programming.
Register bank select 0 and register bank selects 1. RS0 and RS1
These bits define the active register bank (bank 0 is the default register bank).
Overflow flag. OV
This is a conventional overflow bit for signed arithmetic to determine if the result of a
signed arithmetic operation is out of range.
Even Parity flag. P
The parity flag is the accumulator parity flag, set to a value, 1 or 0, such that the
number of ‘1’ bits in the accumulator plus the parity bit add up to an even number.
The register implicit, indirect and direct addressing modes can be used in
different parts of the Internal Data Memory space.
The Special Function Register space contains all the on-chip peripheral I/O
registers as well as particular registers that need program access. These registers
include the Stack Pointer, the PSW and the Accumulator. The maximum number of
Special Function Registers (SFR’s) is 128, though the actual number on a particular
8051 family member depends on the number and type of peripheral functions
integrated on-chip.
The External Data Memory space contains all the variables, buffers and data
structures that can't fit on-chip. It is principally addressed by the 16-bit Data Pointer
(DPTR), although the first two general purpose register (R0, R1) of the currently
selected register bank can access a 256-byte bank of External Data memory. The
maximum size of the External Data Memory space is 64Kbytes. External data memory
can only be accessed using the indirect addressing mode with the DPTR, R0 or R1.
REGULATOR
Zener regulator is incorporated for maintaining 12v regulated output used for sensing
probes and Electromagnetic relay.
Light Emitting Diode (LED):
PRINCIPLE:
When a light-emitting diode is forward biased electrons are able to recombine
with electron holes within the device, releasing energy in the form of photons. This
effect is called electroluminescence. Electroluminescence (EL) is an optical and
electrical phenomenon in which a material emits light in response to the passage of an
electric current or to a strong electric field. The wavelength of the light emitted, and
thus its color depends on the band gap energy of the materials forming the p-n
junction. The materials used for the LED have a direct band gap with energies
corresponding to near-infrared, visible or near-ultraviolet light.
CONSTRUCTION:
LEDs are usually built on an n-type substrate, with an electrode attached to the p-type
layer deposited on its surface. P-type substrates, while less common, occur as well.
Many commercial LEDs, especially GaN/InGaN, also use sapphire substrate. Most
materials used for LED production have very high refractive indices. Light extraction in
LEDs is an important aspect of LED production.
SOFTWARE
NG BIT P2.4
NY BIT P2.3
NR BIT P2.5
SG BIT P0.4
SY BIT P0.5
SR BIT P0.3
WG BIT P2.1
WY BIT P2.2
WR BIT P2.0
EG BIT P0.1
EY BIT P0.0
ER BIT P0.2
ORG 0000H
MOV P0,#0FFH
MOV P2,#0FFH
NORTH: CLR NG
CLR SR
CLR WR
CLR ER
ACALL DELAY
CLR NY
ACALL DELAY1
SETB NY
ACALL DELAY1
CLR NY
ACALL DELAY1
SETB NY
ACALL DELAY1
CLR NY
ACALL DELAY1
SETB NY
ACALL DELAY1
SETB NG
SETB SR
SETB WR
SETB ER
EAST: CLR EG
CLR SR
CLR WR
CLR NR
ACALL DELAY
CLR EY
ACALL DELAY1
SETB EY
ACALL DELAY1
CLR EY
ACALL DELAY1
SETB EY
ACALL DELAY1
CLR EY
ACALL DELAY1
SETB EY
ACALL DELAY1
SETB EG
SETB SR
SETB WR
SETB NR
SOUTH: CLR SG
CLR ER
CLR WR
CLR NR
ACALL DELAY
CLR SY
ACALL DELAY1
SETB SY
ACALL DELAY1
CLR SY
ACALL DELAY1
SETB SY
ACALL DELAY1
CLR SY
ACALL DELAY1
SETB SY
ACALL DELAY1
SETB SG
SETB ER
SETB WR
SETB NR
WEST: CLR WG
CLR SR
CLR ER
CLR NR
ACALL DELAY
CLR WY
ACALL DELAY1
SETB WY
ACALL DELAY1
CLR WY
ACALL DELAY1
SETB WY
ACALL DELAY1
CLR WY
ACALL DELAY1
SETB WY
ACALL DELAY1
SETB WG
SETB SR
SETB ER
SETB NR
AJMP NORTH
IR RECEIVER CIRCUIT
TRAFFIC LIGHT CONTROL MODULE USING SENSORS
BIBLIOGRAPHY
2) 8051 Microcontroller
3) www.wikipedia.org
4) www.microcontroller.com