You are on page 1of 51

1

CHAPTER I

INTRODUCTION

1.1 Background of Studies

Stand-alone traffic light which may also be known as solar traffic lights, are signaling
devices powered by solar panels positioned at a road intersection, pedestrian crossing,
or other location in order to indicate when it is safe to drive, ride, or walk using a
universal color of code. The whole world have already assigned the right way to road
users by the use of the signal light in standard color (Red, Yellow, and Green) as
shown in Figure 1.1. Color of the RED signal light have means to stop and prohibits
any vehicles from proceed. However YELLOW signal light means any vehicles have
to prepare to stop, and GREEN signal light means any vehicles could proceed in the
direction of the road [1].

FIGURE 1.1 Standard Signal Light Color Of Traffic Light

Solar traffic light also can be used during "blackout" situation or natural
disaster because most of the solar traffic lights systems have battery for electricity
back-up. Therefore, the battery also used for sustain solar traffic light to be
2

functioning during night. The solar traffic lights have given many benefits to all road
users. Besides reducing the number of accidents, it made the traffic flow smoothly and
possibly could save people time.

There are several advantages by having solar traffic light compared with
traditional traffic light. First, solar power traffic light module is easy to install and
quick to reinstall, which is the best advantage over others. Second, the power supply is
independent. It is mainly rely on the solar. Hence, the solar power traffic lights are
low power consumption. Third, solar power traffic light is no cabling which it can
communicate wirelessly and can be place at any location since it is portable.
3

1.2 Problem Statement

Kampung Batang Benar is a small town located at Negeri Sembilan, Malaysia which
is nearest to Nilai big town. People of Kampung Batang Benar who work at others
area or want to go outside of their hometown have to go through the single-lane bridge
which is located as shown in Figure 1.2. This single-lane bridge are build for vehicles
to cross over the KTM (Keretapi Tanah Melayu) railways and indirectly the single-
lane bridge become the shortest road for people who live at Kampung Batang Benar
area to go outside of their hometown or go to nearest big town.

Kg. Batang
Benar

FIGURE 1.2 Location of Single-Lane Bridge at Kampung Batang Benar,


Negeri Sembilan

Furthermore, because of the single-lane bridge itself and it is also located at a


hill's blind spot, there are always occur traffic problems at the location. During
weekdays especially on the rush hours, there are always traffic jammed occurs in this
single-lane bridge because users could not realize situation on the opposite side of the
direction. The situation could also get worst when there are vehicles getting stuck on
the bridge or an accident occurred. Therefore, these problems could be solve by using
" Single-Lane Bridge Stand-Alone Traffic Light " system.
4

1.2.1 Problem Situation

The situations shown in Figure 1.3 and Figure 1.4 below are some of the factors that
could cause the traffic problems at the location. This is because only one of the sides
could cross the bridge at a time and the other sides have to wait until all vehicles on
the other direction crossed the bridge. On the rush hour, numbers of the vehicles will
increase at the both direction of the road. This will cause a chaos in situation, NO
ruling on who should go first. Thus, vehicles in other direction have to wait for a long
times to cross the bridge. This will lead to a traffic jam to occur.

FIGURE 1.3 Single-Lane Bridge Only Enough For One Way Of Direction
At A Time

FIGURE 1.4 Vehicle On Opposite Direction Have To Wait When There Are Vehicles
Cross The Bridge From The Other Direction
5

1.3 Objective of Project

 To develop single-lane traffic control system to allowed only one direction at a


time.
 To ensure traffic for each direction move efficiently.
 Saving energy and reduce cost for power supply by using solar system.
 Create power storage for support solar system.

1.4 Scope of Project

Stand-alone traffic light systems is a concept of using solar system to operate the
system. The design of the project will operate in wireless system which it will use
Xbee radio communication device to transmit and receive signal from stand-alone
traffic light A and B. The project also will use ARDUINO as a processor to control
the whole systems of the traffic flow on the single lane bridge. Therefore, ARDUINO
programming code need to be study and understand to ensure the system of the project
will operate efficiently.

1.5 Methodology

This project is carried out according to these methodologies:

 Literature review on the concept of traffic light system.


 Study and understand ARDUINO programming code.
 Design the control system for "Single-Lane Bridge Stand-Alone Traffic Light".
 Implement the design into prototype circuit.
 Testing and commission the circuit.
 Thesis writing.
6

CHAPTER II

LITERATURE RIVIEW

2.1 Introduction Of Arduino Microcontroller

Arduino is made up of both hardware and software. The Arduino board is a printed
circuit board (PCB) which is shown in Figure 2.1 is specifically designed to use a
microcontroller chip as well as other input and outputs. It also has many other
electronic components that are needed for the microcontroller to function or to extend
its capabilities. Microcontrollers are small computers contained within a single,
integrated circuit or computer chip, and they are an excellent way to program and
control electronics. Many devices, referred to as microcontroller boards, have a
microcontroller chip and other useful connectors and components that allow a user to
attach inputs and outputs. Some examples of devices with microcontroller boards are
the wiring board, the Programmable Interface Controllers (PIC), and etc.

For the project, programming code can be write in the Arduino to tell the
microcontroller what to do for the entire systems. Similarly to a conventional
computer, an Arduino can perform a multitude of functions, but it’s not much use on
its own. It requires other inputs or outputs to make it useful. These inputs and outputs
allow a computer to sense objects in the world and to affect the world. By using
ARDUINO, the project can be stand-alone or it can communicate with software
running on a computer.
7

(a) (b)

FIGURE 2.1 ARDUINO Board ; (a) Top View, (b) Bottom View

Nowadays, there are several types of Arduino microcontroller with different


capability could be use for a system controller such as Arduino UNO, Arduino Pro,
Arduino Mega and so on. For this project, Arduino UNO (R3) will be use as a
processor to control the whole of the traffic light systems. It has 14 digital
input/output pins which 6 pins can be used as PWM outputs, 6 analog inputs, a USB
connection, a power jack, a reset button and more. This Arduino board is easy to use
and can be simply connected it to a computer with a USB cable or power it with a AC-
to-DC adapter or battery as a power input.
8

2.2 Common Components On Arduino Uno (R3)

FIGURE 2.2 Arduino Common Components

2.2.1 Power Input

For each of Arduino boards, it has to be connected to a power source for it to operate.
There are two ways could be use to powered up the Arduino board. The first way is
connect to a computer by using USB cable on labeled (1) which shown in Figure 2.2.
The other way is connect port labeled (2) to a wall power supply that is terminated in
a barrel jack [2]. Usually the power input for the Arduino board can be supply
between 6V to 12V. The power supply should not be greater than 20V which it will
overpower the Arduino board. The USB connection also can be use to upload the
programming code onto Arduino board.
9

2.2.2 Pins

The pins on this Arduino board are the place for wire connection during construct the
design circuit for the project which labeled as (3) to (9) in Figure 2.2. Each labeled
pins have its own used for different function. The functions for each labeled pins are
as below.

 Pin labeled (3) as ‘Ground’ (GND)


There are several GND pins on the Arduino which can be used as ground for
the circuit.
 Pin labeled (4 & 5) as ‘Pin Supllies’
Pin supplies labeled (4) is for 5V of power and labeled (5) is for 3.3V. Most of
the components with the Arduino can be powered up with 5V or 3.3V.
 Pin Labeled (6) as ‘Analog’
This pin can read the signal from an analog sensor such as temperature sensor
and convert into a digital value.
 Pin labeled (7) as ‘Digital’
These pins can be used for both digital input and digital output.
 Pin labeled (8) as ‘PWM’
These pins act as normal digital pins, but can also be used for something called
Pulse-Width Modulation (PWM).
 Pin labeled (9) as ‘AREF’
AREF is stands for Analog Reference. It is sometime used to set an external
reference voltage between 0V to 5V as the upper limit for the analog input
pins.

2.2.3 Reset Button

The labeled (10) in Figure 2.2 is a reset button for Arduino. By pushing the reset
button, it will temporarily connect the reset pin to ground and restart any code that is
loaded on the Arduino [2].
10

2.2.4 Power LED Indicator

The Power Led Indicator is shown in Figure 2.2 as labeled (11). The function of this
LED indicator is to shows the activation of the Arduino which the LED will light up
whenever it plugged into a power source [2].

2.2.5 Tx and Rx LED’s

Tx is stands for transmit and Rx is stands for receive which is labeled as (12) in Figure
2.2. These LEDs will shows the visual indications whenever the Arduino is receiving
or transmitting data from other devices [2].

2.2.6 Main IC (Integrated Circuit)

The main IC labeled (13) is functions as the brain of the Arduino to read all of the
programming code uploaded onto Arduino. The main IC on the Arduino is slightly
different from board type to board type, but is usually from the ATmega line of IC’s
from the ATMEL’s company [2].

2.2.7 Voltage Regulator

The voltage regulator labeled (14) in Figure 2.2 is for control the amount of voltage
that is let into the Arduino board. This voltage regulator could also turn away an extra
voltage that might harm the circuit [2]. But it also has a limit. It cannot be function if
the Arduino is hook up with anything greater than 20 volts.
11

2.3 Introduction of Solar Energy

Solar energy is quite simply the energy produced directly by the sun and collected
elsewhere, normally the Earth. Every day the sun radiates or sends out an enormous
amount of energy. The sun radiates more energy in one day than the world uses in one
year. Like other stars, the sun is a big ball of gases which is mostly hydrogen and
helium atoms. The hydrogen atoms in the sun’s core combine to form helium and
generate energy in a process called nuclear fusion [3,4].

During nuclear fusion, the sun’s extremely high pressure and temperature
cause nuclei to separate from their electrons. At this extremely energized state, the
nuclei are able to fuse, or combine. Hydrogen nuclei fuse to become one helium atom
of a higher atomic number and greater mass and one neutron remains free. This new
helium atom, contains less mass than the combined masses of the hydrogen isotopes
that fused. This transmutation of matter results in some mass being lost. The lost
matter is emitted into space as radiant energy. The process of fusion occurs most
commonly with lighter elements like hydrogen, but can also occur with heavier nuclei
until iron (Fe) is formed. Because iron is the lowest energy nucleus. It will neither
fuse with other elements, nor can it be split into smaller nuclei.

It can take 150,000 years for the energy in the sun’s core to make its way to
the solar surface, and then just a little over eight minutes to travel the 93 million miles
to earth. The solar energy travels to the earth at a speed of 186,000 miles per second,
the speed of light (3.0 x 108 meters per second) [4].

Only a small portion of the energy radiated by the sun into space strikes the
earth such as one part in two billion. Yet this amount of energy is enormous. Each
hour the sun provides enough energy to supply our nation’s energy needs for one year.
Where does all this energy go? About 30 percent of the sun’s energy that hits the earth
is reflected back into space. Another 25 percent is used to evaporate water, which,
lifted into the atmosphere, produces rainfall. Solar energy is also absorbed by plants,
the land, and the oceans. The rest could be used to supply our energy needs.
12

2.4 Advantages of Solar Energy

 It is an abundant Renewable Energy.


 This technology is Omnipresent and it can be captured for conversion on a
daily basis.
 It is a Non-polluting technology, which means that it does not release green
house gases.
 It is a Noiseless technology as there are no moving parts involved in energy
generation.
 This technology requires Low-maintenance because of lack of moving parts.
 It can be installed on modular basis and expanded over a period of time.
 Most viable alternative for providing electricity in remote rural areas as it can
be installed where the energy demand is high and can be expanded on modular
basis.
13

CHAPTER III

CONTROL SYSTEM AND MAIN COMPONENTS

3.1 Design Concept

This chapter will mostly focus on the concept design of the "Single Lane Bridge
Stand-Alone Traffic Light" project. This project is use renewable energy of solar
energy as a power source and Xbee radio communication device to transmit or receive
data signal from traffic light A and B wirelessly. Block diagram in Figure 3.1 shown
the flow of the entire design for Single Lane Bridge Stand Alone Traffic Light project.

FIGURE 3.1 Block Diagram of The Entire Design for Single Lane Bridge
Stand Alone Traffic Light
14

From figure 3.1, it is shown that the entire each system powered using sunlight
by a solar panel and stored in a battery. So that, the system of the traffic light could be
operate 24 hours during day and night. Photovoltaic panels are use for charging
batteries by converting the sunlight into electricity. For each stand-alone traffic light, a
charge controller is use to control the charging. For control the system, ARDUINO is
use as a processor to read the programming code for the entire system.
15

3.2 Design Flow Chart

3.2.1 Initial Flow of EAST and WEST System

WEST EAST
START START

WEST R = HIGH EAST R = HIGH


WEST Y = LOW EAST Y = LOW
WEST G = LOW EAST G = LOW

RECEIVER
EAST
STARTSIGNAL
NO = HIGH ?

YES
TRANSMIT
‘M’

RECEIVER
WEST

FIGUE 3.2 Initial Condition For WEST and EAST System

Figure 3.2 shows that, both systems will shows Red signal light for initial condition
after supply is given. Taking WEST system as the main system, the systems will keep
remain at this condition until the WEST system detects a High “StartSignal”. If a High
“StartSignal” was detected at the WEST system, then a “M” signal is transmitted to
EAST system and from here both east and west system will start to communicate with
each other wirelessly.
16

3.2.2 The System Loop

RECEIVER
WEST

NO
SIGNAL
AVAILABLE ?

YES

SIGNAL = O ? YES
TRANSMIT
& RED
‘M’
SENSOR = HIGH ?

NO

SIGNAL = O ? YES
TRANSMIT DELAY TRANSMIT
& RED GREEN
‘Q’ 13000 ‘K’
SENSOR = LOW ?

NO DELAY
7000
SIGNAL = N ? YES
TRANSMIT
& RED
‘M’
SENSOR = HIGH ?

NO

SIGNAL =N ? YES
TRANSMIT WEST G=LOW GREEN TRANSMIT
&
‘T’ WEST R=LOW BLINK ‘K’
SENSOR = LOW ?

NO

SIGNAL = P ? YES
YELLOW
& WEST R=HIGH
BLINK
SENSOR = HIGH ?

NO

SIGNAL = P ? YES
YELLOW
& WEST R=HIGH
BLINK
SENSOR = LOW ?

NO

SIGNAL = X ? YES
TRANSMIT
&
‘Y’
SENSOR = HIGH ?

NO

NO SIGNAL = S ? YES
YELLOW TRANSMIT
& WEST R=HIGH
BLINK ‘K’
SENSOR = HIGH ?

FIGURE 3.3 The WEST Systems Loop


17

RECEIVER
EAST

NO
SIGNAL
AVAILABLE ?

YES

SIGNAL = K ? YES
TRANSMIT
& RED
‘N’
SENSOR = HIGH ?

NO

SIGNAL = K ? YES
TRANSMIT DELAY TRANSMIT
& RED GREEN
‘P’ 13000 ‘O’
SENSOR = LOW ?

NO DELAY
7000
SIGNAL = M ? YES
TRANSMIT
& RED
‘N’
SENSOR = HIGH ?

NO

SIGNAL =M ? YES
TRANSMIT EAST G=LOW GREEN TRANSMIT
&
‘X’ EAST R=LOW BLINK ‘O’
SENSOR = LOW ?

NO

SIGNAL = Q ? YES
YELLOW
& EAST R=HIGH
BLINK
SENSOR = HIGH ?

NO

SIGNAL = Q ? YES
YELLOW
& EAST R=HIGH
BLINK
SENSOR = LOW ?

NO

SIGNAL = T ? YES
TRANSMIT
&
‘S’
SENSOR = HIGH ?

NO

NO SIGNAL = Y ? YES
YELLOW TRANSMIT
& EAST R=HIGH
BLINK ‘O’
SENSOR = HIGH ?

FIGURE 3.4 The EAST Systems Loop


18

In Figure 3.3 and Figure 3.4 shows the loop of WEST and EAST systems for the
stand-alone single lane bridge traffic light’s project. Both systems are communicates
thru Xbee radio communication device and it is wireless. The correct light signal
whether ‘Red’, ‘Yellow’ or ‘Green’ will be shown by either WEST or EAST system
once the real condition is evaluate by the controller. The signal is transmitted and the
conditions have to be matched correctly to ensure the flow of traffic system could
operate smoothly.

There are 3 conditions of the systems to control the traffic flow on the single
lane bridge:

Condition 1 : No vehicles exist at the both side of the directions.


Condition 2 : Vehicles existed at the BOTH (West and East) side of the
direction.
Condition 3 : Vehicles existed ONLY at the one side of the direction.
(whether West or East)
19

3.2.3 The System Call Function

RED YELLOW GREEN


BLINK BLINK

RED = HIGH
RED = LOW RED = LOW
YELLOW= LOW
YELLOW= LOW YELLOW= LOW
GREEN = LOW
GREEN = LOW GREEN = LOW
a=0 a=0
DELAY
1000

YELLOW=HIGH GREEN =HIGH


END
DELAY DELAY
500 500
GREEN
YELLOW=HIGH GREEN =HIGH
RED = LOW
YELLOW= LOW DELAY DELAY
GREEN = HIGH 500 500

NO NO
DELAY
a = 5? a = 5?
1000
YES YES
END END END

FIGURE 3.5 Call Function

From Figure 3.5 shows above, 3 types of call functions to show the output of the
systems. These functions will be called accordingly when EAST or WEST system
detect signal, it will match with the conditions as in Figure 3.3 and Figure 3.4.

The full designed programming code for each systems shown in Figure 3.2
until Figure 3.5 can be referred to Appendix 1. This programming code had been
uploaded into West and East Arduino microcontroller to provide the required signal
output which can control the traffic flow on the single lane bridge.
20

3.3 The Design of Solar System ( Photovoltaic Cells )

Photovoltaic is the direct conversion of light into electricity at the atomic level. Some
materials exhibit a property known as the photoelectric effect that causes them to
absorb photon of light and release electrons. When these free electrons are captured,
an electric current result that can be used as electricity. If the PV cell is placed in the
sun, photons of light strike the electrons in p-n junction and energize them, knocking
them free of their atoms. These electrons are attracted to the positive charge in the n-
type silicon and repelled by the negative charge in the p-type silicon. Most photon-
electron collisions actually in the silicon base [4,5]. The works of photovoltaic cells is
shows as in Figure 3.6.

FIGURE 3.6 Photovoltaic Cell works FIGURE 3.7 Solar Panel 12V

If electrical conductors are attached to the positive and negative sides, forming
and electrical circuit, the electrons can be captured in the form of an electric current
which is electricity. This electricity can then be used to give the power supply for
Stand-Alone Traffic Light.
21

3.4 The Design of Battery System

To ensure the Stand-Alone Traffic Light have enough power to continuously operate
for 24 hours, battery system as shown in Figure 3.8 have to be implement. This is
because Photovoltaic (PV) system could not store the electricity, so that batteries are
often added to maintain and provide electricity continuously [6]. A PV array will
connect to a solar charger and this solar charger will connected to a battery bank.
During daylight hours, the PV array charges the battery bank. The solar charger also
known as a “charge controller”, so that it could keep the battery properly charged and
prolong its life by protecting it from being overcharged or completely discharged.

Solar Panel Solar Charge Controller Battery

FIGURE 3.8 Battery Systems

3.4.1 Solar Charge Controller

Solar charge controller is needed almost in all solar power systems that requires
batteries. The solar charge controller regulates the power from the solar panels to
the battery. Overcharging and undercharging of battery will reduce battery life and
at worst it could damage the batteries to the point that they are unusable. Usually,
a solar panel only have 30% of efficiency and the choosing of an efficient
controller is a vital to maximize the power output from the solar panel.
22

3.5 The Control System

Control systems is the most important part to ensure the Stand-Alone Traffic Light
could solve the traffic problems which is always occurs at single lane bridge. To solve
the problems, it have to control everything such as it have to control the flows of the
signal lights which is Red, Yellow and Green, control the time duration for vehicles to
cross the single lane bridge and etc. There are 4 main components for control systems
used in this project:

i. Arduino Microcontroller
ii. Arduino Shield
iii. Xbee (radio communication)
iv. IR Sensor

3.5.1 Arduino Microcontroller

Arduino Microcontroller as shown in Figure 3.9 is capable to control the output of the
whole systems of the Stand-Alone Traffic Light. We need to program the Arduino
microcontroller to our system design. The program will control the flows of the signal
lights to ensure the traffic at single lane bridge could move smoothly. Besides that, the
programs also have to be available for wireless communication which is we need to
communicate with East and West Stand-Alone Traffic Light wirelessly.

FIGURE 3.9 Arduino Microcontroller


23

3.5.2 Arduino Xbee Shield

Arduino Xbee Shields as shown in Figure 3.10 are boards that can be plugged on top
of the Arduino microcontroller for extending its capabilities. Besides, it is also use for
place the Xbee device.

FIGURE 3.10 Arduino Xbee Shield

3.5.3 Xbee (Radio Communication)

The Xbee as shown in Figure 3.11 will be plugged on the top of the Xbee shield. Then
the arduino xbee shield will allows an Arduino board to communicate wirelessly using
the Xbee devices. The Xbee device can communicate up to 100 feet indoors or 300
feet outdoors (with line-of-sight). So that, East and West Stand-Alone Traffic Light
can communicate with each other in range of 100 feet (indoor) or 300 feet (outdoor) to
control the traffic system [7].

FIGURE 3.11 Xbee Device


24

3.5.4 IR Sensor

The concept used in this line sensor part is IR transmitter which transmit light and the
light when reflected by the surface would be received by phototransistor onboard.
Output from the sensor when no object is detected will be HIGH and LOW output
when object is detected.

Based on the design of the stand alone traffic light’s project, IR sensor will
response to the existing of the vehicles at east and west side of the single lane bridge.
It will identify the presence of the vehicles and send the signal to the Arduino
microcontroller for traffic control.

FIGURE 3.12 IR Sensor


25

CHAPTER IV

SOFTWARE REQUIREMENT

4.1 Introduction of ARDUINO IDE ( Integrated Development Environment )


Software

The entire traffic light control systems is written using Arduino command and C
programming language. Then, it is complied thru ARDUINO IDE. The compiler will
verify the source code by collecting and reorganizing the instruction. If there are no
error after compiled, the program can be upload to ARDUINO board by using the
USB cable.

FIGURE 4.1 Connection Between Arduino Board and Computer Using USB cable
26

4.1.1 How to Use ARDUINO IDE Software for Programming

The code for the ARDUINO microcontroller is compile using ARDUINO IDE
software. This section will explains the step-by-step procedures for compiling the
code and the procedures to upload the program code to ARDUINO board.

1. Lunch ARDUINO IDE software by clicking desktop icon.


2. The screen as in Figure 4.2 will be appeared

FIGURE 4.2 ARDUINO IDE Sketch Window

3. Write the programming code on the sketch window.

4. Go to "File" at the menu toolbar and save the programming code. Create a better
name for the file as shown in Figure 4.3.
27

FIGURE 4.3 Saved Programming Code File

5. Compile the programming code by click the "Verify" as shown in figure 4.4.

FIGURE 4.4 Compile the Programming Code


28

6. Before upload the programming code to the ARDUINO board, we have to set the
"Board" type and "Serial Port" at the "Tools" menu as shown in Figure 4.5 and
Figure 4.6.

FIGURE 4.5 Set the "Board" Type of the ARDUINO Board

FIGURE 4.6 Set the "Serial Port" of the ARDUINO Board


29

7. Upload the programming code to ARDUINO board by click the "Upload" as


shown in Figure 4.7.

FIGURE 4.7 Uploading the Programming Code

8. Done Uploading programming code to ARDUINO board.


30

4.2 Introduction of CoolTerm And X-CTU Software

CoolTerm and X-CTU software is a simple serial port terminal application to identify
which of the Xbee radio communication will be set as coordinator and router. For this
project, Xbee radio communication is use as transmitter and receiver to exchange data
and communicate each other to control the flow of traffic on single lane bridge.

FIGURE 4.8 Wireless Comunication Using Xbee (Radio Communication)

4.2.1 How to Setting Xbee (Radio Communication)

To ensure this project can control the flow of traffic as a wireless system, this section
will explain the step-by-step procedures to set both of the Xbee (Radio ommunication)
using CoolTerm software. In other words, signal from Xbee East will be transmitted
to Xbee West and Xbee East also available to received signal from Xbee West.
Components such as USB cable, 2 unit Xbee, 2 unit Xbee Adapter and a PC as shown
in Figure 4.9 are uses for Xbee (radio Communication) setting.

FIGURE 4.9 Components Use for Xbee (radio Communication) Setting


31

4.2.2 Configure The First Xbee

1. Mark the first XBee as “A”.


2. Insert the XBee into the XBee Explorer and connect it to the computer with a
USB cable. Then, lunch the CoolTerm software by clicking icon

3. Open CoolTerm, window as in Figure 4.10 will be shown. Then click “Options”,
and window as in Figure 4.11 will be shown.

FIGURE 4.10 Window of CoolTerm Software

FIGURE 4.11 Window of Serial Port Options


32

4. Choose the serial port, here is ‘COM3’. The available ports also can be look on
the list option, and then disconnect the XBee Explorer from computer. Click
“Re-Scan Serial Ports” and check which serial port disappeared. Reconnect
XBee Explorer, click “Re-Scan Serial Ports” and choose that port.
5. Be sure Baudrate is set to 9600.
6. Be sure Data Bits is set to 8.
7. Be sure Parity is set to “none.”
8. Be sure Stop Bits is set to 1.
9. In the list on the left side of the options window, click “Terminal” to show
window as in Figure 4.12.

FIGURE 4.12 Window of Terminal Options

10. Be sure “Local Echo” is activated. This is for checking input when the Xbee
received data and write it into the terminal.
11. Click OK to save those settings and close the Options window.
12. Click “Connect” on the toolbar and ensure the “Connected” shows on the status
bar at the bottom of the window.
13. Type “+++” to enter command mode and “OK” will be reply from the system.

* Note: By default, the XBee will automatically leave command mode if it does
not receive any commands in a 10 second period.
33

14. Table 4.1 shows a chart of the commands settings to be set.

TABLE 4.1 Commands Setting for Xbee ‘A’

Function Command Parameter


3001
PAN ID ATID
(any address from 0 to FFFE)
MY Address ATMY 1
0
Destination address high ATDH
(indicates a 16-bit address)
Destination address low ATDL 2

15. Type in each command followed by its parameter and hit enter.
16. Verify the setting by typing the command without a parameter.
17. Type ATWR to save the settings.
18. In Figure 4.13 will show how the terminal session will look, starting with the
“+++” to enter command mode.

FIGURE 4.13 Terminal Session Xbee A

19. Click disconnect in CoolTerm and remove the XBee A from the XBee Explorer.
34

4.2.3 Configure The Second Xbee

1. Mark the second XBee as “B”.


2. Place the XBee into the XBee Explorer and click “Connect” in CoolTerm.
3. Follow procedures 3 to 14 in configure the first Xbee.
4. Table 4.2 is a chart of the commands settings to be set on the second Xbee.

TABLE 4.2 Command Setting for Second Xbee

Function Command Parameter


3001
PAN ID ATID
(any address from 0 to FFFE)
MY Address ATMY 2
0
Destination address high ATDH
(indicates a 16-bit address)
Destination address low ATDL 1

5. In Figure 4.14 will show how the terminal session will look.

FIGURE 4.14 Terminal Session Xbee B

6. Click disconnect in CoolTerm and remove the XBee B from the XBee Explorer.
35

4.2.4 How To Check Two Xbee Communicate Each Other

To check the communication of both Xbees, here is several procedure which need to
be followed.

1. Insert both XBees into the XBee Explorer and connect it to the computer with a
USB cable. Then, lunch X-CTU software by clicking icon

2. Test each of the Xbee by clicking the “Test / Query” to ensure the computer are
available to read the modem as shown in Figure 4.15.

*Note : If the computer are unavailable to read the modem after done setting
the configuration of each Xbees, close the X-CTU software and
reconnect the Xbees, the lunch again the X-CTU software.

FIGURE 4.15 Communication Test / Query Modem for Each Xbees


36

3. Then, click “Terminal” on the menu to check the communication between both
Xbee A and Xbee B.
4. Figure 4.16 and Figure 4.17 shows the consequences of the communication.

FIGURE 4.16 Xbee A Transmited Signal (Blue Sentences) and Xbee B Received
the Signals (Red Sentences)

FIGURE 4.17 Xbee B Transmited Signal (Blue Sentences) and Xbee A Received
the Signals (Red Sentences)

5. Test successful. Close X-CTU software and remove the XBee B from the XBee
Explorer.
37

CHAPTER V

HARDWARE PROTOTYPE

5.1 Introduction

This chapter will review about the procedure to build the project’s prototype. Figure
5.1 shows the final structure of the prototype for the project. This prototype of “Single
Lane Bridge Stand-Alone Traffic Light” was built using Arduino microcontroller as
its main processor. The programming part and coding was designed and written in
Arduino IDE software according to the system requirement by using C programming
language. Solar panel, solar charge controller and battery was used as a source of
power supply for this project. Xbee radio communication device was used to ensure
this project could communicate each other by transmit and receive data signals
wirelessly. This project also used IR sensor as a detector to detect the existing vehicles
at the both side on the single lane bridge and send the right command to Arduino
microcontroller. Then, the Arduino microcontroller will ensure the right condition
matched to provide the right output for the traffic flows on the single lane bridge.

FIGURE 5.1 Final Prototype of Single Lane Bridge Stand Alone Traffic Light
38

5.2 Hardware Construction

Here is the list of hardware used to construct 1 unit the project’s prototype.

 2 units of 1 Watt/ 7.5 Volts


 1 unit of solar charge controller
 1 unit of sealed lead acid battery 12 Volts / 1.2 AH
 1 unit of toggle switch
 1 unit of Arduino supply connector
 1 unit of Arduino UNO R3
 1 unit of Arduino Xbee shield
 1 unit of Xbee device
 1 unit of IR sensor
 4 units of red led
 4 units of yellow led
 4 units of green led
 16 units of resistor 220 Ω
 Various connection wires
 Circuit board
 2 types of black box (big and small)

Tools used to build this prototype is as below.

 Solder iron 28W


 Solder lead pro’s kit
 Wire Cutter
 Portable hand-drill
39

5.2.1 Schematic of The Project

IR SENSOR

SOLAR PANEL 5V SIGNAL

11
GND
ARDUINO
+ 7
XBEE SHIED
SOLAR + 6
CHARGE SW XBEE
CONTROLLER 5

BATTERY

FIGURE 5.2 Schematic Project

Figure 5.2 shows the schematic of component connection starting from the solar panel
as the power source until the LED light as the output. 2 units of 7.5V solar panel have
to connect in series connection to ensure it is available to charge the 12V sealed lead
acid battery by using the solar charge controller. For IR sensor, connect 5V pin from
the Arduino board as the power soured to ensure the sensor can operate as long as
there are power source connected to Arduino board. When the IR sensor detected
existing of the vehicle, it will send the command to Arduino microcontroller for
further actions. This prototype was built with small scale, so that its only used a few
numbers of LED. The prototype here only used 4 units of LED for each color.
40

5.2.2 Structure Construction

FIGURE 5.3 Write The Programming Code To Upload Into Arduino

FIGURE 5.4 Soldering Output LED Circuit


41

FIGURE 5.5 Connect All Components Inside The Box

FIGURE 5.6 Connection Of Components Inside The Prototype


42

CHAPTER VI

RESULT AND ANALYSIS

6.1 Condition 1 : No Vehicle Exist at Both East and West Side

FIGURE 6.1 Result When There Are No Vehicles At Both Side

Each of the Stand-Alone Traffic Light was implemented with infrared sensor (IR
Sensor) which is used to detect vehicles coming from the both sides (east and west) of
the single lane bridge. When there are no vehicles detected by IR sensor at the both
side, IR sensor will communicate with the ARDUINO microcontroller and as the
results ARDUINO microcontroller will command to switch ON only the RED led
light at the both side as shown in Figure 6.1.
43

6.2 Condition 2 : Vehicles Existed at Both East and West Side

For this condition, IR sensor which is implemented on the Stand-Alone Traffic Light
detected there are vehicles coming at the both sides of the single lane bridge. To
ensure the traffic for vehicles to cross the single lane bridge from each direction can
move smoothly, ARDUINO microcontroller will take the actions to control the whole
traffic systems. ARDUINO microcontroller will control to switch on the led light on
the Stand-Alone Traffic Light. To provide the results, orange box here are use as a
vehicle which is shows in Figure 6.2 until Figure 6.5.

FIGURE 6.2 LED GREEN Switch ON at the West Side and LED RED Switch ON at
the East Side.
44

FIGURE 6.3 LED YELLOW Switch ON at the West Side and LED RED Switch ON
at the East Side.

FIGURE 6.4 LED RED Switch ON at the West Side and LED GREEN Switch ON at
the East Side.
45

FIGURE 6.5 LED RED Switch ON at the West Side and LED YELLOW Switch ON
at the East Side.

The flow to switch On the led on Stand-Alone Traffic Light will keep repeat
continuously as shown in Figure 6.2 to Figure 6.5 until it is meet with the other
conditions.
46

6.3 Condition 3 : Vehicles Existed Only at One Side

For this condition, led GREEN will switch ON continuously at one side since there is
no vehicle coming from the other side of the direction. The results shown in
Figure 6.6 and Figure 6.7.

FIGURE 6.6 LED GREEN Switch ON at the West Side and LED RED Switch ON at
the East Side.

FIGURE 6.7 LED RED Switch ON at the West Side and LED GREEN Switch ON at
the East Side.
47

6.4 Product Cost Estimation

Table 6.1 shows the cost of each component used to build the prototype of this
project, Single Lane Bridge Stand-Alone Traffic light. The total price shown in Table
3 is for 2 units of the prototype. This is to ensure this project are available to control
the traffic flows on the single lane bridge and available to transmit and receive data
signals with each other wirelessly.

TABLE 6.1 Cost 2 Units of Project

COMPONENT UNIT PRICE/UNIT PRICE


ARDUINO UNO 2 85.00 170.00
XBEE 2 140.00 280.00
IR SENSOR 2 35.00 70.00
XBEE SHIELD 2 80.00 160.00
SUPPLY CONNECTOR 2 3.50 7.00
XBEE USB ADAPTER 2 150.00 300.00
BATTERY CONNECTOR 4 0.40 1.60
BATTERY 2 35.00 70.00
SOLAR CHARGER 2 120.00 240.00
SOLAR PANEL 4 25.00 100.00
LED
24 0.30 7.20
(RED,YELLOW,GREEN)
RESISTOR 24 0.05 1.20
TOGGLE SWITCH 3 1.60 4.80
BOX (BIG) 2 11.50 23.00
BOX (SMALL) 2 2.00 4.00
HEAT SHRINK TUBE 1 1.20 1.20
CABLE 4 1.00 4.00
CIRCUIT BOARD 2 3.50 7.00
TOTAL 1451.00
48

6.5 Future Improvement

For a better system for this project to operate more efficiently a few improvements are
required. Some possible improvements could be implemented to this project of Single
Lane Stand-Alone Traffic Light is listed as below.

6.5.1 Structure of Project

The original structure of this project was built by using the normal boxes and small.
To make sure this project can be implement for use in the real location, the project
structure need to be changes which suitable to place at the location and easy to be
recognize by the single lane bridge’s users.

6.5.2 Time Setting

Arduino microcontroller is very sensitive with the time setting. To transmit and
receive data signal from a certain distance, some of the time set need to be adjust to
ensure the signal could reached it allocated destination. Then, some of systems with
specific programming code have to be design with display on the project structure to
ensure the project have the time adjustable with required distance.
49

CHAPTER VII

CONCLUSION

As the conclusion from this project, the optimization of traffic light controlled by
Arduino microcontroller and IR sensor have been studied. The main objective for this
project is to solve the traffic problems which is always happened on single lane bridge
at Kampung Batang Benar, Negeri Sembilan. Refer to the result which have been
explained on chapter 6, the simulation of the traffic light output is fulfill all of the
conditions requirement. IR sensor used to detects the existing of vehicles at the both
side of the single lane bridge. When vehicle detected, IR sensor will send the
command to Arduino microcontroller for further actions. Arduino microcontroller
which programmed with designed systems will select the best of the signal light
output of the traffic flows depends with which conditions was matched. Then, based
on the designed system, all problems related with traffic flows on the single lane
bridge can be solve by using this Single Lane Stand-Alone Traffic Light’s project.

.
50

BIBLIOGRAPHY

[1] S. NAVEENKUMAR. Design And Build Solar Streetlight System Using Led
With Automatic Light Controller, year 2013.

[2] J. NUSSEY. Arduino For Dummies, year 2013

[3] ERIC W. BROWN. An Introduction to Solar Energy, year 1988

[4] ARRIFIN BIN ABDULLAH. Portable Solar Street Lamp. PhD thesis,
Faculty of Electrical & Electronic Engineering Universiti Malaysia
Pahang, NOVEMBER, 2008.

[5] Cytron Technologies, Solar Cell 12V 250 mA (3W), Retrieved 15 July 2012.
Product description, from http://www.cytron.com.my/viewProduct.
php?pcode=SC-12V- 250MA&name=Solar.

[6] ABHIK DATTA. Design of a Lead Acid Battery Charger System. PhD thesis,
Department of Electronics and Communication Engineering National Institute
of Technology Rourkela, 2009.

[7] R. FALUDI & M. RICHARDSON. DIGI Basic XBee 802.15.4 (Series 1) from
http://examples.digi.com/get-started/basic-xbee-802-15-4-chat/.
51

APPENDICES

You might also like