Professional Documents
Culture Documents
DENSITY BASED TRAFFIC LIGHTS
DENSITY BASED TRAFFIC LIGHTS
DENSITY BASED TRAFFIC LIGHTS
BTECH
IN
ELECTRICAL & ELECTRONICS ENGINEERING
Submitted to Department
Under the guidance of
P. Odelu Yadav
Senior lecture in Electrical & Electronics Engineering
ELECTRICAL & ELECTRONICS ENGINEERING
1
CERTIFICATE
This is to certify that this project work entitled “Density Based Traffic Lights”
has been carried out P. Pavani (22N01A0209), CH. Likitha (22N01A0218),
B. Anudeepthi (23N05A0202), M. Sandeep Kumar (23N05A0216),
Amena Yasmeen (23N05A0223) in partial fulfillment of the requirements for
the award of the Degree of Bachelors of Technology in Electrical &
Electronics Engineering
To the Sree Chaitanya College of Engineering, Karimnagar.
2
STRUCTURAL CHART OF ORGANSING BODY
3
ACKNOWLEDGEMENT
I would like to thank all the staff and all my friends for their good wishes,
their Helping hand and constructive criticism, which led the successful
completion
For this project.
4
Unshakable belief in me and the understanding and ever-decreasing grudges
for
not spending time more often. I will now, since the excuse is in the process of
vanishing by being printed on these very pages.
Finally, I thank all those who directly and indirectly helped me in this regard I
Apologize for not listing everyone here.
P. Pavani 22N01A0209
CH. Likitha 22N01A218
B. Anudeepthi 23N05A0202
M. Sandeep Kumar 23N05A0216
Amena Yasmeen 23N05A0223
5
ABSTRACT
In present, vehicular traffic is increasing throughout the world, especially
in large urban areas. As the number of road user’s increase constantly and
current resources & 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. Our
Project will demonstrate the optimization of traffic lights in a city using wireless
Sensors. Traffic light optimization is a tough problem. With multiple junctions,
the complexity increases as the state of one light node influences the flow of
traffic towards many other nodes. We proposed a traffic light controller that
allows us to control and study different situations of traffic density. We sense
the density of traffic using infra-red sensors. The key behind the
implementation of the “Traffic density based light control system” is to make
use of an AT89C51
Controller which performs processing of the real time data provided by the
infra-red sensors, eventually controlling the traffic flow via the LED traffic lights.
6
INDEX
CONTENTS PAGE NO
CHAPTER 1 8
INTRODUCTION TO EMBEDDED
SYSTEMS
1.1 History:
1.2 Overview: 9
1.3 Embedded System: 11
1.4 Basic Block of Embedded System: 14
1.5 Microcontroller:
CHAPTER 2
INTRODUCTION OF PROJECT
2.1 PROJECT DEFINITION: 17
2.2 Block Diagram Description: 19
2.3 IR Sensor 20
CHAPTER 3
7
3.18 Pins (3.3.5. GND, Vin)
3.19 Analog pins
CHAPTER 4
IR SENSOR
4.1 Transmitter 34
4.2 IR receiver 35
CHAPTER 5
SOFTWARE DESCRIPTION 37
8
CHAPTER 1
TO ENBEDDED SYSTEMS INTRODUCTION
1.1 HISTORY:
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 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 allows 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 conventional 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 vehicles 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
9
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.
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.
11
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.
Input Devices
Output devices
Communication interfaces
Application-specific circuitry
12
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.
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
13
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:
14
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.
1.5 Microcontroller:
15
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
16
(ATM), X.25 and frame relay switches are embedded systems which implement
the necessary data communication protocols
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:
17
• Microprocessor instruction sets are processing Intensive.
• 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.
CHAPTER-2
INTRODUCTION OF PROJECT
In today's high speed life, traffic congestion becomes a serious issue in our day
to day activities. It brings down the productivity of individual and thereby the
society as lots of work hour is wasted in the signals. High volume of vehicles,
the inadequate infrastructure and the irrational distribution of the signaling
system are main reasons for this chaotic congestions. It indirectly also adds to
the increase in pollution level as engines remain on in most cases, a huge
volume of natural resources in forms of petrol and diesel is consumed without
18
any fruitful outcome. Therefore, in order to get rid of these problems or at least
reduce them to significant level, newer schemes need to be implemented by
bringing in sensor based automation technique in this field of traffic signaling
system.
Motivation
All these problems gave me perspective that if we could somehow analyse the
number of people entering and leaving halls, these drawbacks could be
avoided. This promoted the idea of Bidirectional Visitor Counter in our mind
through which we can keep a check on number of people and allow all people
to leave any building before sealing it. We can also count number of people to
analyse the feedback. of people on any event. And most importantly, in case of
all people leaving a premise, all electrical appliances will be turned off
automatically leading to saving of electricity.
PROJECT OVERVIEW
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
19
will be the time delay allotted for that corresponding traffic light signal. The
main purpose of this project is, if there will be no traffic on the other signal,
one shouldn't wait for that signal. The system will skip that signal and will move
on the next one.
The basic block diagram of the bidirectional visitor counter automatic light with
controller is shown in the above figure. Mainly this block diagram consist of the
Power Supply
IR Sensors
20
LED
LCD Display
2.2.2 IR Sensors:
This is the most fundamental type of sensor available in the market. The basic
concept
is simple. There is an emitter which emits infrared (IR) rays. These IR rays are
detected
21
by a detector. This concept is used to make proximity sensor check if something
(to
obstructs the path or not, etc.), contrast sensors (used to detect contrast
difference
CHAPTER 3
ARDUINO
3.1 ATMEGA328 Microcontroller Description
The Atmel AVR® core combines a rich instruction set with 32 general purpose
working registers. All the 32 registers are directly connected to the Arithmetic
Logic Unit (ALU), allowing two independent registers to be accessed in a single
instruction executed in one clock cycle. The resulting architecture is more code
efficient while achieving throughputs up to ten times faster than conventional
CISC microcontrollers. The ATmega328/P provides the following features:
32Kbytes of In-System Programmable Flash
22
https://technoelectronics 44.blogspot.com/p/microcontrollers.html This allows
very fast start-up combined with low power consumption. In Extended Standby
mode, both the main oscillator and the asynchronous timer continue to run.
Atmel offers the Q Touch® library for embedding capacitive touch buttons,
sliders and wheels functionality into AVR microcontrollers. The patented
charge-transfer signal acquisition offers robust sensing and includes fully
debounced reporting of touch keys and includes Adjacent Key Suppression®
(AKS™) technology for unambiguous detection of key events. The easy-to-use Q
Touch Suite toolchain allows you to explore, develop and debug your own
touch applications. The device is manufactured using Atmel's high density non-
volatile memory technology. The On-chip ISP Flash allows the program memory
to be reprogrammed In-System through an SPI serial interface, by a
conventional nonvolatile memory programmer, or by an On-chip Boot program
running on the AVR core.
https://technoelectronics44.blogspot.com/p/ microcontrollers.html
https://technoelectronics4 4.blogspot.com/p/microcontrollers.html
23
SRAM Data Memory: 2kbytes
I/O Pins:23
USART: Yes
https://technoelectronics44.blogspot.com/p/microcontrollers.html
2. Even though it's 5 V capable, newer parts can run to 1.8 V. This wide range is
very rare.
24
3. Nice instruction set, very good instruction throughput compared to other
processors (HCS08, PIC12/16/18).
5. rap p y compilers!)
8. Q Touch capability
https://technoelectronics44.blogspot.com/p/microcontrollers.html
25
3.3 PIN EXPLANATION
Pin Description Function
Number
1 PC6 Reset
2 PD0 Digital Pin (RX)
3 PD1 Digital Pin (TX)
4 PD2 Digital Pin
5 PD3 Digital Pin (PWM)
6 PD4 Digital Pin
7 VCC Positive Voltage (Power)
8 GND Ground
9 XTAL 1 Crystal Oscillator
10 XTAL 2 Crystal Oscillator
11 PD5 Digital Pin (PWM)
12 PD6 Digital Pin (PWM)
13 PD7 Digital Pin
26
14 PB0 Digital Pin
15 PB1 Digital Pin (PWM)
16 PB2 Digital Pin (PWM)
17 PB3 Digital Pin (PWM)
18 PB4 Digital Pin
19 PB5 Digital Pin
20 AVCC Positive voltage for ADC (power)
21 AREF Reference voltage
22 GND Ground
23 PC0 Analog Input
24 PC1 Analog Input
25 PC2 Analog Input
26 PC3 Analog Input
27 PC4 Analog Input
28 PC5 Analog Input
https://technoelectronics44.blogspot.com/p/microcontrollers.html
3.4 VOC
3.5 GND
Ground.
https://technoelectronics44.blogspot.com/p/microcontrollers.html
27
Port B is an 8-bit bi-directional I/O port with internal pull-up resistors (selected
for each bit). The Port B output buffers have symmetrical drive characteristics
with both high sink and source capability. As inputs, Port B pins that are
externally pulled low will source current if the pull-up resistors are activated.
The Port B pins are tri-stated when a reset condition becomes active, even if
the clock is not running.
Depending on the clock selection fuse settings, PB6 can be used as input to the
inverting Oscillator amplifier and input to the internal clock operating circuit.
Depending on the clock selection fuse settings, PB7 can be used as output from
the inverting Oscillator amplifier.
Port C is a 7-bit bi-directional I/O port with internal pull-up resistors (selected
for each bit). The PC [5:0] output buffers have symmetrical drive characteristics
with both high sink and source capability. As inputs, Port C pins that are
externally pulled low will source current if the pull-up resistors are activated.
The Port C pins are tri-stated when a reset condition becomes active, even if
the clock is not running.
3.8 PC6/RESET
If the RSTDISBL Fuse is programmed, PC6 is used as an I/O pin. Note that the
electrical characteristics of PC6 differ from those of the other pins of Port C.
If the RSTDISBL Fuse is unprogrammed, PC6 is used as a Reset input. A low level
on this pin for longer than the minimum pulse length will generate a Reset,
28
even if the clock is not running. Shorter pulses are not guaranteed to generate
a Reset. https://technoelectronics44.blogspot.com/p/microcontrollers.html
The various special features of Port C are elaborated in the Alternate Functions
of Port C
section.
https://technoelectronics44.blogspot.com/p/microcontrollers.html
Port D is an 8-bit bi-directional I/O port with internal pull-up resistors (selected
for each bit). The Port D output buffers have symmetrical drive characteristics
with both high sink and source capability. As inputs Port D pins that are
externally pulled low will source current if the pull-up resistors are activated.
The Port D pins are tri-stated when a reset condition becomes active, even if
the clock is not running.
3.10 AVCC
AVCC is the supply voltage pin for the A/D Converter, PC [3:0], and PE [3:2]. It
should be externally connected to VCC, even if the ADC is not used. If the ADC
is used, it should be connected to VCC through a low-pass filter. Note that PC
[6:4] use digital supply voltage, VCC.
AREF
we will learn about the different components on the Arduino board. We will
study the Arduino UNO board because it is the most popular board in the
Arduino board family. In addition, it is the best board to get started with
electronics and coding. Some boards look a bit different from the one given
below, but most Arduinos have majority of these components in common.
https://technoelectronics 44.blogspot.com/p/microcontrollers.html
30
3.9 Power USB
Arduino board can be powered by using the USB cable from were computer. All
we need to do is connect the USB cable to the USB connection (I).
Arduino boards can be powered directly from the AC mains power supply by
connecting it to the Barrel Jack (2).
https://technoelectronics4 4.blogspot.com/p/microcontrollers.html
The function of the voltage regulator is to control the voltage given to the
Arduino board and stabilize the DC voltages used by the processor and other
elements.
https://technoelectronics44.blogspot.com/p/microcontrollers.html
The crystal oscillator helps Arduino in dealing with time issues. How does
Arduino calculate time? The answer is, by using the crystal oscillator. The
31
number printed on top of the Arduino crystal is 16.000H9H. It tells us that the
frequency is 16,000,000 Hertz or 16MHz.
We can reset were Arduino board, i.e., start were program from the beginning.
We can reset the UNO board in two ways. First, by using the reset button (17)
on the board. Second, we can connect an external reset button to the Arduino
pin labelled RESET (5).
32
3.3V (6) Supply 3.3 output volt
5V (7) Supply 5 output volt
Most of the components used with Arduino board works fine with 3.3
volt and 5volt.
GND (8)(Ground) There are several GND pins on the Arduino, any of
which can be used to ground were circuit.
Vin (9) This pin also can be used to power the Arduino board from an
external power source, like AC mains power supply.
3.15 Analog pins
https://technoelectronics44.blogspot.com/p/microcontrollers.html
Other Arduino UNO board has five analog input pins A0 through A5.
These pins can read the signal from an analog sensor like the humidity
sensor or temperature sensor and convert it into a digital value that can
be read by the microprocessor.
https://technoelectronics44.blogspot.com/p/microcontrollers.html
Arduino interface boards provide the engineers, artists, designers,
hobbyists and anyone who tinker with technology with a low-cost, easy-
to-use technology to create their creative, interactive objects, useful
projects etc., A whole new breed of projects can now be built that can be
controlled from a computer.
1.1 WHAT IS ARDUINO?
Figure 1.1 ARDUINO UNO
33
https://technoelectronics4 4.blogspot.com/p/microcontrollers.html
Anyone can buy this device through online auction site or search engine.
Since the Arduino is an open-source hardware designs and create their own
clones of the Arduino and sell them, so the market for the boards is
competitive. An official Arduino costs about $30, and a clone often less
than $20.
1.1.1 Microcontroller
34
precisely it is a single chip that can perform various calculations and tasks,
and send/receive signals from other devices via the available pins. Precisely
what tasks and communication with the world it does, is what is governed
by what instructions we give to the Microcontroller. It is this job of telling
the chip what to do, is what we refer to as programming on it.
https://technoelectronics 44.blogspot.com/p/microcontrollers.html
CHAPTER 4
IR SENSORS
4.1 Transmitter:
35
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.
4.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.
36
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.
37
38
CHAPTER 5
SOFTWARE DESCRIPTION
SOFTWARE
The Arduino IDE comes with a C/C++ library called "Wiring" (from the
project of the same name), which makes many common input/output
operations much easier. Arduino programs are written in C/C++, although users
only need define two functions to make a runnable program:
Setup () a function run once at the start of a program that can initialize
settings
39
40
A typical first program for a microcontroller simply blinks a LED on and
off. In the Arduino environment, the user might write a program like
this:
#define LED_PIN 13
void setup () {
For the above code to work correctly, the positive side of the LED must
be connected to pin 13 and the negative side of the LED must be
connected to ground. The above code would not be seen by a standard
C++ compiler as a valid program, so when the user clicks the "Upload
to I/O board" button in the IDE, a copy of the code is written to a
temporary file with an extra include header at the top and a very
simple main) function at the bottom, to make it a valid C++ program.
The Arduino IDE uses the GNU toolchain and AVR Libe to compile
programs, and uses avrdude to upload programs to the board.
41
4.2 language reference
void
boolean
char (0255)
'float
double
•String - object
array
Arithmetic operators
42
e.g.,
y = y + 3;
x = x 7;
i = j * 6;
r = r/5;
Comparision operators
e.g.,
x == y // x is equal to y
e.g.,
Logical AND:
Logical OR:
43
if (x > 0 || y > 0) // true if either expression is true
Logical NOT:
TRUE/FALSE
These are Boolean constants that define logic levels of the arduino.
e.g.,
if (a b c d = TRUE);
Do Something Nice;
Else
Do Something Horrible;
HIGH/LOW
These constants define pin levels as HIGH or LOW and are used when
44
HIGH is defined as logic level 1, ON, or 5 volts
e.g.,
INPUT/OUTPUT
These constants define pin levels as HIGH or LOW and are used when
e.g.,
The Arduino Simulator app gives the user the freedom to work without
the basic setup of hardware and software. It is designed to be used by
beginners and also, experienced developers, who want to quickly
develop Arduino projects.
45
The developer can make the necessary changes in the code - delay, pin
number, and state 0 (low) 1 (high) and check it immediately. The app
shows the breadboard, complete with 14 LED pins.
You can drag and place the wires in the correct positions to connect to
Arduino. If the wires are placed according to the code, then it will show
the expected results. Once satisfied, you can save it and email it. The
code can be copied and used in an actual project just as easily.
46
#define ledA1 2
#define ledA2 3
#define ledA3 4
#define ledB1 5
#define ledB2 6
#define ledB3 7
#define ledC1 8
#define ledC2 9
#define ledC3 10
#define ledD1 12
#define ledD2 11
#define ledD3 13
void setup () {
Serial. begin(9600);
void loop() {
read Sensor();
if (b1 == 1 && b2 == 1)
{
roadBopen();
47
}
else if (d1 == 1 && d2 == 1 && (b1 == 0 || b2 == 0))
{
Road D open();
if (b1 == 1 && b2 == 1)
{
Road B open();
}
}
else if (a1 == 1 && a2 == 1 && ((d2 == 0 || b2 == 0) || (d1 == 0 || b1 ==
0)))
{
Road A open();
if (b1 == 1 && b2 == 1)
{
Road B open();
}
else if (d1 == 1 && d2 == 1 && (b1 == 0 || b2 == 0))
{
Road D open();
}
}
else if (c1 == 1 && c2 == 1 && ((d2 == 0 || b2 == 0 || a2 == 0) || (d1 == 0
|| b1 == 0 || a1 == 0)))
{
Road C open();
if (b1 == 1 && b2 == 1)
{
Road B open();
}
else if (d1 == 1 && d2 == 1 && (b1 == 0 || b2 == 0))
{
Road D open();
}
}
////////////////////////////////////////////////////////////////////////////
/////////////////////////////
else if ((b1 == 1 && b2 == 0) && (c1 == 1 || d1 == 1 || b1 == 1) && (c2 == 1
&& d2 == 1 && b2 == 1))
{
Road B open();
}
else if ((d1 == 1 && d2 == 0) && (c1 == 1 || a1 == 1) && (b1 == 0 && b2 ==
0) && (c2 == 0 && a2 == 0))
{
Road D open();
}
48
else if ((a1 == 1 && a2 == 0) && (c1 == 1 && c2 == 0) && (d1 == 0 && d2 ==
0) && (b1 == 0 && b2 == 0))
{
Road A open();
}
else if ((c1 == 1 && c2 == 0) && (b1 == 0 || b2 == 0) && (d1 == 0 || d2 ==
0) && (a1 == 0 || a2 == 0))
{
Road C open();
}
////////////////////////////////////////////////////////////////////////////
/////////////////////////////
else if ((b1 == 1 && b2 == 0) && (c1 == 0 || c2 == 0) && (d1 == 0 || d2 ==
0) && (a1 == 0 || a2 == 0))
{
Road B open();
}
else if ((d1 == 1 && d2 == 0) && (c1 == 0 || c2 == 0) && (b1 == 0 || b2 ==
0) && (a1 == 0 || a2 == 0))
{
Road D open();
}
////////////////////////////////////////////////////////////////////////////
/////////////////////////////
else if (a1 == 0 && b1 == 0 && c1 == 0 && d1 == 0)
{
Road B open();
if (a1 == 0 && b1 == 0 && c1 == 0 && d1 == 0)
{
Road D open();
}
if (a1 == 0 && b1 == 0 && c1 == 0 && d1 == 0)
{
Road A open();
}
if (a1 == 0 && b1 == 0 && c1 == 0 && d1 == 0)
{
Road C open();
}
}
}
49
void read Sensor()
{
a1 = analog Read(A7);
a2 = analog Read(A6);
b1 = analog Read(A4);
b2 = analog Read(A5);
c1 = analog Read(A1);
c2 = analog Read(A0);
d1 = analog Read(A3);
d2 = analog Read(A2);
Serial. print(a1);
Serial. print("\t");
Serial. print(a2);
Serial. print("\t");
Serial. print(b1);
Serial. print("\t");
Serial. print(b2);
Serial. print("\t");
Serial. print(c1);
Serial. print("\t");
Serial. print(c2);
Serial. print("\t");
Serial. print(d1);
Serial. print("\t");
Serial. print(d2);
Serial. Print ln("\t");
50
digital Write(ledA2, LOW);
read Sensor();
}
51
digital Write(ledD2, LOW);
read Sensor();
}
ADVANTGES:
Low cost. This is our final year project, which will draw attention of all
the faculties. So, I want to make a project through which everyone can
relate to it. Also in our day to day life I am always observing at the
crossing of roads that in some lane there are lot of traffic compared to
others lane but all the signals in our country is timing based .So we
cannot manage our time. Also due to timing based the lighter dense
roads are sometimes empty due to which many people start crossing
the road but due green signal in that lane vehicle moves at high speed
which increases the risk of accident. So, the best solution of these
problem is to make traffic control system which control the whole
traffic by density. From this we got the motivation to work on this
project. At the starting of the project we were not able to visualize it
practically, but slowly we are getting information from the Internet and
taking help of some of our faculties of our college to implement it
practically. Any random person won't be able to visualize our efforts
put in the completion of the project because after completion it looks a
bit easy. Our mentor and Sujoy sir played a very important role in the
completion of our project. Without their help we won't be able to
complete it properly. So, special thanks to our mentor and Sujoy sir.
REFERENCES:
2) http://www.engineersgarage.com/electronic
components/atmega328P- microcontroller
52
3) www.datasheets4u.com
53