Arduino Based Obstacle Avoiding Robot: Electrical Engineering Department 6 Semester, Batch 2017, Section (A)
Arduino Based Obstacle Avoiding Robot: Electrical Engineering Department 6 Semester, Batch 2017, Section (A)
SUBMITTED TO
1
ABSTRACT
The project is design to build an obstacle avoidance robotic vehicle using ultrasonic sensors for
its movement. Arduino UNO is used to achieve the desired operation. A robot is a machine that
can perform task automatically or with guidance. Robotics is a combination of computational
intelligence and physical machines (motors). Computational intelligence involves the
programmed instructions. The project proposes robotic vehicle that has an intelligence built in
it such that it directs itself whenever an obstacle comes in its path. This robotic vehicle is built,
using a Arduino UNO. An ultrasonic sensor is used to detect any obstacle ahead of it and sends
a command to the microcontroller. Depending on the input signal received, the micro-controller
redirects the robot to move in an alternate direction by actuating the motors which are
interfaced to it through a motor driver.
2
TABLE OF CONTENTS
1. INTRODUCTION ....................................................... 4
1.1 Obstacle Avoiding Robot ……………………......................................................................................4
1.2 Applications of OAR .................................................................................................................... 4
3. METHODOLOGY ....................................................... 7
3.1 Implementation Procedure ........................................................................................................ 7
3.2 Software used ............................................................................................................................ 7
6. CONCLUSION .......................................................... 11
7. REFERENCES ......................................................... 11
3
INTRODUCTION
1.1 OBSTACLE AVOIDING ROBOT
Obstacle avoidance is a primary requirement of any autonomous mobile robot. Obstacle
avoidance Robot is design to allow robot to navigate in unknown environment by avoiding
collisions. Obstacle avoiding robot senses obstacles in the path, avoid it and resumes its
running. There are some very famous methods for robot navigation like wall-following,
edge detection, line following. One of the commercial systems uses wall following method
on a floor cleaning robot for long hallways. A more general and commonly employed
method for obstacle avoidance is based on edge detection. A disadvantage with obstacle
avoidance based on edge detecting is the need of the robot to stop in front of an obstacle
in order to provide a more accurate measurement. All mobile robots feature some kind of
collision avoidance, ranging from primitive algorithms that detect an obstacle and stop the
robot in order to avoid a collision, using some sophisticated algorithms, that enable the
robot to detour obstacles. The latter algorithms are more complex, since they involve
detection of an obstacle as well as some kind of quantitative measurements concerning
the obstacle's dimensions. Once these have been determined, the obstacle avoidance
algorithm needs to steer the robot around the obstacle and resume motion toward the
original target. In this paper the steering algorithm ensures that the robot does not have
to stop in front of an obstacle during its navigation. Hence the robots may overcome some
of the problems during navigation, which are discussed above and it can navigate smoothly
during its operation avoiding the collisions. We have presented a basic algorithm and
design which can be further improved depending upon the required applications.
Obstacle avoiding robots can be used in almost all mobile robot navigation
systems.
They can be used for household work like automatic vacuum cleaning.
They can also be used in dangerous environments, where human penetration
could be fatal.
4
COMPONENTS AND TOOLS
2.1 HARDWARE USED WITH TECHNICAL SPECIFICATIONS
The Motor Driver Module (LM298N) is a module for motors that allows you to control the
working speed and direction of two motors simultaneously. This Motor Driver is designed
and developed based on L293D IC. L293D is a 16 Pin Motor Driver IC. This is designed to
provide bidirectional drive currents at voltages from 5 V to 36 V.
5
2.2.3 Ultrasonic Sensor (HC-SR04)
The HC-SR04 ultrasonic sensor uses sonar to determine distance to an object like bats do.
It offers excellent non-contact range detection with high accuracy and stable readings in
an easy-to-use package. It comes complete with ultrasonic transmitter and receiver
modules.
Here’s a list of some of the HC-SR04 ultrasonic sensor features and specs:
6
METHODOLOGY
3.1 IMPLEMENTATION PROCEDURE
The implementation of obstacle avoidance strategy for robot involves the writing and
compilation of program using Arduino software. Arduino is a popular programmable board
used to create projects. It consists of a simple hardware platform on which microcontroller
is placed as well as a free code editor which has a “one click compile or upload” feature.
Hence it is designed for the peoples in such a way that they can use it without necessarily
being an expert programmer. Arduino offers an open-source electronic prototyping
platform that is easy to use and flexible for peoples who are beginners in robotics field
with both the software and hardware perspective. Sensors are connected with the Arduino
board using breadboard. Microcontroller is able to sense the environment through
receiving input from sensors. It is also able to control its surrounding through controlling
motors and other actuators. The Arduino programming language that is based on the
processing are used to program the microcontroller found on the board. Due to its
opensource environment, we can able to easily write and upload codes to the I/O board.
Arduino environment is written in Java hence it can be run on Linux, Mac OSX and
Windows platforms. The output of the comparator is given to microcontroller, which then
moves actuators in left or right direction by giving power through DC motor.
7
CIRCUIT DIAGRAM
8
RESULTS AND ANALYSIS
5.1 ALGORITHM – WORKING PRINCIPLE
The sonar system is used in HC-SR04 ultrasonic sensor to determine distance to an object like
bats do. It offers excellent non-contact range detection from about 2 cm to 400 cm or 1’’ to 13
feet. Its operation is not affected by sunlight or black material.
The ultrasonic sensor emits the short and high frequency signal. If they detect any object, then
they reflect back echo signal which taken as input to the sensor through Echo pin.
Firstly, we initialize Trigger and Echo pin as low and push the robot in forward direction. when
obstacle is detected Echo pin will give input as high to microcontroller. pulseIn() function is
used for calculating the time of distance from the obstacle. Every time the function waits for
pin to go high and starts timing, then timing will be stopped when pin go to low. It returns the
pulse length in microseconds or when complete pulse was not received within the timeout it
returns 0.
The timing has been determined means it gives length of the pulse and will show errors in
shorter pulses. Pulses from 10microseconds to 3 minutes in length are taken into
consideration.
After determining the time, it converts into a distance. If the distance of object is moderate
then speed of robot gets reduced and will take left turn, if obstacle is present in left side then it
will take right turn.
If the distance of object is short then speed of robot gets reduced and will turn in backward
direction and then can go in left or right direction.
9
delay(random(500,2000)); // delay for random time
Serial.begin(9600);
pinMode(revleft4, OUTPUT); // set Motor pins as output
pinMode(fwdleft5, OUTPUT);
pinMode(revright6, OUTPUT);
pinMode(fwdright7, OUTPUT);
pinMode(trigPin, OUTPUT); // set trig pin as output
pinMode(echoPin, INPUT); //set echo pin as input to capture reflected waves
}
void loop() {
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH); // send waves for 10 us
delayMicroseconds(10);
duration = pulseIn(echoPin, HIGH); // receive reflected waves
distance = duration / 58.2; // convert to distance
delay(10);
if (distance > 19)
{
digitalWrite(fwdright7, HIGH); // move forward
digitalWrite(revright6, LOW);
digitalWrite(fwdleft5, HIGH);
digitalWrite(revleft4, LOW);
}
if (distance < 18)
{
digitalWrite(fwdright7, LOW); //Stop
digitalWrite(revright6, LOW);
digitalWrite(fwdleft5, LOW);
digitalWrite(revleft4, LOW);
delay(500);
digitalWrite(fwdright7, LOW); //movebackword
digitalWrite(revright6, HIGH);
digitalWrite(fwdleft5, LOW);
digitalWrite(revleft4, HIGH);
delay(500);
digitalWrite(fwdright7, LOW); //Stop
digitalWrite(revright6, LOW);
digitalWrite(fwdleft5, LOW);
digitalWrite(revleft4, LOW);
10
delay(100);
digitalWrite(fwdright7, HIGH);
digitalWrite(revright6, LOW);
digitalWrite(revleft4, LOW);
digitalWrite(fwdleft5, LOW);
delay(500);
}
CONCLUSION
We build a robotic vehicle which moves in different directions like Forward, Backward, Left, and
Right when input is given to it. The goal of our project is to create an autonomous robot which
intelligently detects the obstacle in his path and navigate according to the actions that we set
for it.
REFERENCES
Obstacle avoidance robotic vehicle using ultrasonic sensors for obstacle detection:
http://www.elprocus.com/obstacle-avoidancerobotic-vehicle/
11