OBSTACLE AVOIDING ROBOT
Introduction: An obstacle avoiding robot is an autonomous robot which is able to
avoid any obstacle it face when it moves. Simply, when it met an obstacle while it
moving forward, automatically stop moving forward and makes a step back then it
takes a little turn and moves forward with the same loop. This obstacle avoiding
robot we are demonstrating here is very helpful and this is a simple demonstration
of obstacle avoiding process for sophisticated technologies and machines. It is the
base of many large projects such as Automatic cars, robots used in Manufacturing
factories, even in robots used in spacecraft’s or interplanetary robotic missions like
Mars rover.
Components used: In this robotic project we are using following components:
Arduino UNO
2 Wheel Drive robotic chassis
Two DC BO motors
L293 motor driver
HC-SR04 Ultrasonic sensor
Switch
9v Batteries and connector
Jumper wires
Caster
Nut-Bolts, Spacer
Other supporting components and tools
Basic principle: The robot uses Ultrasonic sensor to detect the obstacle and motor
driver is used to drive the motor according to the ultrasonic signal as per code
written in the Arduino.
Ultrasonic sensor: The ultrasonic sensor has a signal generator and a receiver. The
signal generator generates an ultrasonic wave and transmits in the forward
direction. The transmitted wave strikes any obstacle in its path and a huge part of it
gets reflected. The receiver receives the reflected wave.
The obtained values from the ultrasonic sensor need to be calibrated in order to get
a meaningful data (distance). The distance of the object is calculated on the basis of
the time taken by the wave in the process of transmission, reflection and collection.
Arduino: Arduino is an open-source electronics platform based on easy-to-use
hardware and software. Arduino boards are able to read inputs (Like-light on a
sensor, a signal of a button, or a signal from sensor etc) and turn it into an output
(Like- activating a motor, turning on an LED, publishing something online etc). We
can tell our board what to do by sending a set of instructions to the microcontroller
on the board. To do so we use the Arduino programming language and the Arduino
Software (IDE).
In this project, to avoid the obstacle in the path, a condition is put in the system
which says: if the distance between the robot and the object gets below a certain
level, stop the robot and take a backward motion and then turn the robot into other
direction and continue the loop. This logic is applied to the system by writing the
code in the arduino.
L293 motor driver: We now have the conditions set up for the robot car but it needs
to be executed/implemented on the hardware. The hardware used is the DC motor.
To drive these DC BO Motors, we need motor driver. In this project we are using
L293 motor driver. Motor driver is used to send the commands to motors according
to signal received from Arduino.
BO Motors: Two motors are used in this process: left motor and right motor. To
move the robot car forward, both the motors are turned on. For backward step,
both motors need to run in opposite direction. To turn the robot car to avoid
obstacle, one of the motor is reversed for a while, keeping the other motor forward.
Connections:
Motor Driver connection:
Vin → 9v Battery (+)ve
GND → 9v Battery (-)ve
M1 → Left Motor connection
M2 → Right Motor connection
IN1 and IN2 → Arduino 4 and 5 (If motor runs in wrong direction, connection is
swapped)
IN3 and IN4 → Arduino 6 and 7 (If motor runs in wrong direction, connection is
swapped)
Ultrasonic connection:
Gnd: Arduino GND
Echo: Arduino A2
Trig: Arduino A1
Vcc: Arduino 5V
Programming Arduino UNO
1. Download and Install the Arduino Desktop IDE
2. Download and paste NewPing library (Ultrasonic sensor function library) file to the
Arduino libraries folder.
Paste files to the path (Example) - C:\Arduino\libraries
3. Write Arduino code for the robot functioning
4. Upload the code to the arduino board via a cable
Power the Robot
We will use pack of 9V batteries to power our robot and Arduino.
Demonstration: When we put the robot and turn ON the switch, it goes forward. The
robot detects the obstacle in its path and takes a backward step and then takes a
turn and then moves forward with the same loop.