Digital Electronics PBL
Digital Electronics PBL
By
Deepesh Rajpoot (2100430310023)
Ishant Vaidh (2100430310031)
Satyendra Singh Chauhan (2100430310048)
This is to certify that the work contained in the thesis entitled “Automatic Traffic
Light controller using 8051 microcontroller” submitted by Deepesh Rajpoot,
Ishant Vaidh, Satyendra Singh Chauhan for the award of the degree of Bachelor of
Technology in Electronics and Communication Engineering to the Bundelkhand
Institute of Engineering and Technology, Jhansi is a record of bonafide research
works carried out by him under my direct supervision and guidance.
I considered that the thesis has reached the standards and fulfilling the
requirements of the rules and regulations relating to the nature of the degree. The
contents embodied in the thesis have not been submitted for the award of any other
degree or diploma in this or any other university.
2
Declaration
We hereby declare that the project work “Automatic Traffic Light controller
using 8051 microcontroller” entitled is an authenticated work carried out by us
under the guidance of Dr. Surjeet Raikwar of Electronics and Communication
Engineering Department at Bundelkhand Institute of Engineering and Technology,
Jhansi. Information derived from the other source has been quoted in the text and a
list of refrences has been given.
3
Acknowledgement
We would like to express our gratitude towards Dr. Surjeet Raikwar for his
guidance and constant supervision as well as for providing us necessary information
regarding the project and this report. We feel thankful and express our kind gratitude
towards our Director, Head of Department and all faculty members. We would also
like to express our special gratitude and thanks to our parents for giving us constant
support that improved our performance significantly.
4
ABSTRACT
Traffic lights were first invented in the year 1868 at London’s House of Commons where traffic
light signals were placed at intersections of George and Bridge Street. Later the traffic lights were
developed in the year 1914 by an American Traffic Signal Company, which fixed green and red
lights at corners of the 105th street and Euclid Avenue in Cleveland, Ohio. During this period
traffic lights were controlled either by timing or by switching manually. In China, there were
unsuccessful efforts to change the importance of “red” to “go” during the Cultural Revolution.
Typically traffic lights consist of three types of coloured lights such as red, orange and green. In a
typical cycle, turning on of a green light allows traffic to continue in the way indicated. Similarly,
lighting of the amber/orange light for a short time of transition represents a signal to prepare to
stop, and the Illumination of the red signal disallows any traffic from going on.
We have given the introduction about traffic signals, and therefore a control system is necessary to
control these lights in a specific manner. This traffic light control system can be achieved by using
a microcontroller to make simple and low-cost system.
5
INTRODUCTION
The main objective of this traffic light controller is to provide sophisticated control and coordination
to confirm that traffic moves as smoothly and safely as possible. This project makes use of LED
lights for indication purpose and a microcontroller is used for auto changing of signal at specified
range of time interval. LED lights gets automatically turns on and off by making corresponding port
pin of the microcontroller “HIGH”.
A prototype of traffic light control system is made by using Infra-Red sensors along with major
components Microcontroller and LEDs which are used for controlling traffic signals based on the
density of the traffic. The junction taken into consideration is a four-side junction with the traffic
flow on each side is only in one direction. This traffic light control system consists of the following
three main components:
Display Unit: It consists of 3 LEDs: Green, Red and Orange on each side of the junction– a total of
12 LEDs of three colours are placed at the junction.
Detector Unit: It consists of a combined arrangement of photo diode and IR LED at every junction
for detecting the presence of vehicles based on the change in resistance.
Controller Unit: This control unit contains a microcontroller which receives the output data from
the IR Sensors and controls the glowing of LEDs based on the programming.
The aim of this project is to design and develop a density based dynamic traffic signal system. The
signal timing changes automatically by sensing the traffic density at every junction.
6
This traffic light control system works on the concept of fixed time allocation at each side of the
junction which cannot be changed as per varying traffic density. Timings allotted at every junction
are fixed . Sometimes higher traffic density at one side of the junction demands longer time duration
for green signal compared to the standard allotted time.
This proposed system makes use of an 8051 microcontroller which is properly interfaced with the IR
sensors to change the junction timing automatically to accommodate the movement of vehicles for
avoiding unnecessary waste of time at each junction.
The sensors used in this project IR and photo diodes are in line of sight configuration across the
loads to detect the density at the traffic signal. The density of these vehicles is measured in three
zones i.e., low, medium and high, respectively – based on certain time duration allotted at respective
zones ,accordingly.
SOFTWARE USED
CIRCUIT DIAGRAM
7
CODE
ORG 00H
LJMP MAIN
ORG 300H
ORG 30H
MOV P3,#00H
ACALL FRONT
MOV DPTR,#TBL
CLR A
MOV 40H,#10
MOV 43H,#10
MOV 46H,#20
MOV 49H,#20
MOV R0,#35
MOV R6,#30
MOV R7,#40
MOV B,#10
DIV AB
MOV 41H,A
MOV 42H,B
8
A1: SETB P3.0
CLR P3.1
MOV A,41H
MOVC A,@A+DPTR
MOV P2,A
ACALL DELAY
MOV P3,#00H
SETB P3.1
CLR P3.0
MOV A,42H
MOVC A,@A+DPTR
MOV P2,A
ACALL DELAY
MOV P3,#00H
SJMP X3
X2: SJMP X1
MOV B,#10
DIV AB
MOV 44H,A
MOV 45H,B
SETB P3.2
CLR P3.3
MOV A,44H
MOVC A,@A+DPTR
MOV P2,A
ACALL DELAY
9
MOV P3,#00H
SETB P3.3
CLR P3.2
MOV A,45H
MOVC A,@A+DPTR
MOV P2,A
ACALL DELAY
MOV P3,#00H
MOV A,46H
MOV B,#10
DIV AB
MOV 47H,A
MOV 48H,B
SETB P3.4
CLR P3.5
MOV A,47H
MOVC A,@A+DPTR
MOV P2,A
ACALL DELAY
MOV P3,#00H
SETB P3.5
CLR P3.4
MOV A,48H
MOVC A,@A+DPTR
MOV P2,A
10
ACALL DELAY
MOV P3,#00H
MOV A,49H
MOV B,#10
DIV AB
MOV 50H,A
MOV 51H,B
SETB P3.6
CLR P3.7
MOV A,50H
MOVC A,@A+DPTR
MOV P2,A
ACALL DELAY
MOV P3,#00H
SETB P3.7
CLR P3.6
MOV A,51H
MOVC A,@A+DPTR
MOV P2,A
ACALL DELAY
MOV P3,#00H
DJNZ R0,X2
MOV R0,#35
11
DJNZ 40H,Q1
MOV 40H,#20
MOV 43H,#10
ACALL RIGHT
MOV 43H,#20
MOV 46H,#10
MOV 49H,#10
ACALL BACK
ACALL LEFT
MOV 40H,#10
MOV 43H,#10
MOV 46H,#30
LJMP MAIN
L1: LJMP X1
12
H2: MOV R5,#0FFH
DJNZ R4,H2
RET
MOV P0,#02H
RET
MOV P0,#02H
RET
MOV P0,#05H
RET
MOV P0,#08H
RET
In the above circuit diagram of traffic light controller ,a seven-segment display is used as a counter
display, and three LEDs are used for the purpose of traffic light control. An 8051 Microcontroller is
the brain of this whole project and is used to initiate the traffic signal at the intersections on road.
This circuit diagram makes use of a crystal oscillator for generating frequency clock pulses. The
LEDs are interfaced to the Port zero of the microcontroller and are powered with 5v power supply.
Seven-segment display is connected to the port2 pins of the 8051 microcontroller with a common
anode configuration.
13
The LEDs get automatically switched on and off by making the corresponding port pins of the
microcontroller high, based on the 8051 microcontroller and its programming done by using KEIL
software. At a particular period of time, only the green light holds ON and the other lights remains
OFF, and after sometime, the changeover traffic light control from green to red takes place by
making the succeeding change for glowing of yellow LED. This process continues as a cycle and the
timing for changing the LEDs can be displayed with the use of a seven-segment LED display in this
project.
This traffic light control system can be further enhanced in such a way to control the traffic signals
automatically based on the traffic density on roads with the help of IR sensor modules with
automatic turnoff if there are no vehicles on either side of the road which leads to power
consumption.
ADVANTAGES
Density based traffic light control have many advantages compared to time based traffic control. We
can save considerable amount of time We can avoid unnecessary occurrence of traffic jams which
causes public inconvenience.
APPLICATION
There is no need of traffic inspector at the junctions for supervising the traffic to run
smoothly The intelligent work which is done by traffic inspector will be perfectly done by the
microcontroller in the circuit with the help of sensors and the program which is coded to the
microcontroller.
The traffic light controller in this system can be implemented practically, and it could be
expanded further by you.
This traffic light controller includes a crosswalk signalling system.
External memory can be interface with the central controller so that the timings are not fixed
during its programming but instead can be programmed during operation.
CONCLUSION
Thus from above theory we can conclude that using the method of density based control of traffic
lights we can save a considerable amount of time and also we can prevent excessive traffic jams thus
leading to smooth traffic flow, In practice presently in India we are following time based control of
traffic signals and we are experiencing a heavy traffic jams all over which in turn consumes lot of
time and fuel. We hope these methods will be adopted as soon as possible so that the limitations we
are experiencing with present method can be overcome.
REFRENCES
https://www.watelectronics.com/how-traffic-light-control-system-works/
http://www.instruconnect.net/arduino
14
http://www.learningaboutelectronics.com/A rticles/Atmega328-pinout,ph
https://www.electronicwings.com/864/traffic-light-system-using-8051-micro-controller
15