Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Thesis
Smart City Intelligence Safety Systems on Road
Supervised by
Dr. Aravind CV
November 2015
THESIS DECLARATION
DECLARATION
I declare that this B.Eng (Hons) Electrical and Electronic Engineering final year
project thesis entitled Smart City Intelligence Safety Systems on Road is my
own work except as cited in the references. This thesis has not been accepted
for any degree and is not concurrently submitted in candidature of any degree.
Signature
: _____________________________
Thesis Author
Date
: 18/11/2015
ii
ABSTRACT
Smart transportation in a futuristic safety in traffic is a key hold towards building
sustainability towards the smart city concept. The priority in such a system is the collision
avoidance and the vehicle involved within a space need to communicate to each other via
wirelessly. Collision avoidance in vehicle control and safety measure in order to prevent the
user from experiencing any type of collision, e.g. front to front, front to back or side to side
collision. For most cases it is due to the user inability to predict accurately in the areas that
involve uncertainty while the vehicle is still in use. Based on the research, statistics shows that
why accidents happen on the road is because vehicle tend to collide with another due to the
blind spot in which the driver have very limited vision of overviewing their parameter. The
second factor through collision with a random object caused due to human error. Besides that,
the collision is due to the proximity and rear impact through sudden variations in the driving
mode conditions. The purpose of this research is to identify the framework of collision in urban
transportations, simulate the environment and apply the intelligence technique from natureinspired metaheuristic algorithm and implement the proposed algorithm to the developed
framework to investigate the safety concerns, a feature that is core of next generation smart
city. The outcome of the reseach project shows that the original bats algorithm with one sensor
is sufficient enough to act as an avoidance system but because of the limited view point the
movement or next positioning move is not efficient enough, however, modification that was
made from the original mobile unit shows the performances have significantly improved. The
modification contribute the system to generate a more optimize solution for the unit to position
itself without hitting any obstacle around it. In order to fulfill the objectives, the BA optimizes
which was implemented in the modified model can function as a safety system for a 4-wheel
vehicle.
Keywords: safety, collision avoidance, vehicle control, metaheuristic algorithm, nature, smart
transportation.
iii
Table of Contents
ABSTRACT ................................................................................................................ iii
LIST OF TABLES ...................................................................................................... vi
LIST OF FIGURES ...................................................................................................vii
LIST OF ABREVIATIONS ....................................................................................... ix
CHAPTER 1 INTRODUCTION .............................................................................. 1
1.1 Introduction ..................................................................................................... 1
1.2
1.3
Objective ......................................................................................................... 3
1.4
1.5
Contribution of Thesis..................................................................................... 4
1.6
2.2.1
2.3
2.3.1
Optimization ............................................................................................ 9
2.3.2
2.3.3
2.3.4
2.3.5
2.3.6
2.3.7
2.4
Summary ....................................................................................................... 17
3.1.2
3.1.3
3.1.4
3.1.5
3.2
3.3
Vehicle ..................................................................................................................... 26
3.4
iv
3.5
3.6
3.7
Designing the Electrical System for the Modified Prototype Model ............ 31
3.8
Model ...................................................................................................................... 33
4.2.1
4.2.2
4.2.3
Comparison Evaluation between the Original Prototype Model and
Optimize Prototype Model ................................................................................... 37
4.2.4
Parameter Analysis between the Original Prototype Model and Optimize
Prototype Model................................................................................................... 38
4.3
Setting the Optimal Range Value for the Priority Constraints ...................... 39
4.3.1 Optimize Range Value for the Modified Prototype Model ........................ 40
4.4
Summary ....................................................................................................... 44
LIST OF TABLES
Table
Page
2.1
2.2
2.3
10
2.4
12
2.5
18
3.1
Technical Complexity
19
3.2
Business Complexity
20
3.3
Project Timeframe
21
3.4
22
3.5
22
3.6
31
4.1
36
4.2
37
4.3
38
vi
LIST OF FIGURES
Figure
1.1
Page
The Total Number of Accident in Malaysia from year 2007 to
2013
1.2
2.1
11
2.2
First figure
13
2.3
13
2.4
14
2.5
15
2.6
17
3.1
20
3.2
PDCA Diagram
23
3.3
Workflow Process
25
3.4
26
3.5
27
3.6
3D Prototype Model
27
3.7
Priority Constraints
29
3.8
29
3.9
30
3.10
31
3.11
32
4.1
33
4.2
34
4.3
34
4.4
35
4.5
37
4.6
38
4.7
39
4.8
40
4.9
40
4.10
41
vii
Figure
Page
4.11
41
4.12
42
4.13
42
4.14
42
4.15
42
4.16
43
4.17
43
viii
LIST OF ABREVIATIONS
CAD
Computer Aid-Design
OBA
BA
Bats Algorithm
ABS
ETC
VCPs
IVCAWS
DSRC
FCAT
ACO
PSO
HS
Harmony Search
PDCA
EVA
PV
Planned Value
EV
Estimate Value
AC
Actual Cost
BAC
Budget at Completion
CV
Cost Variance
CPI
SV
Schedule Variance
SPI
EAC
Estimation at Completion
ETC
Estimation to Completion
VAC
Variance at Completion
CQI
NPD
MPD
FPD
US
Ultrasonic Sensor
ix
CHAPTER 1 INTRODUCTION
1.1 Introduction
Cities and communities around the globe are facing intractable issues such as massive
growth in population and it is predicted that an increase of 75% of growth by 2050 [1], and
increase of greenhouse-gas emissions will definitely contribute to the deprecation in our
comfort of living. In the recent years, a mixture of different industry has joined forces in
creating in a worldwide Smart City movement [2]. The increment of high demand for
intelligence and sustainable environment has struck us as a contributor to move towards a
higher positive impact living [1]. Majority of the researcher believe by adapting the Smart City
concept can lead us to achieving such goals. The conceptualization of Smart City varies from
people to people, city-to-city and country-to-country, depending on development level of the
nation and its willingness for change [4]. But in general, Smart City is defined as developed
urban area that uses digital technology and information to communicate in order to enhance the
quality and performance of its citizens and economy, to reduce the cost of operation and to
manage resource consumption effectively [3]. Smart City covers in the areas of public service,
building, mobility, energy and water system. In which, each of the area contribute to the
sustainability of the city towards making it more efficient and cheaper place to live in.
2008
2009
2010
2011
2012
2013
Figure 1.1: The Total Number of Accident in Malaysia from year 2007 to 2013
In spite of the advancement in the road system, accident still happened among the car
driver in the world. From 2007 to 2013, the report shows reaching about 500,000 cases of
accident still happening in Malaysia alone [5] as shown in the Figure 1.1.Based on Malaysian
Automotive Association (MAA) statistic data, the growth of car sales is higher than the
countrys population growth of about 1.5% every year and the road expansion will be difficult
to keep up with the growth of cars. Malaysia has the highest number of new registered vehicles
in the world with more than 680,000 new vehicles each year. 88% of the populations are
dependent on private vehicles and 12% on public transport.
Private vehicles become an important transport mode and traffic jams have become a thorn in
urban living. The heavy traffic jams are costing the nation a huge price in terms of our safety,
mobility and productivity [6].
Recent trend shows that collision avoidance system is one of the major areas of study
in vehicle control and safety measure in order to prevent the user from experiencing any type
of injuries. For most cases, accident happens due to the user inability to predict accurately in
the areas that involve uncertainty. Research suggests that, the main reason why accidents
happen on the road is between two vehicles colliding with another. The second factor is when
the vehicle hitting a random object. Follow by side impact, rear impact and so on. All of these
cases have a common ground to it, in which the user of the vehicle has the tendency to collide
with another object while in motion [5]. The percentage of categories accident can be seen on
the graph below.
Percentage %
29
Hitting
Object
24
Hitting
Pedestrian
2
Multiple
Event
10
Rear
Impact
14
Rollover
4
Side
Impact
14
The research work focuses on optimizing the algorithm techniques. In this paper, shows
various methods which was implemented in the mobile unit system to prevent any such
collision from happening, either with one moving object to another moving object or a moving
object with a stationary object. The challenge is to tackle by adapting a nature-inspired
algorithm and place it into the collision avoidance system in the electronic design of the vehicle
for safety improvement.
Recent advancement such as Google Car and Tesla Car Model has make driving effortless but
it is expensive to build, purchase and mostly not available to the general public. However, by
improving or modifying the conventional safety feature may be the solution to saving more life
in a wider scale with a cheaper expense.So, in order to achieve such objective, an optimize
version of a Nature-inspired Metaheuristic algorithms is purposed. It is to be implemented or
adapt into the safety system, which uses ultrasonic sensors. The aim, when the vehicle is
presented with one or more obstacle within its parameters, it could be either be stationary on in
dynamic motion, the vehicle need to avoid it at all cost when come to near impact
autonomously.
1.3 Objective
The objectives of this project are as follows:
To design an algorithm which emphasis on finding the most efficient path which
avoiding any obstacle.
The Scope of the project focuses on optimizing the nature-inspired algorithm techniques in
collision avoidance. The research is limited to the condition to change the variation of the
vehicle velocity and turning frequency upon determine the next best positioning state. The
fabrication of the design model and the algorithm analysis is limited to using Solidworks,
Ardunio IDE 1.6.5, Fritzing Beta 0.9.2, microcontroller from Ardurnio and Ardurnio
compabitible hardware. Solidworks acts as a CAD tool and is used to design the structure and
mechanics of the vehicle. Ardunio IDE 1.6.5 is used as the codding platform to structure and
built the algorithm and transfer it into the microcontroller. Fritzing Beta 0.9.2 is a 3D design
hardware module to design and test the electrical system. The integrated Ardurnio hardware is
to fabricate the prototype model and it is used to gather data for analyzing the performance of
the algorithm with various testing condition.
Descriptions
Limitations
Ref.
[8,9,10]
Electronic
Traction
Control
Pre-Crash
Sensing
Lane
Departure
Warning
Tracking
System
Descriptions
Limitation
The
pre-crash
sensing systems have
the
tendency to
generate false alarm
which may lead to
unnecessary action
towards the vehicle if
the
external
electronic hardware
is spoil or uncheck.
Since the system rely
on
visual
information, if the
visual of the lane line
is distorted or fade
off, the system is
completely unable to
function.
Ref.
[9,11,12]
[9,13,14]
[9,14]
[9, 20]
2.2.1
Descriptions
Limitation
Ref.
[17, 18,19]
However, the research focuses on method or approach that can prevent any such
collision from happening. The following Table 2.2 described and compared the collision
avoidance approach method that is used in transportation vehicle on air, land and sea.
Table 2.2: Comparison on Methods of Collision Avoidance
Method
Vehicle Cyber
Physical System
(VCPs)
In-Wheel
Collision
Avoidance
Warning System
(IVCAWS)
Description
Predict
the
collision
by
determine
the
vehicle motion
behavior,
its
location, driver
behavior
and
road geometry.
Drawbacks
The system reflects on
the drivers behavior and
pattern, and the road
geometry that to certain
extends it is inconsistent
and would be more
difficult for the system to
predict and assess the risk
later on.
Author
Chaozhong
Wu
Liqun Peng
Zhen Huang
Ming Zhong
Daunfeng
Chu
A
warning
system
which
aids the driver in
preventing any
such collision
when the vehicle
is on the road.
Ref.
[21]
[23]
Description
Drawbacks
Dedicated shortrange
Communication
(DSRC)
By analyzing the
timing of the event,
the system can
predict the situation
and communicate
with
another
vehicle in order to
prevent
the
collision.
A hybrid model
that follows the
behavioral
characteristics of an
Ant and a Bat.
When
comes
to
application,
the
implementation
of
Ants algorithm in to
the vehicle or the
moving object cannot
react properly or
expectedly
when
there is a sudden
object in front of it.
Forward Collision
Avoidance
Technology
(FCAT)
In-Wheel
Collision
Avoidance
Warning System
(IVCAWS)
A warning system
which aids the
driver in preventing
any such collision
when the vehicle is
on the road or near
to impact to any
object.
Author
Quazi
Delwar
Hossain
Mohammad
Naim Uddin
Md.
Mahmudul
Hasan
Ref.
[24]
[22]
[23]
2.3.1
Optimization
Optimization can be done in various areas of life such as businesses, design and systems
flow. For most cases, it can be done through a theoretical mathematics equation [30], which are
as follows;
Minimize ( ):
(), ( = 1, 2, 3, , )
(2.1)
Subject to:
(), ( = 1, 2, 3, , )
(2.2)
() 0, ( = 1, 2, 3, , )
(2.3)
Where,
= (1 , 2 , 3 , , )T
(2.4)
Where, (), () and ()are defines as the design vector. While, function as a decision
component. It can be either be real continuous, discrete or combine. For further elaboration, the
objective function and value of () is called the solution space. Where, Rn is the search space
within the search variables. The constraints are defined by the equalities, and inequalities,
. For maximization of the inequalities it can be written as gk>0.For cases that do not required
any objective is a feasibility problem because any solution is to be consider as an optimal
solution.
Optimization problems can be seen in two areas, single objective (M=1) or multiobjective M>1.
For most cases, optimization only occurs for multi objective purposed. The reason for
optimization is to achieve or gain certain level of efficiency to make output or solution more
ideally depending on the scenario or system objective [36].
2.3.2
be done by testing it a randomize situation or a fixed case condition. It is done by repeating the
experiment and adjusts accordingly until a desirable solution is obtained. In order for a set of
algorithm to be tested it can be put in either a determistic algorithm or stochastic algorithm
category.
9
For a determistic algorithm, it is put in a condition that is fix and will be tested repeatedly.
Whereas, for a stochastic algorithm it is done by putting randomize variable. The reason for
both categories is to create a constant condition so that an optimal solution can be reach for the
algorithm purpose [36].
2.3.3
different social status, the queen (reproductive females), male and female workers
(nonproductive females) [25]. Whereby each type have their own role in building up their
colony. The queen sustains the continuation of the species while the worker ants hunt or search
for food.
The ants communicate by leaving pheromone on the tracks that it takes in order for it
to check it direction and also as indicator for other ants. When searching for food, ants move in
random direction and when another ant detects its pheromone and the probability for it to follow
that trail is higher. As more ants choose the same path that the first ant took in search for food,
the more ants are attracted to the same path. As a result, the ants follow the tracks that lead
them to the shortest distance from the base to the food and back. This will continue until the
pheromone that is on the track dies off. The following figures describe on how the ants behaves
when choosing the best route out of pure randomness motion [25].
Table 2.3: Ant Movement Behavior [25]
Movement
Ants move in
a straight line
Movement Behavior
Direction
c
Ants
Ants move in
random
Ant choose
the best route
of cause
10
end while
Figure 2.1: Ant System Algorithms [23]
The ant system follows the following rule [22]:
={
h allowed k(t,I)
(2.5)
Where, is the probability of ant k choosing the path from ( , ) to Vi. The parameters of and
are the pheromone and heuristic information that is assigned to the edge of ( , ) and are
constants to determine the relative influence of pheromone and heuristic information. Lastly,
the allowed (, ) is the set of vertices which to be permit accordingly to the problem
constraints.
And then, the ant k moves and deposited the pheromone on the track, which is defined as
follow:
= {
0,
(2.6)
Where, Q is the positive constant and Lk is the cost of path used by ant k.
11
Finally, when all the ant m has completed their path finding, the pheromone is updated based
on the following formula:
(1 ) +
=1 =>
(2.7)
Where, the evaporation factor (0 < < 1) caused the early pheromone to vanish over number of
iterations. Therefore, the new corresponding pheromone becomes better thus eliminating the
initial undesired solution.
2.3.4
PSO was inspired by the group behavior of birds, fish and insects. The capability of
PSO based logic is to search for the most optimal solutions when comes to multivariable
problem. For PSO, each particle keep track of its track of its coordinate in order to come out
with the best solution [28]. Each particles position is a potential solution to the problem. Each
particles velocity is modified based on its distance from its personal best position and the
global best position. In other words the particles move according to their experience and that
of their neighbors that yields the best fitness value [29].
Table 2.4: Particle Swarm Optimization Variant [29]
Variant
Velocity Clamping
Function
Reducing the size
step so that the
particle will remain
within the area.
Advantages
Reducing the step
size velocity so it
can control the
movement of the
particle.
Disadvantages
If all the velocity
becomes equal the
particle will continue
to conduct it search
and
will
not
convergence
the
whole area.
Construction
Coefficient
The
weight
is
control
by
the
momentum of the
previous velocity.
Synchronous and
Asynchronous
Updates
To
secure
the Comparable with the More sophisticated
stability of the inertia weight.
finite
element
convergence for the
formulations.
PSO algorithm
Synchronous and
Asynchronous
Updates
Optimize
parallel Enhance the rate of Sophisticate
finite
processing.
convergence.
formula and higher
densities.
12
2.3.5
Harmony search was adapted from the improvisation process of creating harmonic
sounds. The process works by recognizing the best harmonic song and adapt it to the new
sound harmony memory. This is because in Genetic Algorithm memory is important. As a
result, these ensure the best harmonic sound is constantly updated. The algorithm work by
comparing the selected solution and compare it to the worst solution and determine to either
put in the memory as the new best harmonic memory or to eliminate it. Figure 2.2 and Figure
2.3, shows the basic HS algorithm.
Solution
Improvisation
Random
Solution
Selection
Evaluation
Harmony
Memory
Worst
Solution
Comparison
Better
Fitness
No
Elimination
Yes
Replacement
When comes to using the algorithm effectively, three major components is needed to be
consider, which are harmony memory accepting, pitch adjustment and randomization.
13
The harmony memory accepting ranging from the value of 0 to 1, where, the value moving
towards 0 has lesser-selected harmonies and producing slower coverage. Whereas, the value
that is moving towards 1 uses more and more selected harmonic memory, which may lead to
certain memory not being explore resulting in producing the wrong solution. Therefore, the
accepted range should be from 0.7 to 0.95. For the pitch adjustment, it is determine by the pitch
bandwidth and pitch adjustment rate. These influence the existing solution in the harmonic
memory. Finally, the randomization act to increases the possibilities of the solution. This can
be further explore the possibilities of a new improve solution by comparing it to the updated
solution [30 -32].
2.3.6
Bee Algorithm
Bee portray a complex characteristic behavior when comes to mating, breeding and
foraging. In which all of the behavior is crucial to sustain the bee colony from dying [33].
Figure 2.4 shows the practical bee algorithm.
Start
Evaluate Fitness
Select Elite
bees from
scout bees(e)
Random
assign scout
bees(r)
Select Best
bees from
scout bees(b)
Convergence?
Yes
End
14
In the PSO procedure the elite and best bees is selected. Finally, the best is put at the updated
parameter and check if the best fit to function accordingly [35].
2.3.7
of microbats. The bats echolocation is mostly used to determine its pin point location to the
point of its surrounding such as rocks, wall or other bats. Furthermore, it is also used to
differentiate between foods or objects and also to direct its movement accordingly without
colliding with the other bats. The microbats move in such randomness with velocity, at position,
with a fixed frequency, and by varying its wavelength, and loudness [37], it can determine the
potential danger that is about to happen or how it located its preys. The following Figure 2.5
shows the original bats algorithm.
Start
End
Convergence?
Yes
Bats Movement
The movement of the bats is define by certain type of rules where the positions and
velocity, in the d-dimensional search space is consider as the influencer on how does the bats
move. In order for the bats to create a path for them to move efficiently, the next action steps
needed to be constantly updated so that the next move will be better that the previous one.
15
From the equation that was developed by X.Yang [30, 31], showcase how to determine the
new location point based on the previous decision where the position, and velocity, is obtain
at any given time;
= + ( min)
(2.8)
= 1 + ( )
(2.9)
= 1 +
(2.10)
Where [0.1] is categories as the random vector that is drawn from a uniform distribution.
Furthermore, is defined as the current best location after comparing the solution with all the
other bats.
For the local search part, it is generated based on the current best solution and the new solution
is generated locally using random walk.
= +
(2.11)
Where [-1, 1] is taken randomly and = < > is determine by the average loudness of all
the bats at that time.
(2.12)
+1 = 10 exp()
(2.13)
16
2.4 Summary
These algorithms are capable of creating a sufficient system that can prevent any
collision among objects based on its algorithmic behavior. However, for a moving object
(dynamic obstacle) is far more tedious comparing to avoiding a static object. This is because
for a dynamic object the speed and position varies within time, thus, the ideal logic required to
compensate with these condition. Therefore, the literature review is mainly to compare other
natural-inspired algorithm and evaluate which is the most suited logic when comes to
application in the vehicle system for collision avoidance. Table 2.5 shows a summarization of
the application and the limitation of each of the nature-inspired algorithm.
17
Main Application
Limitations
Particle Swarm
Optimization (PSO)
Evaluation and
comparing process.
Each of the algorithms function differently, however, OBA shows the most applicable
when comes obstacle avoidance for a vehicle system. The OBA is mainly influence by the
velocity of the bat and frequency differences. The relations between the factors that influence
the variables of the bats positioning behavior can be used in the vehicle operation. The velocity
state the motion speed of the vehicle while at move, where frequency state the intensity rate of
the sensors of the vehicle. With comparison with other logic such ACO is inapplicable since it
is applied to find the best route of cause and not for avoiding purposes. For HS and BA aims to
find the best new solution from the previous solution or condition which can only be useful if
the variable is gradually change but for a vehicle collision avoidance application that would not
be possible since the tendency for the vehicle to change the surrounding is high. PSO
application is to control multivariable condition and operate accordingly with the changes of
the environment. This algorithm would be the most ideal if and only if the other units or vehicle
carried the same logic. Therefore, OBA is most suited since it emphasis on the best positioning
approach for at move or in standby condition.
18
3.1.1
Initiation Stage
The initiation stage focuses on the necessity and the limitation of the project by applying the
complexity assessment. From here, it determine if the project is leaning more towards the
technicality or business side. The rating is ranging from 0 to 4, where 0 being the lowest and 4
being the highest complexity. In Table 3.1 and Table 3.2 shows the assessment for technical
and business complexity.
Table 3.1: Technical Complexity
Attributes
Rating
Justification
The programming code can be easily excess from
other related project.
Availability Recourse
Knowledge
Skills
New Technology
Scope
1+4+3+2+3
5
= 2.6
19
Rating
Justification
1
The cost of developing the model was inexpensive
since Taylors University have provided with
mostly with all the components needed.
Market
Time Scale
Geography
1+3+4+2+1
5
= 2.2
Based on Table 3.1 and 3.2 complexity assessment for technical and business complexity, it
shows that the project complexity is more leaning technical side. . This is further shown in
Figure 3.1 below. This will state that the success of the project will be determine by overcoming
the complexity level of the fabricating and designing the final product.
High
Technical Environment
4
I
II
I.
II.
III.
IV.
Low
III
IV
High
Business Environment
3.1.2
Planning Stage
The planning stage focuses on listing out all the activities which needed to be execute and estimation time for each of the activities and overall project duration.
This can be done by creating a timeframe as be seen in Table 3.3.
Task Description
Semester 1
Week
1 2 3 4
10
12
13
14
Semester 2
Week
1 2 3 4
10
12
13
14
Project Selection
Find an Objective
Literature Review
Initial Proposal
Creating a simulation environment
Analyzing the results
Project Interim Report
Engineering Fair 1 (Tier 1)
eureca Conference
Adjusting the CAD design to fit the
requirement
Fabricate the CAD model
Implement and Test the logic
control
Analyzing the results
Modification adjustment
Dissemination of research findings
Final Year Thesis
Engineering Fair 2 (Tier 2)
eureca Conference
Table 3.3: Project Timeframe
21
3.1.3
Execution Stage
The continuation process of the project will based at this stage. In order for the project to grow
continuously until the end point, the author of the project keep track of the project performance
by recording it in the weekly logbook. This is to promote a constant progression of the project
at which to minimize the delay time between executing one task to the next until to the point of
completion.
3.1.4
The next stage of the project is to monitor and control the project performance. The reason for
doing so, the progress of the project may be effected by the external factor such as shortage in
monetary resource or hardware malfunction. This external influence can greatly affect the
health level of the project. However, this can be counter by measuring the Earned Value
Analysis (EVA). This tool is used to measure the aforementioned degree affected for the
project. Table 3.4 shows the application EVA.
Estimation (RM)
200
Actual (RM)
217
14
50
55
Ardurnio Uno
90
110
Ardurnio Mega
160
157
Chassis
200
150
Others
50
60
Total
764
677
Formula
N/A
Amount (RM)
764
N/A
700
N/A
667
N/A
764
EV AC
33
EV/AC
1.049
22
Formula
EV-PV
Amount (RM)
-64
EV/PV
0.92
BAC/CPI
728.30
EAC-AC
61.31
BAC-EAC
35.7
3.1.5
Closing Stage
The last stage of the project focus on the Continues Quality Improvement (CQI). At this stage,
the project is to be ensure that it will not here and continue improve over time. There are 4
phase that are in involve in the CQI process, plan, do, check, and act. Each of the phase
represent a process for future development as can be seen in Figure 3.2.
Plan
Do
Designing the
logic related
application
Constructing the
Algorithm
Act
Check
Optimizing
the Algorithm
Simulation
Analysis
The application of CQI is perform by checking the condition and requirement of the application.
Follow by constructing the logic for the system. Then, the algorithm is test out and the necessary
data is collected. Finally, improvement should be made in order to gain the optimize
performance for the application.
23
24
Phase 2
Modelling and
Analysis
Using simulink
express
Phase 4
Implementation
and Evaluations
Phase 3
Algorithm
Development and
Deployment
Phase 2
Modelling and
Analysis
Stationary
Obstacle
Stationary Object
Approaching
Obstacle
Receding
Obstacle
26
Ultrasonic Sensors
To further illustrate the 3D CAD model, Figure 3.6 shows the design from different angel of
view point.
27
28
Alert Level
Back Front
NPD
FPD
MPD
NPD
MPD
FPD
0
Distance, cm
(b) Priority Level Chart
No
Yes
Furthest
Point of
Distance
Command
No
Yes
Mid
Point of
Distance
Command
End
No
Nearest
Point of
Distance
Yes
Command
29
Thus, the settings of the condition need to tolerate such condition. At here, the speed of the
mobile unit need to be reduce by 40% of the original speed and the turning angle needed to be
increase by 50% from the mid angle turning. At MPD, the speed is only reduce at 20% and
there is no change for the turning angle. Lastly, at FPD, the speed is at 100% and there is no
turning required.
Scanning the
Parameters
Ultrasonic
Sensor
No
Back Front
No
True
True
Yes
Yes
Nearest Point
of Distance
Mid Point of
Distance
Command
Command
True
Yes
Furthest Point
of Distance
Command
End
Figure 3.9 (b) shows on the construction of the algorithm for the modified prototype model. It
behave similar to the original algorithm, however, based on the modified model the logic need
to integrate with 6 different ultrasonic sensors at different position. This is done by setting case
condition for each action command depending at which area does the obstacle are put at. The
aim for the modification is for the mobile unit to gain wider range of view throughout its
parameters before generating the next best solution for the next position. As a results, it can
provide a more optimize positioning movement.
30
3.7 Designing the Electrical System for the Modified Prototype Model
The following Figure 3.10 shows an electrical system that aims to integrate between six
different ultrasonic sensors. Based on the position of the ultrasonic sensor and the range value
that it can provides, the electrical system need to function as such it can control the movement
of the motor from the data obtain from scanning the parameters.
Ultrasonic
Sensor 1
Ultrasonic
Sensor 4
Ultrasonic
Sensor 2
Ultrasonic
Sensor 5
Ultrasonic
Sensor 3
Ultrasonic
Sensor 6
Ardunio Mega
and Motor Shield
DC
Motor 1
Switch
DC
Motor 2
Power Supply
In the electrical system design the echo and trig pin for the ultrasonic is combined due to the
lack of specific pin to operate the sensors. However, this modification will not affect the
performance of the sensors. The following Table 3.6 shows the Input/Ouput for the electrical
component with the Ardurnio Mega pin.
Table 3.6: Input/Output Pin Arrangement
Component
Ultrasonic Sensor 1
Ultrasonic Sensor 2
45
Ultrasonic Sensor 3
44
Ultrasonic Sensor 4
42
Ultrasonic Sensor 5
32
Ultrasonic Sensor 6
22
31
Batttery
Vin, Gnd
Motor 1
M3
Motor 2
M4
(a) 2 Obstacles
(a) 4 Obstacles
(c) 8 Obstacles
The objective of the experiment is to determine which is the most effective design when comes
to avoiding any collision. For each of the environment setting the number of obstacle increase
in order to evaluate the performance when the difficulty level of the environment increase. The
experiment was conducted using two case model, the first model was done using the original
prototype model which only have one ultrasonic sensor and for the second case model was done
using the modified prototype model. The result of the experiment is shown in Chapter 4, where
the evaluation of the behavior is presented and analyze.
32
4.2 Comparison of the Original Prototype Model and Optimize Prototype Model
4.2.1
Figure 4.1 shows the overview of the original prototype model before any modification was
made on it. The mobile unit consists of one ultrasonic sensor, 7.6V battery, L293D motor driver,
two motor and an Ardunio Uno.
Ultrasonic
Sensor
33
L293D motor
driver
DC
Motor 1
Ardurnio
Uno
DC
Motor 2
Switch
34
4.2.2
Figure 4.2 and Figure 4.3 shows the top view of the modification prototype model. The model
consist of six ultrasonic sensors, an Ardunio Mega, DK electronic motor shield, 7.4 battery and
a switch
Ardurnio
Mega
Switch
US 4
Motor Shield
US 3
US 2
US 1
US 5
US 6
The modification of the original prototype model was done by microcontroller from Ardurnio
Uno to Ardurnio Mega in order to increase the number of pin available for the sensors. Besides
that, the number of ultrasonic used was increase from one to six sensors so that the mobile unit
can gain a wider range of parameter scanning. Finally, the L293D was changed to DK
electronics shield in order to gain a certain level of stability in the current flow within the
electrical system. This is because, by increasing the number of ultrasonic sensor the power
consumption may fluctuated since the sensors operate in a manner of sequence.
In Figure 4.4 shows the view point angle point from the top, bottom, right and left side of the
modified prototype mobile unit model.
35
Ultrasonic Sensors
(a) Front Side View
DC Motor 2
DC Motor 1
36
4.2.3
Table 4.1: Comparison Evaluation between the Original Prototype Model and Optimize
Prototype Model
Model
Original
Prototype
Model
Optimize
Prototype
Model
Number
of Sensor
1
Advantages
The model shows it required
very little power to operate
and the battery can last longer
compared to the optimize
model. Besides that, it can
generate a fast response rate
because it only equip with 1
ultrasonic sensor, which
doesnt required a delay
function in the program.
Drawback
The limitation of the original
prototype model shows at when
it is scanning the parameter in
order to move to avoidance the
obstacle. This is because the
model consist only 1 sensor,
which limit it scanning
capability to the other blind
sides of the model. Thus, the
tendency to collide with an
obstacle is higher.
Improvement
The model can be improve by reducing the side of its body and to provide at least
one sensor for each of the sides in order to extract more data from it parameters
before proceeding with the movement command.
Optimize
Prototype
Model
In order for the model to function properly it required a higher voltage power
battery so that the microcontroller would be interrupt by power shortage while in
motion.
37
4.2.4
Front
Side
Ultrasonic
Sensor
Back Front
Middle
Back
Side
In Figure 4.6, the model shows that it is able to detect more than one object before proceeding
with the command function.
Front
Side
Ultrasonic
Sensor
Back Front
Middle
Back
Side
38
This creates a lower tendency rate for the model to collide with any of the object because of the
model capability to detect more than one object at a time. As a result, a better positioning
solution can be generated from the data gain from the ultrasonic sensors
Table 4.3: Comparison Evaluation on the Parameter Scanning between the Original
Prototype Model and Optimize Prototype Model
Analyzing
Original Prototype Model
Scanning the The model shows that it can only detect
one object in front of it at a time and
Parameter
complete oblivious to the other obstacle
that surrounds it on the right, left and back
sides of the model.
Performance The optimize prototype model shows higher performance rate compare to the
original prototype model when comes detecting objects that surrounds the
models. However, both of the models show limitation when the objects is not
within the range of the sensor, Thus, creating blind spots for the models.
4.3 Setting the Optimal Range Value for the Priority Constraints
Figure 4.8 shows the range setting for the original prototype model.
Ultrasonic
Sensor
10 cm
30cm
60cm
Back Front
Back Front
90 cm
NPD
MPD
FPD
NPD
MPD
FPD
Figure 4.7: Setting the range value for the Original Prototype Model
39
The condition of the algorithm is set based on three different areas, FPD, MPD and NPD. The
areas are categories with set of conditions where each condition is based on the priority level.
Each of the command in the logic increases or decreases based on the alert level. As the alert
level increases so goes the intensity of action of the mobile unit. This can be done by
differentiate the speed of the unit and turning percentage of the motor to go left, right or
backward. Furthermore, constraint works as the distance of the mobile unit to the obstacle
increases, the alert level decrease. This concept is to promote an optimize solution for
positioning the mobile unit while in the moving stage. Figure 6 shows the different alert level
depending on the distance between the mobile unit and the object.
For the original prototype model, the maximum range value at the NPD is 10 cm, for MPD is
40 cm and for the FPD is as more than 40 cm. The constraints is to help develop the algorithm
behavior on the intensity level of the motion. If an obstacle suddenly appeared at NPD, the
mobile unit need to response quickly in order to avoid the obstacle. However, for the FPD, the
obstacle is still at far so alert level should be low since the danger is low because of delay time
between the unit and the obstacle is high.
Ultrasonic
Sensor
Back Front
NPD
MPD
FPD
40
Range Value, cm
From the data gain in Figure 4.9, the range value is tabulated.
Range Value for Point of Distance
35
30
25
20
15
10
5
0
9
21
10
22
31
30
3
4
Ultrasonic Sensor
9
11
21
22
31
32
10
23
11
22
29
32
As can be seen in Figure 4.10, the optimum value to be set for each of the set within its area
are, NPD is 10 cm, MPD is 23 cm and FPD is 24 cm onwards. These numbers are crucial
because based on the set of range it will determine on how does the algorithm response to the
UltraSonic Range, cm
external environment.
Average Value of Ultrasonic Range
35
30
25
20
15
10
5
0
Nearest Point of
Distance
Middle Point of
Distance
Furtherst Point of
Distance
Ultrasonic Range
10
22
31
41
Figure 4.11 shows the implantation of the optimize range setting for the modified prototype
model.
Start
78 cm
Scanning the
Parameters
78 cm
12 cm
12 cm
0 cm < Range < 10cm
Ultrasonic
Sensor
10 cm
Range > 23 cm
10 cm
No
10 cm 12 cm
No
True
78 cm
Back Front
No
True
Yes
Yes
Nearest Point
of Distance
Mid Point of
Distance
Command
Command
True
Yes
100 cm
NPD
Furthest Point
of Distance
Command
MPD
FPD
End
(a) Diagram on the Modified Model with the (b) Adaptation of Bats Algorithm on the
Modified Model with the Optimize Range
Optimize Range Setting
Setting
Figure 4.11: Optimize Prototype Model with the Range Setting
To further elaborate on the logic conditions, it is set within 3 different range value. For NPD
value from the range of 0 to 10 centimeters for all the sensors, at this point the mobile unit have
the highest alert level meaning the speed is slower than normal and the turning rate is much
high. Opposite NPD, the FDP have the lowest to none alert level. At this point the mobile is to
only move forward without changing any direction.
The area between NPD and FPD is MPD, at the point the alert level is still low, however, the
velocity of the model will reduce by 20% and turning intensity is also low since the time to
reach from the current position of the mobile unit is high.
42
For Figure 4.12 the mobile unit detects an object in front it and turn left until the obstacle is no
longer detected. For Figure 4.13, the modified prototype model detected 2 objects within its
parameter, it will turn left or right depending on which area shows more clearance for it to pass
through.
For Figure 4.14, it shows that mobile unit has difficulty in moving due to the limitation of
scanning its parameter. As a result, the unit bumps into two of the obstacle. Whereas, the mobile
unit in Figure 4.15 shows no difficulty in deciding the next movement.
43
For Figure 4.16, it shows that mobile unit move with detecting any obstacle around it. As a
result, the unit bumps into most of the obstacle that surrounds it. For Figure 4.17, the mobile
unit shows a better result in passing through mostly all the obstacle around it.
4.5 Summary
The research focused on the concept of designing an algorithm and adapting to the
application that can be used as safety precaution for the user upon driving on the road
specifically towards four-wheel vehicles. The OBA with one sensor is sufficient enough to act
as an avoidance system but because of the limited view point for its external detection the
movement is not efficient enough to avoid the obstacle fully. The modification that was made
from the original mobile unit shows the performances have significantly improved. The
modification contribute the system to generate a more optimize solution for the unit to position
itself without hitting any obstacle around it. Thus, increase the performance of avoiding the
obstacle. In order to fulfill the objectives, the BA optimizes which was implemented in the
modified model can function as a safety system for 4 wheel vehicle.
44
CHAPTER 5 CONCLUSION
The research focuses on the optimization of the BA in the application of collision
avoidance. This is done by studying the characteristic and the behaviour on how the bat behave
in order to avoid any collision with the external environment such as rocks, wall or other bats.
Furthermore, it is also used to differentiate between prey and predators but mainly it is used to
direct its movement without colliding with the other bats or objects. The movement of the bats
depends on its velocity and position of the bats, and because of its ability to emit wave it can
determine the best next position. With comparison with other logic, OBA is the most suited
since it emphasis on the best positioning approach during movement or in standby condition.
For example, ACO is inapplicable to be apply as such since it is applied to find the best route
of cause and not for avoiding purposes. For HS and BA aims to find the best new solution from
the previous solution which the application would not be possible since the tendency for the
vehicle to change the surrounding is high. PSO application is to control multivariable condition
and can only operate accordingly to the changes of the environment providing the units is equip
with the same logic. Furthermore, the OBA with one sensor is sufficient enough to act as an
avoidance system but because of the limited view point the tendency for the mobile units body
to collide with an obstacle is higher. The modification that was made on the original model
contribute the system to generate a more optimize solution for the unit to position itself without
hitting any obstacle around it. Thus, increase the performance of avoiding the obstacle
For future work, it is recommend to future researcher to focus on the communication between
vehicle to vehicle upon coming to a collision state so that a more optimize solution can be
develop. However, the system need to operate in manner it can function independently or
operate with other vehicle. This is because if the vehicle is able to communicate with another
vehicle, both of the vehicle can compensate each other condition and at the same time producing
a synchronous solution. However, the vehicle also need to be able to operate independently
since the obstacle is not only with other vehicle but with other objects that may not be seen by
the driver.
45
REFERENCES
[1] Ieee.org, 'Smart Cities Community, IEEE', 2015. [Online]. Available:
https://www.ieee.org/membershipcatalog/productdetail/showProductDetailPage.html?product
=CMYSC764. [Accessed: 29- Oct- 2015].
[2]S. Huston, 'Smart City - Contemporary Frameworks and Antiquity', SSRN
Electronic Journal.
[3]V. Albino, U. Berardi and R. Dangelico, 'Smart Cities: Definitions, Dimensions,
Performance, and Initiatives', Journal of Urban Technology, vol. 22, no. 1, pp. 3-21, 2015.
[4]Smart City Guidelines, 1st ed. India: Ministry of Urban Development Government of India,
2015.
[5]T. Toroyan, M. Peden and K. Iaych, 'WHO launches second global status report on road
safety', Injury Prevention, vol. 19, no. 2, pp. 150-150, 2013.
[6] Statistics.gov.my, 'Department of Statistics Malaysia Official Portal', 2015. [Online].
Available: https://www.statistics.gov.my/index.php. [Accessed: 29- Oct- 2015].
[7]'Vehicle Safety Features Vehicle Safety Features Current and the Future Current and the
Future',
2015.
[Online].
Available:
http://ritzel.siu.edu/courses/302s/vehicle/VehicleSafetyFeatures.pdf. [Accessed: 01- Nov2015].
[8]'Mercedes-Benz | Forschung und Entwicklung in Indien', MTZ - Motortechnische
Zeitschrift, vol. 74, no. 5, pp. 357-357, 2013.
[9]Car Safety- Physics, 'Anti-lock Brakes vs Normal Brakes- Benefits and Limitations', 2015.
[Online]. Available: http://carsafetyphysics.weebly.com/anti-lock-brakes-vs-normal-brakes-benefits-and-limitations.html. [Accessed: 10- Oct- 2015].
[10]'Vehicle Safety Features Vehicle Safety Features Current and the Future Current and
the
Future',
2015.
[Online].
Available:http://ritzel.siu.edu/courses/302s/vehicle/VehicleSafetyFeatures.pdf. [Accessed: 01
Nov- 2015].
11]A. Aly, E. Zeidan, A. Hamed and F. Salem, 'An Antilock-Braking Systems (ABS) Control:
A Technical Review', ICA, vol. 02, no. 03, pp. 186-195, 2011.
[12] Brainonboard.ca, 'Brake assist - Active safety features', 2015. [Online]. Available:
http://www.brainonboard.ca/safety_features/active_safety_features_brake_assist.php#q5.
[Accessed: 10- Oct- 2015].
46
[Online].
Available:
[18] Z. HAN, 'FFT / IFFT Method for Wheel Speed Sensor Signal Processing When Car Runs
at High Speed', Journal of Mechanical Engineering, vol. 50, no. 16, p. 155, 2014.
[19] Consumerreports.org, 'Avoiding Crashes with Self-Driving Cars - Consumer
Reports',2015.[Online].Available:
http://www.consumerreports.org/cro/magazine/2014/04/the-road-to-self-drivingcars/index.htm. [Accessed: 10- Oct- 2015].
[20]] 'Hardware Evaluation of Heavy Truck Side and Rear Object Detection Systems', pp. 125.
[21] 'Internet of Car: Accident Sensing, Indication and Safety with Alert system', American
Journal of Engineering Research, vol. 02, no. 10, pp. 92-99, 2013.
[22] J. Laukkonen, 'How Does a Lane Departure Warning System Work?', About.com Autos,
2015. [Online]. Available: http://cartech.about.com/od/Safety/a/What-Are-Lane-DepartureWarning-Systems.htm. [Accessed: 10- Oct- 2015].
[23] M. Staubach, 'Factors correlated with traffic accidents as a basis for evaluating
AdvancedDriverAssistanceSystems', Accident Analysis & Prevention,vol.41,no. 5, pp. 10251033, 2009.
[24] M. Maltz and D. Shinar, 'Imperfect in-vehicle collision avoidance warning systems can
aid distracted drivers', Transportation Research Part F: Traffic Psychology and Behaviour, vol.
10, no. 4, pp. 345-357, 2007.
[25] A. Tang and A. Yip, 'Collision avoidance timing analysis of DSRC-based vehicles',
Accident Analysis & Prevention, vol. 42, no. 1, pp. 182-195, 2010.
47
[26] Q. Hossain, M. Uddin and M. Hasan, 'Collision avoidance technique using bio- mimic
feedback control', 2014 International Conference on Informatics, Electronics & Vision
(ICIEV), 2014.
[27]Intechopen.com, 'Swarm Optimization | Swarm Intelligence | InTechOpen', 2015.
[Online].Available:http://www.intechopen.com/books/swarm_intelligence_focus_on_
ant_and_particle_swarm_optimization. [Accessed: 17- March- 2015].
[28]H. Salehinejad and S. Talebi, 'Dynamic Fuzzy Logic-Ant Colony System-Based Route
Selection System', Applied Computational Intelligence and Soft Computing, vol. 2010, pp. 113, 2010.
[29]I. Fister, I. Fister, X. Yang and J. Brest, 'A comprehensive review of firefly algorithms',
Swarm and Evolutionary Computation, vol. 13, pp. 34-46, 2013.
[30]D. Palupi Rini, S. Mariyam Shamsuddin and S. Sophiyati Yuhaniz, 'Particle Swarm
Optimization: Technique, System and Challenges', International Journal of Computer
Applications, vol. 14, no. 1, pp. 19-27, 2011.
[31]J. Fourie, S. Mills and R. Green, 'Harmony filter: A robust visual tracking system using the
improved harmony search algorithm', Image and Vision Computing, vol. 28, no. 12, pp. 17021716, 2010.
[32] X. Wang, X. Gao and S. Ovaska, 'Fusion of clonal selection algorithm and harmony
search method in optimisation of fuzzy classification systems', IJBIC, vol. 1, no. 12, p. 80,
2009.
[33] Xin-She Yang 'Harmony Search as a Metaheuristic Algorithm', pp. 1-18.
[34] [1]'Artificial Bee Colony Algorithm and Its Application to Generalized Assignment
Problem', pp. 113-143.
[35]L. Lien and M. Cheng, 'A hybrid swarm intelligence based particle-bee algorithm for
construction site layout optimization', Expert Systems with Applications, vol. 39, no. 10, pp.
9642-9650, 2012.
[36]B. Yuce, M. Packianather, E. Mastrocinque, D. Pham and A. Lambiase, 'Honey Bees
Inspired Optimization Method: The Bees Algorithm', Insects, vol. 4, no. 4, pp. 646-662, 2013.
[37] X. Yang, 'Nature-Inspired Metaheuristic Algorithms: Second Edition', Luniver Press,
2010.
[38] Xin-She Yang,Nature-Inspired Metaheuristic Algorithms Second Edition, 2nd ed.
University of Cambridge: Luniver Press, 2010.
[39] I. Fister, I. Fister, X. Yang, S. Fong and Y. Zhuang, 'Bat algorithm: Recent advances',
Computational Intelligence and Informatics (CINTI), 2014 IEEE 15th International
Symposium on, pp. 163-167, 2014.
48
APPENDICES
APPENDIX A:
// Codding for the original prototype model
#include <NewPing.h> //include the ultrasonic sensor libary
//setting the pin
#define T_P 11
#define E_P 12
#define M_D 100
const int M1P1 = 7; // Motor 1 at pin 7
const int M1P2 = 6; // Motor 1 enabler at 6
const int M2P2 = 4; // Motor 2 at 4
const int M2P1 = 5; // Motor 3 enabler at 5
NewPing sonar(T_P, E_P, M_D);
unsigned int time;
int distance;
int triggerDistance = 30; //trigger distance at 30 cm
int fDistance;
int lDistance;
int rDistance;
void setup()
{
//turning on the motor
pinMode(M1P1, OUTPUT);
pinMode(M1P2, OUTPUT);
pinMode(M2P2, OUTPUT);
pinMode(M2P2, OUTPUT);
}
void loop()
{
scan(); //start scanning
fDistance = distance;
if(fDistance < triggerDistance){
Backward();
delay(1000);
Right();
delay(500);
Stop();
scan();
rDistance = distance;
moveLeft();
delay(1000);
49
Stop();
scan();
lDistance = distance;
if(lDistance < rDistance){
Right();
delay(200);
Forward();
}
else{
Forward();
}
}
else{
Forward();
}
}
void scan(){
time = sonar.ping();
distance = time / US_ROUNDTRIP_CM;
if(distance == 0){
distance = 100;
}
delay(10);
}
// move backward
void Backward(){
digitalWrite(M1P1, LOW);
digitalWrite(M1P2, HIGH);
digitalWrite(M2P1, LOW);
digitalWrite(M2P2, HIGH);
}
//move forward
void Forward(){
digitalWrite(M1P1, LOW);
digitalWrite(M1P2, HIGH);
digitalWrite(M2P1, LOW);
digitalWrite(M2P2, HIGH);
}
//move right
void Right(){
digitalWrite(M1P1, LOW);
digitalWrite(M1P2, HIGH);
digitalWrite(M2P1, LOW);
digitalWrite(M2P2, HIGH);
}
50
//move left
void Left(){
digitalWrite(M1P1, LOW);
digitalWrite(M1P2, HIGH);
digitalWrite(M2P1, LOW);
digitalWrite(M2P2, HIGH);
}
//stop
void Stop(){
digitalWrite(M1P1, LOW);
digitalWrite(M1P2, LOW);
digitalWrite(M2P1, LOW); digitalWrite(M2P2, LOW); }
51
APPENDIX B:
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Final Year Project 2
//Project :Smart Intellingence Safety System on Road
//Prototype
//Model Desc.:The prototype model uses 6 PING ultrasonic sensor surrounding the
//chasis, 2 DC motor,1 pack of 7.4V of lipo rechargeable battery, Ardurnio Mega
// and motor shield from DK electronics.
//
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Created by Raefi Azrani,1006Q78842,Bachelor(Hons) Electrical & Eletronic Engineering,
//Taylor's University,Malaysia - 2015
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Initial Setting
#include <AFMotor.h>
AF_DCMotor M1(3);
AF_DCMotor M2(4);
//sets the pin for the PING sensor on the right side
//sets the pin for the PING sensor in the center side
//sets the pin for the PING sensor on the left side
//sets the pin for the PING sensor on the side right
//sets the pin for the PING sensor on the back side
//sets the pin for the PING sensor on the left side
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void setup(){
//Turining on the motor
M1.setSpeed(200);
M2.setSpeed(200);
delay(2000);
Serial.begin(115200);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void loop() {
{
int i;
int j = 1;
delay(5000);
for(i=0; i<1; i*1){
j++;
getping_all();
52
53
54
{
right();
}
//obstacle on center
else if (i_L >= 15 && i_R >= 15 && i_C < 15)
{
if(j % 2 == 0){
left();
j=1;
}
else{
right();
}
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//motion setting
//max speed at 250 PWM
//min speef at 150 PWM
//Turning Degree :23,45,68,90 and 113
//
// Command:
//
run(FORWARD) (motor run in clockwise direction)
//
run(BACKWARD) (motor run in anticlowise direction)
//
setSpeed(n) (motor speed is set at n)
//
delay(n) (delay function at (n)ms as duration period)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//playing
void play(){
M1.setSpeed(250);
M2.setSpeed(250);
M1.run(FORWARD);
M2.run(BACKWARD);
delay(1000);
}
void forward(){
//moving forward at 250PWM FPA
if(i_C>=27 && i_R>=27 && i_L >=27 && i_SR >=27 && i_B >=27 && i_SL>=27){
//moving forward at 250PWM FPA
M1.setSpeed(250);
M2.setSpeed(250);
M1.run(FORWARD);
M2.run(FORWARD);
}
else if(i_C <=26 || i_R <=26 || i_L <=26 || i_SR <=26 || i_B <=26 || i_SL <=26 ){
//moving forward at 200PWM MPA
M1.setSpeed(200);
M2.setSpeed(200);
M1.run(FORWARD);
M2.run(FORWARD);
}
55
else if(i_C <=10 || i_R <=10 || i_L <=10 || i_SR <=10 || i_B <=10 || i_SL <=10){
//moving forward at 150PWM NPA
M1.setSpeed(150);
M2.setSpeed(150);
M1.run(FORWARD);
M2.run(FORWARD);
}
}
//moving forward at 150PWM NPA
void forwardN(){
M1.setSpeed(150);
M2.setSpeed(150);
M1.run(FORWARD);
M2.run(FORWARD);
}
//moving forward at 200PWM MPA
void forwardM(){
M1.setSpeed(200);
M2.setSpeed(200);
M1.run(FORWARD);
M2.run(FORWARD);
}
//moving forward at 250PWM FPA
void forwardF(){
M1.setSpeed(250);
M2.setSpeed(250);
M1.run(FORWARD);
M2.run(FORWARD);
}
//temporary moving forward at 180 PWM
void forwardD(){
M1.setSpeed(180);
M2.setSpeed(180);
M1.run(FORWARD);
M2.run(FORWARD);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//moving backward at 150PWM
void backward(){
M1.setSpeed(150);
M2.setSpeed(150);
M1.run(BACKWARD);
M2.run(BACKWARD);
}
//temporary moving backward at 150 PWM
void backwardD(){
M1.setSpeed(150);
M2.setSpeed(150);
M1.run(BACKWARD);
M2.run(BACKWARD);
delay(500);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
56
//stop
void stop(){
M1.run(RELEASE);
M2.run(RELEASE);
delay(300);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Nearest Point of Distance
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//moving right at 23 degrees
void right23(){
M1.setSpeed(150);
M2.setSpeed(150);
M1.run(FORWARD);
M2.run(BACKWARD);
delay(50);
stop();
}
//moving right at 45 degrees
void right45(){
M1.setSpeed(150);
M2.setSpeed(150);
M1.run(FORWARD);
M2.run(BACKWARD);
delay(140);
stop();
}
//moving right at 68 degrees
void right68(){
M1.setSpeed(150);
M2.setSpeed(150);
M1.run(FORWARD);
M2.run(BACKWARD);
delay(160);
stop();
}
//moving right at 90 degrees
void right90(){
M1.setSpeed(150);
M2.setSpeed(150);
M1.run(FORWARD);
M2.run(BACKWARD);
delay(200);
stop();
}
//moving right at 113 degrees
void right113(){
M1.setSpeed(150);
M2.setSpeed(150);
M1.run(FORWARD);
M2.run(BACKWARD);
delay(260);
stop();
}
57
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//moving left at 23 degrees
void left23(){
M1.setSpeed(150);
M2.setSpeed(150);
M1.run(BACKWARD);
M2.run(FORWARD);
delay(50);
stop();
}
//moving left at 45 degrees
void left45(){
M1.setSpeed(150);
M2.setSpeed(150);
M1.run(BACKWARD);
M2.run(FORWARD);
delay(140);
stop();
}
//moving left at 68 degrees
void left68(){
M1.setSpeed(150);
M2.setSpeed(150);
M1.run(BACKWARD);
M2.run(FORWARD);
delay(160);
stop();
}
//moving left at 90 degrees
void left90(){
M1.setSpeed(150);
M2.setSpeed(150);
M1.run(BACKWARD);
M2.run(FORWARD);
delay(200);
stop();
}
//moving left at 113 degrees
void left113(){
M1.setSpeed(150);
M2.setSpeed(150);
M1.run(BACKWARD);
M2.run(FORWARD);
delay(260);
stop();
}
58
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Mid Point of Distance
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//moving right at 23 degrees
void right23M(){
M1.setSpeed(200);
M2.setSpeed(200);
M1.run(FORWARD);
M2.run(BACKWARD);
delay(50);
stop();
}
//moving right at 45 degrees
void right45M(){
M1.setSpeed(200);
M2.setSpeed(200);
M1.run(FORWARD);
M2.run(BACKWARD);
delay(120);
stop();
}
//moving right at 68 degrees
void right68M(){
M1.setSpeed(200);
M2.setSpeed(200);
M1.run(FORWARD);
M2.run(BACKWARD);
delay(140);
stop();
}
//moving right at 90 degrees
void right90M(){
M1.setSpeed(200);
M2.setSpeed(200);
M1.run(FORWARD);
M2.run(BACKWARD);
delay(180);
stop();
}
//moving right at 113 degrees
void right113M() {
M1.setSpeed(200);
M2.setSpeed(200);
M1.run(FORWARD);
M2.run(BACKWARD);
delay(220);
stop();
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//moving left at 23 degrees
void left23M(){
M1.setSpeed(200);
59
M2.setSpeed(200);
M1.run(BACKWARD);
M2.run(FORWARD);
delay(50);
stop();
}
//moving left at 45 degrees
void left45M(){
M1.setSpeed(200);
M2.setSpeed(200);
M1.run(BACKWARD);
M2.run(FORWARD);
delay(140);stop();
}
//moving left at 68 degrees
void left68M(){
M1.setSpeed(200);
M2.setSpeed(200);
M1.run(BACKWARD);
M2.run(FORWARD);
delay(180);stop();
}
//moving left at 90 degrees
void left90M(){
M1.setSpeed(200);
M2.setSpeed(200);
M1.run(BACKWARD);
M2.run(FORWARD);
delay(180);stop();
}
//moving left at 113 degrees
void left113M(){
M1.setSpeed(200);
M2.setSpeed(200);
M1.run(BACKWARD);
M2.run(FORWARD);
delay(220);stop();
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//move left
M1.setSpeed(200);
M2.setSpeed(200);
M1.run(BACKWARD);
M2.run(FORWARD);
//move right
M1.setSpeed(200);
M2.setSpeed(200);
M1.run(FORWARD);
M2.run(BACKWARD);
60
//backward right
void back_right(){
M1.setSpeed(150);
M2.setSpeed(150);
M1.run(FORWARD);
M2.run(BACKWARD);
delay(300);
backward();
delay(500);
stop();
delay(350);
}
//backward left
void back_left(){
M1.setSpeed(150);
M2.setSpeed(150);
M1.run(BACKWARD);
M2.run(FORWARD);
delay(300);
backward();
delay(500);
stop();
delay(350);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Ultrasonic Scanning Setting
//
// PING Sensor:
//
L = Left side sensor
//
C = Centre side sensor
//
R = Right side sensor
//
SL = side left sensor
//
SR = sode right sensor
//
B = Back side sensor
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void getping_C()//get distance from center PING
{
pinMode(pingPin_C, OUTPUT);
digitalWrite(pingPin_C, LOW);
delayMicroseconds(2);
digitalWrite(pingPin_C, HIGH);
delayMicroseconds(5);
digitalWrite(pingPin_C, LOW);
pinMode(pingPin_C, INPUT);
duration_C = pulseIn(pingPin_C, HIGH);
i_C = microsecondsToI(duration_C);
}
void getping_R()//get distance from right PING
{
pinMode(pingPin_R, OUTPUT);
digitalWrite(pingPin_R, LOW);
delayMicroseconds(2);
61
digitalWrite(pingPin_R, HIGH);
delayMicroseconds(5);
digitalWrite(pingPin_R, LOW);
pinMode(pingPin_R, INPUT);
duration_R = pulseIn(pingPin_R, HIGH);
i_R = microsecondsToI(duration_R);
}
void getping_L()//get distance from left PING
{
pinMode(pingPin_L, OUTPUT);
digitalWrite(pingPin_L, LOW);
delayMicroseconds(2);
digitalWrite(pingPin_L, HIGH);
delayMicroseconds(5);
digitalWrite(pingPin_L, LOW);
pinMode(pingPin_L, INPUT);
duration_L = pulseIn(pingPin_L, HIGH);
i_L = microsecondsToI(duration_L);
}
void getping_SR()//get distance from side right PING
{
pinMode(pingPin_SR, OUTPUT);
digitalWrite(pingPin_SR, LOW);
delayMicroseconds(2);
digitalWrite(pingPin_SR, HIGH);
delayMicroseconds(5);
digitalWrite(pingPin_SR, LOW);
pinMode(pingPin_SR, INPUT);
duration_SR = pulseIn(pingPin_SR, HIGH);
i_SR = microsecondsToI(duration_SR);
}
void getping_B()//get distance from back PING
{
pinMode(pingPin_B, OUTPUT);
digitalWrite(pingPin_B, LOW);
delayMicroseconds(2);
digitalWrite(pingPin_B, HIGH);
delayMicroseconds(5);
digitalWrite(pingPin_B, LOW);
pinMode(pingPin_B, INPUT);
duration_B = pulseIn(pingPin_B, HIGH);
i_B = microsecondsToI(duration_B);
}
void getping_SL()//get distance from side left PING
{
pinMode(pingPin_SL, OUTPUT);
digitalWrite(pingPin_SL, LOW);
delayMicroseconds(2);
digitalWrite(pingPin_SL, HIGH);
delayMicroseconds(5);
digitalWrite(pingPin_SL, LOW);
pinMode(pingPin_SL, INPUT);
duration_SL = pulseIn(pingPin_SL, HIGH);
i_SL = microsecondsToI(duration_SL);
}
62
63
LIST OF PUBLICATIONS
Journal
1. Raefi Azrani, Aravind CV, Collision Avoidance using Nature-Inspired Bat
Algorithm, "International Journal of Applied Engineering Research ISSN 09734562, Online : ISSN 1087-1090 [Under Reviewed]
Conferences
1. Raefi Azrani, Aravind CV, Collision Avoidance using Nature-Inspired Bat
Algorithm,
Green
technologies
in
power
generation,
Communication
64