You are on page 1of 31

NET455: Wireless Sensor Networks 201922 - 2020 Spring Semester

Zayed University
COLLEGE OF TECHNOLOGICAL INNOVATION

NET455: WIRELESS SENSOR NETWORKS

SEMESTER PROJECT REPORT


Title SMART SEMAFORO

Student Names and Natnael Gezea M8000728


IDs: Meron Tedros M80007287

Siem Tesfalem Fishaye M80007283


Yafiet Weldegabir Araya M80007284

Date: 10 May, 2020

-0-
NET455: Wireless Sensor Networks 201922 - 2020 Spring Semester

Table of Contents
1. Introduction .................................................................................................................. - 2 -
2. Project Idea ....................................................................................................................... - 3 -
3. Design and Implementation ............................................................................................ - 4 -
3.1 Design ............................................................................................................................ - 4 -
Equipment Needed .................................................................................................................................... - 4 -

1, Arduino Uno Board........................................................................................................... - 5 -


2, PIR motion sensor ............................................................................................................. - 6 -
3, Ultrasonic sensor .............................................................................................................. - 7 -
4, Resistor ............................................................................................................................. - 8 -
5, Breadboard ....................................................................................................................... - 8 -
6, LED Lights .......................................................................................................................... - 9 -
7, Jumper Wire.................................................................................................................... - 10 -
8,Arduino IDE software ...................................................................................................... - 10 -
Scenario Architecture .............................................................................................................................. - 11 -
3.2 Implementation: .......................................................................................................... - 15 -
Wiring the Circuits: .................................................................................................................................. - 15 -
In this section we will see the circuit diagrams of the components used in the project.................. - 15 -
Wiring the LED:........................................................................................................................................ - 15 -
1.2 Connecting the PIR Sensor ................................................................................................................ - 16 -
1.3 Connecting the Ultrasonic Sensor (HC-SR04) .................................................................................... - 18 -
The code: ................................................................................................................................................. - 20 -
Declaring the variables: ........................................................................................................................... - 20 -
The Setup:................................................................................................................................................ - 21 -
The Loop: ................................................................................................................................................. - 21 -
The lighting functions: ............................................................................................................................. - 22 -

4. Results/ outcomes of the Experimental Procedures ..................................................... - 24 -


When there are no cars: ..................................................................................................... - 24 -
When one vehicle is detected: ............................................................................................ - 24 -
When vehicles come on both direction: .............................................................................. - 25 -
5. Discussion ....................................................................................................................... - 27 -
Challenges ......................................................................................................................... - 27 -
Recommendation............................................................................................................... - 28 -
Lessons learned ................................................................................................................. - 28 -
Conclusion and future work ............................................................................................... - 29 -

-1-
NET455: Wireless Sensor Networks 201922 - 2020 Spring Semester

1. Introduction

According to studies conducted by the European Union (Delphy Study on Future and
Mobility), the volume of goods and people transported is proportional to the growth of
the GDP. In other words, as economy grows, need for transportation grows. In the last
century, with the increase of urban population and affordability of cars, vehicles mobility
has skyrocketed. The above mentioned along with other reason, has created the traffic
congestion phenomenon. In metropolitan regions, traffic congestion could be caused by
as well numerous vehicles simultaneously attempting to utilize the same infrastructure.
The results are well-known: delays, reduced velocity, and drivers’ frustrations. In major
city like Dubai or Abu Dhabi, one of your most common frustration is traffic. In such cases,
the ride is seldom better than the destination. When stuck in long line of traffic, it’s easy
to let your mind wander over solutions to traffic congestions. The increase in
transportation demand can be met by building roads with extra capacity. Be that as it
may, this might now not be financially or socially feasible or attainable. Thus, traffic
engineering seeks to make strides the existing foundation, without expanding the overall
ostensible capacity of roads by means of maximum utilization.

Moreover, it is fair to say the protocol behind the traffic light timing is incompatible with
the nature of traffic flow. The current technology implemented is pre-timed control
system with the same signal cycle despite of traffic volume. Many research have been
done in attempt to solve the traffic despair. Adaptive signal control technology (ASCT) is
one example that proposes “to adapt traffic light timing programs to the demands of real-
time traffic”. Thereby reduce traffic congestion; however, this technology has been
implemented in small number of roads. Meanwhile, managing traffic in cities is not black
and white. It is a complex task that requires systematic balance between fulfilling goals
and overcoming challenges. The main challenge happens in intersections where multiple
roads meet along with zebra crossing (pedestrians and bikes) and need to safely and
efficiently cross paths. In such cases, the maximum amount the roadway can support is
limited by the intersections themselves. Which means increasing speed limit and/or
number of lanes have no effect on the total capacity of the road. The sole option to

-2-
NET455: Wireless Sensor Networks 201922 - 2020 Spring Semester

increase number of vehicles that pass-through crossroads is to increase the efficiency of


the intersections.

Nevertheless, our team decided to think of a way we can use the concept of WSN to
propose a way we can maximize the efficiency of traffic light control. However, managing
the flow of traffic through an intersection requires careful analysis and consideration of
many conflicting factors, i.e. approach speed, space, cycle time, cost, types and volumes
of traffic, sight distance, and human factors (habits, expectations, and reaction times).
Thus, we decided to limit the scope of our project and to focus on how we can optimize
the traffic light algorithm during night where there are virtually no pedestrians and few
cars.

In this report paper, traffic light is analyzed and a new system is proposed based on WSN
simulation frameworks. The paper is organized as follows: Section 2 introduces the
project idea. Section 3 discusses design and implementations. Section 4 analyze the result
of the design. Section 5 covers the discussions about challenges, recommendations and
lesson learned. The last section draws a conclusion and future work of this paper.

2. Project Idea

Traffic volume varies throughout the day. During “rush hours”, all major roads are
overcrowded with cars. However, gradually the traffic ease out and at some point there
are hardly any cars. For example, the graph below illustrates the 2019 average traffic
congestion in Dubai. Around 6 in the afternoon, traffic is at its highest. On the other hand,
at night 2-4 am, there is no traffic congestion.

-3-
NET455: Wireless Sensor Networks 201922 - 2020 Spring Semester

Average Daily Congestion of Dubai 2019 by Hours


40
35
% of Trafic Congestion

30
25
20
15
10
5
0
5:00
6:00
7:00
0:00
1:00
2:00
3:00
4:00

8:00
9:00

15:00
16:00
17:00
10:00
11:00
12:00
13:00
14:00

18:00
19:00
20:00
21:00
22:00
23:00
Hours of a Day

Despite, the change in the volume of traffic, the traffic lighting time and cycle is the
same. Especially, to the few cars moving during the night, it is not effective option to
stop at intersection while there are no cars accessing the junction. It is time consuming
and can easily be avoided.
Therefore, the project idea is to propose new traffic light control system for intersections
during night times where the number of vehicles is at its lowest. This system is based on
the flow of cars towards the intersection. Using wireless sensors, the system can detect
the motion of the cars and by considering movement of cars from other direction will
grant “Green” or “Red”. This design is different from the traditional because it is not pre-
timed without fixed cycle time. It alternates with the movement of cars. Hence, the
implementation of “SMART SEMAFORO” can reduce unnecessary traffic congestion.

3. Design and Implementation

3.1 Design

Equipment Needed

In this project, we have used 7 parts or equipment. Some of them are in single and the
others are in multiple numbers. The equipment are Arduino Uno board, PIR motion
sensor, Ultrasonic sensor, LED lights, Breadboard, Jumper wires, and resistors of
220Ohms. The details about those equipment is explained below.

-4-
NET455: Wireless Sensor Networks 201922 - 2020 Spring Semester

1, Arduino Uno Board

Arduino Uno is an open source programmable microcontroller board which is


used to create and build interactive circuits. The Arduino Uno Board has 14
digital input/output pins, 6 analog inputs, a 16 MHz ceramic resonator, a USB
connection, a power jack, an ICSP header and a reset button. It includes every
necessary part to support the microcontroller. We can simply connect it to a
computer with a USB cable or power it with a AC -to-DC adapter or battery to
get started. Arduino Uno is a hardware device which is also connected to
software as well. You can work with your Arduino Uno and program it using the
software Arduino software IDE (integrated development environment). The
software is an easy to use platform for uploading a program on the board, and
you can use it by connecting the Arduino board to a computer via a USB cable.

Figure - Arduino Uno Board

-5-
NET455: Wireless Sensor Networks 201922 - 2020 Spring Semester

2, PIR motion sensor

Passive infrared motion sensor is a sensor used in Arduino to sense motion in front of it.
It is a device that can detect the movement of objects or people. It does it by measuring
the infrared light radiating from objects. The motion detector is separated into two
parts which measure the level of infrared radiation. The output will be high (motion
detected) or low (motion not detected) if one half sees different infrared radiation than
the other. PIR sensors are commonly used in security alarms and automatic lighting
applications. The PIR motion sensor has different ranges based on the type. It can range
from 25cm to 150 m.

Figure - PIR Motion Sensor

-6-
NET455: Wireless Sensor Networks 201922 - 2020 Spring Semester

3, Ultrasonic sensor

Note: we used ultrasonic sensor because we were short in PIR motion sensor, and it has
the ability to detect motion. Ultrasonic sensor is a sensor that uses sound waves to
determine how far away an object is from it. It can be used in very harsh environments
as it is versatile and reliable, and not susceptible to different environmental effects. It
detects motion or movement by sending sound waves, and if there is an echo returning
back, that indicates movement otherwise if there is no echo, there is no motion.
Ultrasonic sensor has four pins that can be connected to an Arduino board. The Vcc pin
is used to provide power to the sensor, usually with +5v, while the Ground pin is
connected to board ground system. The Echo pin is the output pin while the Trigger pin
is the input pin.

Figure - Ultrasonic Sensor

-7-
NET455: Wireless Sensor Networks 201922 - 2020 Spring Semester

4, Resistor

A resistor is an electrical device that restricts the flow of electricity in a circuit, reducing
the voltage and current as a result. The resistor's ability to reduce the current is called
resistance and is measured in units of ohms (symbol: Ω), and the amount of resistance
that we used in this project is 220Ω. We used resistors because the power output of the
Arduino board is +5v, and the power needed by the LED’s that we are going to use is
less than 5v (around 2v). Therefore, in order to reduce the amount of the current which
will flow into the LED’s and can burn or cause damage to the LED’s, we decided to use
resistors to cut the current to the amount that the LED’s need.

Figure - Resistor(220Ohms)

5, Breadboard

A breadboard is a rectangular plastic board with a bunch of tiny holes in it. It is


basically used to connect and assemble circuits together. All the holes in the beadboard
are not connected, rather the holes in one row are connected together. These holes let
you easily insert electronic components to build and test any kind of an electronic
circuit. You can use jumper wires to connect devices in the breadboard.

-8-
NET455: Wireless Sensor Networks 201922 - 2020 Spring Semester

Figure – Breadboard

6, LED Lights

Light emitting Diode that lights up when electricity passes through it in the correct
direction. LEDs are just tiny light bulbs that fit easily into an electrical circuit. they don't
have filaments that burn out. They use less electricity, and they do not usually get hot.
They work or get illuminated by the movement of electrons in a semiconductor
material, and they last longer just like a standard transistor. The main advantage of
LEDs over normal incandescent lamps is their efficiency. In this project we used LEDs as
traffic lights, and they can also be used in real life application.

Figure - LED

-9-
NET455: Wireless Sensor Networks 201922 - 2020 Spring Semester

7, Jumper Wire

Jumper wires are electronic cables that are used to connect different parts and devices
while creating a circuit. They wire is made of copper and the fact that they are covered
with different plastic colors makes them helpful to distinguish and use. Jumper wires
are easier to use with breadboards, and circuits.

Figure - Jumper Wire

8,Arduino IDE software

Arduino IDE (integrated development environment) software is an open source


software which is an easy platform to write code and upload it to the board. The
Arduino IDE software can run on windows, Mac OS X, and Linux, and it can be used on
any Arduino board. The software environment is written in Java and based on
Processing and other open-source software.

- 10 -
NET455: Wireless Sensor Networks 201922 - 2020 Spring Semester

Arduino IDE software

Scenario Architecture

Our system is initially designed to work on intersections during quite periods of the day
or night by comparing the flow of traffic on concurrent directions; for example, when a
vehicle on one direction approaches to the intersection from the other direction while
the traffic light is lighting amber(yellow light), the system sensor will be able to sense
the movement and check for any movement in the other concurrent directions. If there
is no any movement on the other directions, the system will give the incoming vehicle
priority and show green light and put others on hold with red light. Then traffic light
system will give the other directions the way for specific rotation, until the next period
no movement is detected.

- 11 -
NET455: Wireless Sensor Networks 201922 - 2020 Spring Semester

Scenario #: When there is no movement in all direction

If the system finds out there is no movement from all incoming directions, the system
switch from the normal Red, Green or Yellow light to flashing Amber(yellow) traffic
lights in all direction. The purpose of this primarily is to easily switch to green on one
direction and red on the rest when the system start to sense movement. The problem
that is being solved here is; vehicle drives will pass through based on their arriving
time. The amber or yellow light will change to green to the first vehicle that arrives and
then the other vehicles will be given their chance to pass. If there is no movement
detected then, the traffic light will change to amber or the yellow light back again.

- 12 -
NET455: Wireless Sensor Networks 201922 - 2020 Spring Semester

Scenario 1: When there is movement in one direction only.

Situations when there is only one direction going into an intersection are not rare
during nights. However, the current traffic light does not solve such situation, so drivers
must wait for their turn till green is lighted. Then comes our solution, where the sensors
positioned on all directions will check for any vehicles on all direction. If the traffic is
coming only from one direction, the system will give priority to the vehicles coming
from that direction. The system will have to switch from lighting amber(yellow light) to
green light in that direction and red light on the rest. This continues for the time
specified by the program.

- 13 -
NET455: Wireless Sensor Networks 201922 - 2020 Spring Semester

Scenario 2: Movement from multiple directions

What happens when there is movement of vehicles from multiple directions? To solve
such scenarios we can position the sensors at a safe distance from the intersection so
that the first detected direction can get the priority for the period by the program and
then to the other on sequential manner of next detection. In other words the vehicle
that comes first will pass through and the vehicles on the other direction will get the
chance based on the programs given period of time.

- 14 -
NET455: Wireless Sensor Networks 201922 - 2020 Spring Semester

3.2 Implementation:

The project is implemented to work only for two direction intersection due the
unavailability of sensors. We have used one PIR motion sensor, one ultrasonic sensor,
one Arduino Uno, 6 LED, three breadboards, six 220-ohm resistors, jumper wires and
power bank (to power the Arduino).

Wiring the Circuits:


In this section we will see the circuit diagrams of the components used in the project.

Wiring the LED:


The LED we used as traffic lights, so they are arranged into two groups with each red,
yellow and green LEDs. They will be facing on different directions at the intersection.
We have used 220-ohm resistors with each LED to control the current.

The first set of LEDs (highlighted as dark blue in the picture below) are connected to the
digital 2, 3 & 4 ports of the Arduino Uno as an output (NB: output means there is no any
incoming sensing information to the Arduino) with the 220 ohm resistor in series
connection in each light’s positive leg. On the negative legs, all are connected to the
Ground (GND) port of Arduino.

The Second set of LEDs (highlighted as green square below) are connected to the digital
8, 9 & 10 ports of the Arduino Uno as an output with the 220-ohm resistor in series
connection in each light’s positive leg. On the negative legs, all are connected to the
Ground (GND) port of Arduino.

The connection set is shown below as software(we used Tinkercad to design it), and
hardware setup.

- 15 -
NET455: Wireless Sensor Networks 201922 - 2020 Spring Semester

Software Setup

Hardware Setup

1.2 Connecting the PIR Sensor

The PIR sensor is used to detect motions, we will use it to check mobility of vehicles in
one direction of the road. It has three pins i.e., +5 v, GND, & output. The + 5 v of sensor is
connected to the + 5 of Arduino, the GND to GND of the Arduino and output pin to the
digital 7 port on Arduino as an input (NB: input means the Arduino will collect sensing
information on the port.). Therefore, whenever there is mobility on the road the sensor

- 16 -
NET455: Wireless Sensor Networks 201922 - 2020 Spring Semester

will send the information to the Arduino whereby the Arduino will use it to change the
conditions of program. Refer to the pic below for more information.

Software Setup

Hardware Setup

- 17 -
NET455: Wireless Sensor Networks 201922 - 2020 Spring Semester

1.3 Connecting the Ultrasonic Sensor (HC-SR04)

The ultrasonic sensor is used to check any obstruction or barrier on the distance up to
400cm. The reason we used the sensor is that because we could not find second PIR
sensor. But the sensor is useful to detect the presence of vehicles at an x distance to the
intersection on the road.

The sensor has four pins called Vcc, Trigger, Echo and Ground. The Vcc pin powers the
sensor, typically with +5V. Trigger pin is an Input pin. This pin has to be kept high for
10us to initialize measurement by sending US wave. Echo pin is an Output pin. This pin
goes high for a period of time which will be equal to the time taken for the US wave to
return back to the sensor. This pin is connected to the Ground of the system.

We connected the Vcc to the + 5 v on the Arduino, Ground to the GND on the digital port
Arduino, the Trigger to the digital 13 on Arduino as input, and the echo to digital 12 on
Arduino as output.

Software Setup

- 18 -
NET455: Wireless Sensor Networks 201922 - 2020 Spring Semester

Hardware Setup

And finally, after completing the above set ups we came up with the final circuit as
shown below.

- 19 -
NET455: Wireless Sensor Networks 201922 - 2020 Spring Semester

The code:

The code we used for the above implementation is explained below.

Declaring the variables:

Here as shown below we have assigned the ports number used on Arduino and amount
of periods to variables. We will use these variables later in the program for different
assignments.

- 20 -
NET455: Wireless Sensor Networks 201922 - 2020 Spring Semester

The Setup:
In the set up, we have declared the variables declared variables above as input or
output.

The Loop:

In this part, the system will continuously run through the conditions of the mobility to
call the lighting functions later shown in functions. For example: in line 7, it will check if
there is movement on PIR sensor side of the road. It will give the way by calling the
lighting functions, if there is. Second, the ultrasonic sensor will check if the is any
barrier in the specified distance. If there is any object in on the side, it will call the
lighting function prioritizing the side of the road.

- 21 -
NET455: Wireless Sensor Networks 201922 - 2020 Spring Semester

The lighting functions:

In this part, all the different arrangement of lighting functions is resided. For example;
the yellow both() functions will flash yellow lights on both sides by turning on and off
the yellow LEDs.

- 22 -
NET455: Wireless Sensor Networks 201922 - 2020 Spring Semester

- 23 -
NET455: Wireless Sensor Networks 201922 - 2020 Spring Semester

4. Results/ outcomes of the Experimental Procedures

When there are no cars:

During quite periods of the day, the program will check both the PIR sensor & ultrasonic
sensor for any motion. If there is hardly any mobility, the system will light flashing
yellow on both ways. This action will enable to the system to light Green one side and
Red light on the second whenever mobility is detected, green being to the firat vehicle
that shows up.

See the pic below for the results. Additionally refer to the presentation video for more.

When one vehicle is detected:

When a vehicle approaches to the intersection from one side, the system will check for
any movement on the second road. Then the system will give the first vehicle priority
and light Green for it and put the other road on hold with red light.

- 24 -
NET455: Wireless Sensor Networks 201922 - 2020 Spring Semester

See the pic below for the results. Additionally refer to the presentation video for more.

When vehicles come on both direction:

It is common for cars to approach the intersection from both directions. In this case the
system will give priority to the first detected vehicle direction and put the second on
hold. Then after specified period, it will give the other direction the way.

For example, on the picture below we stimulated sensor on the PIR sensor(we made
some movement to stimulate the motion sensor). Thus, it gave the way for that
direction and put the Arduino car on hold. After time the Arduino robot direction was
given the way.

- 25 -
NET455: Wireless Sensor Networks 201922 - 2020 Spring Semester

Then

- 26 -
NET455: Wireless Sensor Networks 201922 - 2020 Spring Semester

5. Discussion
Challenges

We had different challenges while working on this project. The main challenge was the
availability of hardware components. Since we were told to work on an online platform,
but we had to design it with the hardware components to show the exact
implementation in the ground. Meanwhile, we have got some equipment at least some
part of the project to display on the group. Based on the idea we tried to implement a
partial part of the project. We implemented two ways of the road instead of four ways of
the road. In addition to that, we had only one motion sensor; however, at least we
needed two to implement the partial part of the project. We have solved this problem by
using one motion sensor (PIR sensor) and one ultrasonic sensor since both of them
detect motion. With the limitation that we had, we tried to find a way to implement the
needed requirement on the group as well as in the software platform.

The second challenge that we had was getting familiarized with the simulation software.
Since we used the Tinkercad website for simulation, we have no idea how it works. As a
result, it took us some time to get familiarized with it. Even it was new to us, by taking
tutorials we are able to understand how it works. Moreover, we had a tight schedule to
meet and work together since most of us had senior projects and exams going on. We
also had a limited understanding of the wireless sensor networks, and we used the
project to enlarge our understanding of wireless networks. The last challenge that we
had while working on the project was the current situation of COVID-19. Even when we
got free time, it is not safe to gather up and discuss in a table about the project. Due to
the social distancing policy, we tried to gather up by wearing face masks as well as hand
gloves. In addition to that we created a skype group and when we what to discuss, we
use the platform and it worked perfect. Finally, we are able to overcome the challenges
that we faced us, and by getting important lessons from it we are able to finalize the
project according to the plan that we had.

- 27 -
NET455: Wireless Sensor Networks 201922 - 2020 Spring Semester

Recommendation

From the experience that we have got while working on this project, we recommended
to do all the needed work on the software platforms first and accordingly do the
implementation in hardware after. The reason is that starting to work with hardware
components can lead to hardware failure if we do any mistakes while working on it. As
a result, our work will be costly in terms of time and finances. However, if we are
working on software platforms if there is a problem that could be on the circuits or on
the program, there is nothing to lose, it only required to make an adjustment to it.
Finally, it’s a good practice to work in software platforms before implementing in
hardware as it saves us from damaging hardware components and losing time.

Lessons learned

From this project, we have learned many lessons, to mention some of them:

◼ We learned how motion sensors work


◼ We learned how to ultrasonic sensor works
◼ We learned how traffic light algorithm works
◼ Got better understanding on Wireless Sensor Network (WSN)
◼ Software simulation of Wireless Sensors Networks
◼ Creating Circuits using the Arduino Uno

Since we implement the project in the software platform and hardware, we are able to
learn the actual hardware components as well as the software platforms. Moreover,
while working on this project we are able to develop our learned problem-solving skills,
communication skills, and teamwork skills.

- 28 -
NET455: Wireless Sensor Networks 201922 - 2020 Spring Semester

Conclusion and future work

The project gave us a concrete understanding of the overall lectures of the Wireless
Sensor Network. We are able to summaries all the concepts in class that we have taught
and able to implement them in our final project. In the future, we want to publish this
project and also, we want to prepare its full simulation in practical to show the world.
We believe that our idea can benefit society who lost platy of time on traffic lights in
significant situations. As long as we got the chance and platform, we (as a group) are
ready to work on it to make it happen in the real world. Finally, we enjoyed working on
this project and it helped us to understand the main objective of the course.

- 29 -
NET455: Wireless Sensor Networks 201922 - 2020 Spring Semester

Reference:
Bazzan, A. L. C. and Klügl, F. (2007). Sistemas inteligentes de transporte e tráfego:
umaabordagem de tecnologia da informação. In Kowaltowski, T. and Breitman, K.
K.,editors,Anais das Jornadas de Atualização em Informática, chapter 8. SBC.

Chen, Bokui & Wang, David Z.W. & Gao, Yachun & Zhang, Kai & Miao, Lixin & Wang,
Binghong. (2016). Effects of traffic lights for Manhattan-like urban traffic network in
intelligent transportation systems. Transportmetrica B: Transport Dynamics. 1-13.
10.1080/21680566.2016.1216810.

Dubai Traffic Report: Tomtom Traffic Index. Retrieved from


https://www.tomtom.com/en_gb/traffic-index/dubai-traffic/

Errea-Moreno , J., & Díaz-Álvarez, A. (2018). Implementation and Evaluation of a Traffic


Light Assistance System Based on V2I Communication in a Simulation Framework.
Journal of Advanced Transporttation, 2018. Retrieved from
https://www.hindawi.com/journals/jat/2018/3785957/

https://www.maxbotix.com/articles/how-ultrasonic-sensors-work.htm

https://www.seeedstudio.com/blog/2019/08/03/pir-sensor-introduction-and-how-pir-motion-
sensor-works-with-arduino-and-raspberry-pi/

- 30 -

You might also like