DENSITY BASED TRAFFIC LIGHTS

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 53

DENSITY BASED TRAFFIC LIGHTS

A REAL TIME PROJECT


Submitted by partial fulfillment of
The requirement for the award of

BTECH
IN
ELECTRICAL & ELECTRONICS ENGINEERING
Submitted to Department
Under the guidance of

P. Odelu Yadav
Senior lecture in Electrical & Electronics Engineering
ELECTRICAL & ELECTRONICS ENGINEERING

SREE CHAITANYA COLLEGE OF ENGINEERING


KARIMNAGAR- 505001.

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.

Internal Guide HEAD OF THE SECTION


P. ODELU YADAV P. ODELU YADAV
ASSISTANT PROFESSOR, ASSISTANT PROFESSOR
Department of EEE HOD, Department of EEE
Sree Chaitanya College of Sree Chaitanya College of
Engineering Engineering.

2
STRUCTURAL CHART OF ORGANSING BODY

NAME OF THE PROJECT

“DENSITY BASED TRAFFIC LIGHTS”


P. Pavani 22N01A0209
CH. Likitha 22N01A0218
B. Anudeepthi 23N05A0202
M. Sandeep Kumar 23N05A0216
Amena Yasmeen 23N05A0223

3
ACKNOWLEDGEMENT

The satisfaction that accomplishes the successful completion of any task


would be incomplete without the mention of the people who make it possible
and whose constant guidance and encouragement crown all the efforts with
success.

It is my privilege and pleasure to express my profound sense of respect.


Gratitude and indebtedness to my guide P. ODELU YADAV, Assistant professor.
Department of EEE SCCE, for his constant guidance, inspiration, and constant
Encouragement throughout this project work.

I wish to express my deep gratitude to P. ODELU YADAV, Assistant Professor


and HOD. Department of EEE, SCCE, Karimnagar for his cooperation and
encouragement, in addition to providing necessary facilities throughout the
project work.

I sincerely extend my thanks to DR.G. VENTAKESHWARLU, SREE CHAITANYA


COLLEGE OF ENGINEERING. Karimnagar.

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.

I am immensely indebted to my parents, brother and sisters for their love


and

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

3.1 ATMEGA328 Microcontroller 21


3.2 Description Pin diagram of 23
ATMEGA328
3.3 Pin Explanation 25
3.4 VCC
3.5 GND 26
3.6 GND ort
3.7(PB [7:0]) 26
XTAL1XTAL2/TOSC1/TOSC2 27
3.8 Port C (PC [ 5:0]) 27
3.9 PC6/RESET 28
3.10 Port D (PD [7:0]) 28
3.11 AVCC 28
3.12 Arduino Uno Board description 29
3.13 Power USB 30
3.14 Power (Barrel Jack) 30
3.15 Voltage Regulator 31
3.16 Crystal Oscillator
3.17 Arduino Reset 31

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

ADVANTAGES & APPLICATIONS 44


ADVANTAGES 44
REFERENCES 44

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.

1.3 Embedded System:


An embedded system is a special – purpose computer system designed to
perform one or a few dedicated functions, sometimes with real – time
computing constraints. It is usually embedded as part of a complete device
including hardware and mechanical parts. In contrast, a general – purpose
computer, such as a personal computer, can do many different tasks depending
on programming. Embedded system have become very important today as
they control many of the common devices we use.
Since the embedded system is dedicated to specific tasks, design engineers
can optimize it, reducing the size and cost of the product, or increasing the
reliability and performance. Some embedded systems are mass-produced,
benefiting from economics of scale.
Physically, embedded systems range from portable devices such as digital
watches and MP3 players, to large stationary installations like traffic lights,
factory controllers, or the systems controlling nuclear power plants. Complexity
varies from low, with a single microcontroller chip, to very high with multiple
units, peripherals and networks. mounted inside a large chassis or enclosure.

In general, "embedded system" is not an exactly defined term, as many


systems have some element of programmability. For example, Handheld
computers share some elements with embedded systems such as the operating
systems and microprocessors which power them but are not truly embedded
systems, because they allow different applications to be loaded and peripherals
to be connected.

An embedded system is some combination of computer hardware and


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

Certain operating systems or language platforms are tailored for the


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

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

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

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


microprocessor based hardware and the suitable software to undertake a

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.

1.4 Basic Blocks of Embedded System:

Now, the details of the various building blocks of the hardware of an


embedded system as shown in Fig 1.1 are

Central Processing Unit (CPU) Memory (Read-only Memory and Random


Access Memory)

Input Devices

Output devices

Communication interfaces

Application-specific circuitry

Central Processing Unit (CPU):

The Central Processing Unit (processor, in short) can be any of the


following: microcontroller, microprocessor or Digital Signal Processor (DSP). A
micro-controller is a low-cost processor. Its main attraction is that on the chip
itself, there will be many other components such as memory, serial

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.

Figure.1.1: Block Diagram of Embedded System

Memory:

The memory is categorized as Random Access Memory (RAM) and Read Only
Memory (ROM). The contents of the RAM will be erased if power is switched
off to the chip, whereas ROM retains the contents even if the power is

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.

Security is the condition of being protected against danger or loss. In the


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

1.5 Microcontroller:

In the Literature discussing microprocessors, we often see the term Embedded


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

In an Embedded system, there is only one application software that is typically


burned into ROM. An x86 PC contains or is connected to various embedded
products such as keyboard, printer, modem, disk controller, sound card, CD-

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

Nearly 99 per cent of the processors manufactured end up in embedded


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

Consumer appliances: At home we use a number of embedded systems which


include digital camera, digital diary, DVD player, video recorders etc.

Office automation: The office automation products using embedded systems


are copying machine, fax machine, key telephone, modem, printer, scanner etc

Industrial automation: Today a lot of industries use embedded systems for


process control. In hazardous industrial environment, where human presence
has to be avoided, robots are used, which are programmed to do specific jobs.

Medical electronics: Almost every medical equipment in the hospital is an


embedded system. These equipments include diagnostic aids such as ECG, EEG,
blood pressure measuring devices, radiation, colonoscopy, endoscopy etc.

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


Integrated Services Digital Networks (ISDN), Asynchronous Transfer Mode

16
(ATM), X.25 and frame relay switches are embedded systems which implement
the necessary data communication protocols

Telecommunications: In the field of telecommunications, the embedded


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

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

Microprocessors are single-chip CPUs used in microcomputers.

• Microcontrollers and microprocessors are different in 3 main aspects:


hardware architecture, applications, and instruction set features.

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


microcontroller is a single IC contains a CPU and much of remaining circuitry of
a complete computer (e.g., RAM, ROM, serial interface, parallel interface,
timer, interrupt handling circuit).

Applications: Microprocessors are commonly used as a CPU in computers while


microcontrollers are found in small, minimum component designs performing
control oriented activities.

17
• Microprocessor instruction sets are processing Intensive.

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

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

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

• They have instructions for input/output operations, event timing, enabling


and setting priority levels for interrupts caused by external stimuli.

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

CHAPTER-2

INTRODUCTION OF PROJECT

2.1 PROJECT DEFINITION:

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

A few days back, we organized a seminar in Pearl Continental, Conference Hall.


Main issues we faced were that firstly, few. people were trapped inside hall and
security guards closed conference rooms after finishing seminar, because they
(security guards) were unaware of total number of people inside hall.
Moreover, we couldn't analyse the feedback of people and number of people
attending the seminar as there wasn't any registration process. Lastly, after
ending of seminar, electrical appliances such as Air coolers and fans were left
unattended, this caused electricity wastage.

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.

2.2 Block Diagram Description:

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

following essential blocks.

Power Supply

IR Sensors

Arduino Uno R3 micro-controller

20
LED

LCD Display

2.2.1 Power Supply:


Here we used +5V dc power supply from computer USB. The main

function of this block

is to provide the required amount mount of voltage to essential circuits. +5V is


given to 2 IR

sensors, transistor (BC549C) and to a LCD display.

2.2.2 IR Sensors:

Digital Visitor Counter

4 April 29, 2016

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

between black and white, like in line follower robots), etc.

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

https://technoelectronics 44.blogspot.com/p/microcontrollers.html with Read-


While-Write capabilities, IK bytes EEPROM, 2Kbytes SRAM, 23 general purpose
I/O lines, 32 general purpose working registers, Real Time Counter (RTC), three
flexible Timer/Counters with compare modes and PWM, I serial programmable
USARTS, I byte-oriented 2-wire Serial Interface (I2C), a 6 channel 10-bit ADC (8
channels in TQFP and QFN/MLF packages), a programmable Watchdog Timer
with internal Oscillator, an SPI serial port, and six software selectable power
saving modes.

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

The ATmega328/P is supported with a full suite of program and system


development tools including: C Compilers, Macro Assemblers, Program
Debugger/Simulators, In-Circuit Emulators, and Evaluation kits.

https://technoelectronics 44.blogspot.com/p/microcontrollers.html FEATURES


OFATMEG

 28-pin AVR Microcontroller

 Flash Program Memory: 32kbytes

 EEPROM Data Memory: 1kbytes

 https://technoelectronics4 4.blogspot.com/p/microcontrollers.html

23
 SRAM Data Memory: 2kbytes

 I/O Pins:23

 Timers: Two 8-bit / One 16-bit

 A/D Converter: 10-bit Six Channel

 PWM: Six Channels

 RTC: Yes with Separate Oscillator

 MSSP: SPI and IC Master and Slave Support

 USART: Yes

 External Oscillator: up to20MHz


ADVANTAGES/IMPROVEMENTS INATMEG328

https://technoelectronics44.blogspot.com/p/microcontrollers.html

I. Still runs on 5 V, so legacy 5 V stuff interfaces cleaner

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

4. High quality GCC port (no proprietary c

5. rap p y compilers!)

6. "PA" variants have good sleep mode capabilities, in micro- amperes.

7. Well rounded peripheral set

8. Q Touch capability

3.2Pin diagram ofATMEGA328

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

Pin Descriptions table

https://technoelectronics44.blogspot.com/p/microcontrollers.html

3.4 VOC

Digital supply voltage.

3.5 GND

Ground.

3.6 Port B (PB[7:0) XTALI/XTAL2/TOSCI/TOSC2

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.

If the Internal Calibrated RC Oscillator is used as chip clock source, PB[7:6] is


used as TOSC[2:1] input for the Asynchronous Timer/ Counter2 if the AS2 bit in
ASSR is set. 3.7 Port C(PC[5:0])

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

3.9 Port D (PD [7:0])

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

AREF is the analog reference pin for the A/D Converter.

3.11 ADC [7:6] (TQFP and VFQFN Package Only)


29
In the TQFP and VFQFN package, ADC [7:6] serve as analog inputs to the A/D
converter. These pins are powered from the analog supply and serve as 10-bit
ADC channels.

3.8 Arduino Uno Borad Description

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

FIG:4.2. Arduino UNO board

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

3.10 Power (Barrel Jack)

Arduino boards can be powered directly from the AC mains power supply by
connecting it to the Barrel Jack (2).

3.11 Voltage Regulator

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

3.12 Crystal Oscillator

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.

3.13 Arduino Reset

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

3.14 Pins (3.3, 5, GND, Vin)

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

Arduino is a open source electronics prototyping platform based on flexible,


easy-to-use hardware and software. It's intended for artists, designers,
hobbyists, and anyone interested in creating interactive. objects or
environments. It's an open-source physical computing platform based on a
microcontroller board, and a development environment for writing
software for the board. Computer or programmed by the computer and
then disconnected and allowed to work independently.

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.

The name "Arduino" is reserved by the original makers. However, clone


Arduino designs often have the letters "duino" on the end of their name,
for example, Free duino or DFR duino. The software for programming your
Arduino is easy to use and also freely available for Windows, Mac, and
LINUX computers at no cost.

1.1.1 Microcontroller

Microcontroller can be described as a computer embedded on a rather


small circuit board. To describe the function of a microcontroller more

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

However, the u C by itself, cannot accomplish much; it needs several


external inputs: power, for one; a steady clock signal, for another. Also, the
job of programming it has to be accomplished by an external circuit. So
typically, au C is used along with a circuit which provides these things to it;
this combination is called a microcontroller board. The Arduino Uno that
you have recieved, is one such microcontroller board. The actual
microcontroller at its heart is the chip called Atmega328. The advantages
that Arduino offers over other microcontroller boards are largely in terms
of reliability of the circuit hardware as well as the ease of
programming and using it.

CHAPTER 4

IR SENSORS

Basics of IR transmitter and receiver

Transmitter and receiver are commonly used in Engineering


projects for remote control of objects. In particularly, in Robotic system
uses transmitter and receiver. Here I would like to describe the basics if IR
transmitter and receiver.

4.1 Transmitter:

An electro luminescent IR LED is a product which requires care in


use. IR LEDs are fabricated from narrow band hetero structures with energy
gap from 0.25 to 0.4 eV. Infra-red transmitter emits IR rays in planar wave
front manner.

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.

When IR rays gets emitted from LED, it moves in the direction it is


angled. When any obstacle interferes in the path, the IR rays get cut and it
produces secondary wavelets which propagates mostly in return direction or in
a direction opposite to that of the primary waves, which produces the net
result like reflection of IR rays.

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.

A photodiode consists of PN junction or PIN structure. When a


photon of sufficient energy strikes the diode, it excites an electron thereby
creating a mobile electron and a positively charged electron hole. If the
absorption occurs in the junction's depletion region, or one diffusion length
away from it, these carriers are swept from the junction by the built-in field of

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 software used by the Arduino is Arduino IDE.

The Arduino IDE is a cross-platform application written in Java, and is


derived from the IDE for the Processing programming language and the Wiring
project. It is designed to introduce programming to artists and other
newcomers unfamiliar with software development. It includes a code editor
with features such as syntax highlighting, brace matching, and automatic
indentation, and is also capable of compiling and uploading programs to the
board with a single click. There is typically no need to edit make files or run
programs on a command-line interface. Although building on command-line is
possible if required with some third-party tools such as Ino.

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

 Loop () a function called repeatedly until the board powers off

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 () {

pin Mode (LED_PIN, OUTPUT); // enable pin 13 for digital output


}
void loop () {

digital Write (LED_PIN, HIGH); // turn on the LED

delay (1000); // wait one second (1000 milliseconds)

digital Write (LED_PIN, LOW); // turn off the LED

delay (1000); // wait one second

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.

For educational purposes there is third party graphical development


environment called Mini block available under a different open-
source license.

41
4.2 language reference

Arduino programs can be divided in three main

parts: structure, values (variables and constants), and functions.

Available datatypes in ARDUINO IDE are

void

boolean

char (0255)

byte 8-bit data (0-255)

int 16-bit data (32,767--32,768)

long 32-bit data (2,147,483,647 to -2,147,483,648)

'float

double

'string char array

•String - object

array

Arithmetic operators

Arithmetic operators include addition, subtraction, multiplication and


division. For math that requires fractions, you can use float variables, if
you can bear large size and slow computation speeds in your
microcontroller.

42
e.g.,

y = y + 3;

x = x 7;

i = j * 6;

r = r/5;

Comparision operators

Comparisons of one variable or constant against another are often used


in if statements to test if a specified condition is true.

e.g.,

x == y // x is equal to y

x ! = y x is not equal to y x < y // x is less than y

x > y // x is greater than y x <= y // x is less than or equal to y

x >= y // x is greater than or equal to y

Logical operators Logical operators are usually a way to logically


combine two expressions and return a TRUE or FALSE depending on
the operator. There are three logical operators, AND, OR, and NOT.

e.g.,

Logical AND:

if (x > 0 && x < 5) // true only if both expressions are true

Logical OR:

43
if (x > 0 || y > 0) // true if either expression is true

Logical NOT:

if (! x > 0) // true only if expression

TRUE/FALSE

These are Boolean constants that define logic levels of the arduino.

FALSE is easily defined as 0 (zero) TRUE is often defined as 1, but can


also be anything else except zero. So in a Boolean sense, 1, 2, and 200
are all also defined as TRUE.

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

reading or writing to digital pins.

44
HIGH is defined as logic level 1, ON, or 5 volts

LOW is logic level 0, OFF, or 0 volts.

e.g.,

digital Write (13, HIGH);

INPUT/OUTPUT

These constants define pin levels as HIGH or LOW and are used when

reading or writing to digital pins.

HIGH is defined as logic level 1, ON, or 5 volts

LOW is logic level 0, OFF, or 0 volts.

e.g.,

pin mode (13, OUTPUT);

Arduino/processing language Comparision

The Arduino language (based on Wiring) is implemented in C/C++, and


therefore has some differences from the Processing language, which is
based on Java.

4.3 SIMULATOR for ARDUINO:

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.

This app is an easy way to work through Arduino projects. With


customizable codes, and a simple to use interface, this Arduino
Simulator app from Schogini Systems is a convenient app for
Arduino developers.

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

int a1, a2, b1, b2, c1, c2, d1, d2;

void setup () {

Serial. begin(9600);

Pin Mode(ledA1, OUTPUT);


Pin Mode(ledA2, OUTPUT);
Pin Mode(ledA3, OUTPUT);

Pin Mode(ledB1, OUTPUT);


Pin Mode(ledB2, OUTPUT);
Pin Mode(ledB3, OUTPUT);

Pin Mode(ledC1, OUTPUT);


Pin Mode(ledC2, OUTPUT);
Pin Mode(ledC3, OUTPUT);

Pin Mode(ledD1, OUTPUT);


Pin Mode(ledD2, OUTPUT);
Pin Mode(ledD3, OUTPUT);

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 == 1 && a2 == 0) && (c1 == 0 || c2 == 0) && (d1 == 0 || d2 ==


0) && (b1 == 0 || b2 == 0))
{
Road A 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);

if (a1 < 400) a1 = 1; else a1 = 0; if (a2 < 400) a2 = 1; else a2 = 0;


if (b1 < 400) b1 = 1; else b1 = 0; if (b2 < 400) b2 = 1; else b2 = 0;
if (c1 < 400) c1 = 1; else c1 = 0; if (c2 < 400) c2 = 1; else c2 = 0;
if (d1 < 400) d1 = 1; else d1 = 0; if (d2 < 400) d2 = 1; else d2 = 0;

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");

void road A open()


{
Digital Write(ledA3, LOW);

digital Write(ledA1, HIGH);


digital Write(ledB3, HIGH);
digital Write(ledC3, HIGH);
digital Write(ledD3, HIGH);
delay(10000);
digital Write(ledA1, LOW);
digital Write(ledA2, HIGH);
delay(1000);

50
digital Write(ledA2, LOW);
read Sensor();
}

void road B open()


{
Digital Write(ledB3, LOW);

digital Write(ledA3, HIGH);


digital Write(ledB1, HIGH);
digital Write(ledC3, HIGH);
digital Write(ledD3, HIGH);
delay(10000);
digital Write(ledB1, LOW);
digital Write(ledB2, HIGH);
delay(1000);
digital Write(ledB2, LOW);
read Sensor();
}

void road C open()


{
Digital Write(ledC3, LOW);

digital Write(ledA3, HIGH);


digital Write(ledB3, HIGH);
digital Write(ledC1, HIGH);
digital Write(ledD3, HIGH);
delay(10000);
digital Write(ledC1, LOW);
digital Write(ledC2, HIGH);
delay(1000);
digital Write(ledC2, LOW);
read Sensor();
}

void road D open()


{
Digital Write(ledD3, LOW);

Digital Write(ledA3, HIGH);


Digital Write(ledB3, HIGH);
Digital Write(ledC3, HIGH);
Digital Write(ledD1, HIGH);
delay(10000);
digital Write(ledD1, LOW);
digital Write(ledD2, HIGH);
delay(1000);

51
digital Write(ledD2, LOW);
read Sensor();
}

ADVANTAGES & APLICATIONS

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:

1) S. M. Mohaimin-ul- Islam; Dept. of Computer Science, South Asian


Univ., New Delhi, India

; Md. Mahbub-E-Noor, S. M. Tanvir Siddique Simulation of energy


efficient Bi directional Visitor Counting Machine.

2) http://www.engineersgarage.com/electronic
components/atmega328P- microcontroller
52
3) www.datasheets4u.com

53

You might also like