Obstacle Avoidance Robot Report

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 28

Table of Contents

1.0 Title ...................................................................................................................................... 1


2.0 Introduction .......................................................................................................................... 1
2.1 Arduino Uno .................................................................................................................... 1
2.2 Obstacle Avoiding Robot ................................................................................................. 2
3.0 Problem Statement ............................................................................................................... 4
4.0 Objectives ............................................................................................................................ 5
4.1 Aim of this project ........................................................................................................... 5
5.0 Methodology ........................................................................................................................ 6
5.1 List of Components .......................................................................................................... 6
5.2 Assembly Process ............................................................................................................ 9
5.3 Coding Arduino ............................................................................................................. 10
5.4 Costing ........................................................................................................................... 13
6.0 Arduino Library ................................................................................................................. 14
7.0 Assembly process............................................................................................................... 16
7.1 Hardware Assembly ....................................................................................................... 17
7.2 Electronic Part Assembly............................................................................................... 18
8.0 Discussion .......................................................................................................................... 22
9.0 Conclusion ......................................................................................................................... 24
10.0 Recommendation ............................................................................................................. 25
11.0 References ........................................................................................................................ 26

i
List of Figures

Figure 1: Arduino Uno with ATMEGA328P ............................................................................ 1

Figure 2: Ultrasonic Sensor HC-SR04 ....................................................................................... 2

Figure 3: The way sensor detects the barrier ............................................................................. 3

Figure 4: Schematic diagram of ultrasonic sensor with Arduino Uno....................................... 3

Figure 5: Received Parts .......................................................................................................... 16

Figure 6: Soldering process ..................................................................................................... 20

Figure 7: Testing the Ultrasonic Sensor................................................................................... 21

Figure 8: Final look of the robot .............................................................................................. 21

ii
1.0 Title
OBSTACLE AVOIDING ROBOT

2.0 Introduction

2.1 Arduino Uno

The Arduino UNO is an open-source microcontroller board based on


the Microchip ATMEGA328P microcontroller and developed by Arduino.cc. The board is
equipped with sets of digital and analogue input/output (I/O) pins that may be interfaced to
various expansion boards (shields) and other circuits.

Figure 1: Arduino Uno with ATMEGA328P


The board has 14 Digital pins, 6 Analog pins, and programmable with the Arduino
IDE (Integrated Development Environment) via a type B USB cable. It can be powered by a
USB cable or by an external 9 volt battery, though it accepts voltages between 7 and 20 volts.

1
2.2 Obstacle Avoiding Robot

Obstacle Avoiding Robot is a robot that will avoid obstacles by way of reversing and twisting
to find another way when the distance sensor acts as a robot's eye detects obstacles. When the
obstacle avoiding robot detects obstacles, the robot will move backwards and rotate randomly
either to the left or right. The movement backwards period is also random between 0.5 seconds
to 1 second. The robot will rotate left or right at random. Robot rotating time is also random at
0.5 seconds to 1.5 seconds. This robot is also graced with a flashing light. There are three LEDs
on the robot. The third flashing pattern of the three LEDs is also random. The time each LED
flashes is also at random.

Robot’s eye use ultrasonic sensor HC-SR04. This ultrasonic distance sensor uses ultrasonic
wave technology to determine the distance of the object in front of it. Animals such as bats and
dolphins also use the same concepts as using sound to determine the distance of the object in
front of them. HC-SR04 ultrasonic sensors offer tracking ranges from 2cm to 400 cm. HC-
SR04's ultrasonic distance sensor function is not affected by sunlight or rust-coloured objects
detected as infrared light based sensors. This sensor comes with ultrasonic wave transmitters
and wave receiver modules.

Figure 2: Ultrasonic Sensor HC-SR04


The wave receiver receives the ultrasonic wave that it is transmitting back then this means there
is a barrier in front of it.

2
Figure 3: The way sensor detects the barrier

Figure 4: Schematic diagram of ultrasonic sensor with Arduino Uno

3
3.0 Problem Statement

Nowadays, robotic technologies have become more important since a lot of industry is trying
to improve their machinery weapons. This technology has developed year by year to make sure
an excellent result. Recently, by time goes by, a lot of mechanical robots have been invented
to help peoples running their daily life. Obstacles Avoidance Mobile Robot is actually a simple
collision avoidance machines. Besides that, its future development is very big to explore. By
using this simple collision avoidance system, a lot of new and variety mobile robot with
multiple functions can be invented. Real-time obstacle avoidance is one of the key issues to
successful applications of mobile robot systems. All mobile robots feature some kind of
collision avoidance, ranging from primitive algorithms that detect an obstacle and steer the
robot short of it in order to avoid a collision, through sophisticated algorithms, that enable the
robot to detour obstacles. The latter algorithms are much more complex, since they involve not
only the detection of an obstacle, but also 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.

4
4.0 Objectives

4.1 Aim of this project

The aim of this project is to design a mobile robot with an ability to avoid obstacles. This
mobile robot will react with the surrounding to avoid any collision with obstacles. Ultrasonic
sensor will be the input for the whole process.

1. To learn how to use Arduino Uno.


2. To design and implement an Obstacle Avoiding Robot prototype by using Arduino
Uno.
3. To develop a robot using Ultrasonic sensor.

4.2 The scopes of this project

i. Develop an obstacle avoidance mobile robot with on-board sensors and


microcontroller. The designed robot will be able to avoid obstacle perfectly like
programmed. The robot has two wheels which are two gear motor in the rear and one
universal wheel at the front.
ii. The algorithm will be implemented in the main controller which is PIC microcontroller.
The input of this algorithm is the readings scan by ultrasonic sensor in the front of robot.
With this method, the robot can avoid the obstacle without having a collision.
iii. Develop the output of this system which is the dc motor that can reflect with the input
from the sensor. When an obstacle is detected, the main controller will trigger an input
to the dc motor to change the steering wheel to the correct direction. Thus, the obstacle
can be avoided.

5
5.0 Methodology

5.1 List of Components

Component Quantity Diagram

M3*30 screws 4

M3*8 copper cylinder 2

M3*8 screws 10

Encoder 2

M3 nut 10

T-type small bracket 4

Rocker switch 1

6
Tire 2

Universal wheel 1

Battery box 1

Chassis 1

Gear motor 2

Arduino Uno board 1

7
USB cable 1

1 bundle of male and


female
Connecting wires
1 bundle of male
1 bundle of female

Bread board 1

Ultrasonic sensor HC-SR04 1

8
5.2 Programming Algorithm and Flowchart

Algorithm: Flowchart:
1) Start.
2) Switch is on otherwise go back to starting START
point.
3) Initialize the input port (P7) & output port
(P6).
4) Robot moves in forward direction
5) If an obstacle is present robot will reverse in CHECK
SWITCH ON
left or right direction.
6) Robot continues to go forward in other
direction
7) Switch off
INITIALISING I/O
8) Stop PORT

ROBOT GOES IN
FORWARD DIRECTION

IS OBSTACLE
DETECTED

SET DIRECTION OF
ROBOT IN REVERSE
EITHER LEFT OR RIGHT

STOP

9
5.3 Coding Arduino

#include <NewPing.h>

#define TRIGGER_PIN 7
#define ECHO_PIN 6
#define MAX_DISTANCE 200 //Jarak maksimum : 400-500cm.

#define IN1 11
#define IN2 10
#define IN3 9
#define IN4 8

#define LED_RED 4
#define LED_YELLOW 3
#define LED_GREEN 2

NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE);

int distance;

bool directionMove;

int counterA;
int counterB;
int counterC;

int randomA;
int randomB;
int randomC;

bool red_condition = LOW;


bool yellow_condition = LOW;
bool green_condition = LOW;

void setup()
{
Serial.begin(9600);

pinMode(IN1,OUTPUT);
pinMode(IN2,OUTPUT);
pinMode(IN3,OUTPUT);
pinMode(IN4,OUTPUT);

pinMode(LED_RED,OUTPUT);
pinMode(LED_YELLOW,OUTPUT);
pinMode(LED_GREEN,OUTPUT);

10
randomA = random(10,30);
randomB = random(10,30);
randomC = random(10,30);
}
void loop()
{
delay(50);
distance = sonar.ping_cm();
Serial.print("Ping: ");
Serial.print(distance);
Serial.print("cm");
directionMove = !directionMove;

if( distance > 1 && distance <= 10 )


{
//Reverse
digitalWrite(IN1,LOW);
digitalWrite(IN2,HIGH);
digitalWrite(IN3,LOW);
digitalWrite(IN4,HIGH);
if(directionMove == 0)
{
//Right/Left
digitalWrite(IN1,LOW);
digitalWrite(IN2,HIGH);
digitalWrite(IN3,LOW);
digitalWrite(IN4,HIGH);
delay (random(500, 1500));
}
if(directionMove == 1)
{
//Right/Left
digitalWrite(IN1,HIGH);
digitalWrite(IN2,LOW);
digitalWrite(IN3,LOW);
digitalWrite(IN4,HIGH);
delay (random(500, 1500));
}
}
else
{
//Foward
digitalWrite(IN1,HIGH);
digitalWrite(IN2,LOW);
digitalWrite(IN3,HIGH);
digitalWrite(IN4,LOW);

11
}
counterA++;

if(counterA == randomA)
{
red_condition = !red_condition;
digitalWrite(LED_RED,red_condition);
counterA = 0;
randomA = random(5, 15);
}
counterB++;

if (counterB == randomB)
{
yellow_condition = !yellow_condition;
digitalWrite(LED_YELLOW, yellow_condition);
counterB = 0;
randomB = random(5, 15);
}
counterC++;

if (counterC == randomC)
{
green_condition = !green_condition;
digitalWrite(LED_GREEN, green_condition);
counterC = 0;
randomC = random(5, 15);
}
}

12
5.4 Costing

Component Price per unit Unit Total price


Arduino Uno Set RM150 1 RM150
Battery RM1 4 RM4
Cable tie RM0.20 3 RM0.60

Total RM154.60

13
6.0 Arduino Library

 A step by step approach to include ultrasonic sensor library

Step 1: Download distance sensor library at https://goo.gl/sm8Msa

Step 2: Click at the Arduino icon to open Arduino IDE

Step 3: Include the library by clicking Sketch >> Include Library >> Add.ZIP Library

14
Step 4: Choose the downloaded Library file and click open to include it.

Step 5: Wait for the message “Library added to your libraries. Check include library menu”,
this shows that the distance sensor library has successfully added into Arduino IDE.

15
7.0 Assembly process

We have purchased a set of OBSTACLE AVOIDANCE ROBOT at Nadi Eleczone Solution.


Figure above show all the items we received.

Figure 5: Received Parts

16
7.1 Hardware Assembly

 A set of pictures to show how to assemble motors and tires

Step 1: Install the tires together with the motors as shows in the picture

17
7.2 Electronic Part Assembly

1. Module below is known as motor driver L298N. It acts exactly like the engine of a
car. The module operates the motor and tyre.

2. Below is the motor component. It will be driven by the module above.

3. Component below is the power switch. It functions as to switch on or off the robot

18
4. Build the circuit below by using the remaining parts that are given. Checks each
connection carefully. After this our motor will operate forward smoothly.

19
5. Build an avoidance obstacle robot by following the circuit above. The robot will
avoids any obstacle by reversing and turning and finding another way as the
Ultrasonic Sensor guides as it eyes. Soldering is necessary to hold the wires firmly

Figure 6: Soldering process

20
Figure 7: Testing the Ultrasonic Sensor

Figure 8: Final look of the robot

21
8.0 Discussion

Based on this project, we learned that how to use Arduino properly and its coding based
on project that we created, and to design and implement an Obstacle Avoiding Robot prototype
by using Arduino Uno and using Ultrasonic sensor. Ultrasonic sensor on the front of the robot
reads input of the algorithm that created. Algorithm is created by implement in the main
controller which is PIC microcontroller. Output of this system which is the dc motor can reflect
with the input from the sensor is developed. The main controller will trigger an input to the dc
motor to change the steering wheel to the correct direction when an obstacle is detected. Thus,
the obstacle can be avoided.

This developed robot platform was not designed for specific task but as a general
wheeled autonomous platform. It can therefore be used for educational, research or industrial
implementation. Research on obstacle avoidance robot at the polytechnic level can help
students to develop communication, technical skills and teamwork. The design of such robot
is very flexible and various methods can be adapted for another implementation.

Obstacle Avoidance Robot has a vast field of application. They can be used as services
robots, for the purpose of household work and so many other indoor applications. Equally they
have great importance in scientific exploration and emergency rescue, there may be places that
are dangerous for humans or even impossible for humans to reach directly, then we should use
robots to help us. Nowadays, even in ordinary environments, people require that robots to
detect and avoid obstacles. For example, an industrial robot in a factory is expected to avoid
workers so that it won’t hurt them.

From the experiment, there are several pros and cons that can be discuss in the overall
usage of Obstacle Avoidance Robot. Pros can we can discuss are it demands very low
computational load, and can be implemented on low-cost microcontrollers, it is capable to
avoid any kind of static obstacles, and even some moving obstacles, like walking humans, it
requires low cost sensors which is ultrasonic sensor, it can be easily adapted for other sensors,
like rotating laser rangers, and it perform very well on narrow corridors.

22
The major weaknesses are those common for the majority of purely reactive algorithms
such as it is far from being optimal, the motion is not smooth, it requires a higher level path
planner to perform reasonably well in maze-type environments, motion is attempted even if
there is no path to goal, failure is possible even when a valid path to goal exists, and It is
vulnerable to sensor noise; This problem is partly solved with this algorithm because it
considers the readings of all sensors when computing the rebound angle.

Despite the above-mentioned drawbacks, the proposed algorithm may be of interest in


applications where a higher-level path planner is available, and when the cost criterion is
particularly important. Further work is required to improve the overall smoothness of the
motion. This is possible, because at this time, the robot stops and adjusts its heading each time
an obstacle is detected. Most of the avoidance manoeuvres can actually be executed on the fly,
without the need to stop the robot. The experiments with the simulator, and with real robots
suggest that such simple algorithms can be used in the implementation of low-cost embedded
control devices.

23
9.0 Conclusion

The completed project has not reach its maximum potential. However we feel grateful
because the coding for the Arduino run successfully. The most critical part in this project was
the coding. In addition, there is also a lot more enhancement that can be applied to our robot
such as adding more sensors for more effective response such as putting up more ultrasonic
sensor in the left and right in our robot so that it can manoeuvre and avoid obstacle at left and
right side, we could also add a camera to capture image and recording videos, high
performance battery for longer lifetime performance if we have enough budget to upgrade
our project to become a high end product. The aesthetic value will need to be considered and
valued if it is planned for manufacture and distribute into the market. The safety aspect is also
important to make sure the robot will not break down easily and prevent injuries to the users.
However, we need more time to do research on how to apply the upgrades mentioned above.

During the assembly of our mini robot, we could understand the function of PDB
(Power Distribution Board) which is task to distribute the power to the motor. The PDB will
receive the signal from Arduino board that act as the brain of the robot. It was able to avoid
obstacle is due to the Ultrasonic sensor that shoot the ultrasonic ray at the front.

Finally, we succeed in completing our objective that require us to do the Arduino


coding by using Arduino Uno and assemble all the electronic component such as PDB,
Ultrasonic sensor, switch, Arduino Uno, Led lights, capacitor, and breadboard.

24
10.0 Recommendation

For future improvement, we will improvise the robot to make the robot smart enough to detect
all objects in any position of room. Next, we will make sure to make the robot smarter such
that the robot can cleans any room, it will save the information about obstacle and its location
and if the user want to clean a room it just will restore information and it will clean faster.

25
11.0 References

1. Eleczone, N. (2018). Arduino Kit Obstacle Avoiding Robot Pengelak Halangan | Nadi
Eleczone Solutions. [online] Nadi Eleczone Solutions. Available at:
https://www.nadieleczone.com/ulasan-produk/arduino-kit-obstacle-avoiding-robot-
pengelak-halangan/ [Accessed 5 Dec. 2018].
2. Author, N. (2018). Arduino Uno. [online] En.wikipedia.org. Available at:
https://en.wikipedia.org/wiki/Arduino_Uno [Accessed 5 Dec. 2018].

26

You might also like