Project title: Auto-Obstacle Avoiding Robot with Smart Navigation &
Control
Components used:
L293D motor driver
Arduino UNO board
Ultrasonic sensor
Bluetooth module
Gear motor x 4
Robot wheel x 4
Li-ion battery holder x 1
Li-ion battery x 3
Jumper wires
Chasis
Bluetooth module (HC05)
Servo motor
Description: This Robot is a multi-functional Robot that operates in 4
different modes
i) Auto Obstacle avoiding
ii) Hand Gesture Control
iii) Voice Control
iv) Manual Control
In the first mode the robot runs by itself and has a feature of
automatically getting stop whenever a obstacle comes in path to avoid
the collision. The robot gets stop and the collision does not occurs.
For this operation Ultrasonic sensor is used, which detect a specific
distance in the path of the robot and whenever it does not get the path
clear it stops the robot and then finds a new path where the robot can
move on.
After stopping at an obstacle the robot then searches for the new clear
path by using that Ultrasonic sensor, the sensor gets rotated in left and
right direction for observing which path is clear.
This action is performed by servo motor mounted beneath the
Ultrasonic sensor.
ii) In the second mode the robot gets the command by the external
devices, which contains the accelerometer and gyroscopic sensor.
Under the Hand gesture control mode, the motion of hand is sensed
by the Accelerometer and direction by Gyroscope fitted in the hand,
the gets the command from it and then it analyzes the movement of
the hand to follow the instructions for the movement.
iii) In the third mode, the robot gets operated by the voice command
given to the robot. The commands contains basic LEFT, RIGHT,
FORWARD, BACKWARD, STOP commands.
iv) In the manual mode external controller is being used to control
the robot
#CODE_FOR_PROJECT
Arduino IDE is used to implement the code in the Arduino UNO
/*obstacle avoiding, Bluetooth control, voice control robot car.
Home Page
*/
#include <Servo.h>
#include <AFMotor.h>
#define Echo A0
#define Trig A1
#define motor 10
#define Speed 170
#define spoint 103
char value;
int distance;
int Left;
int Right;
int L = 0;
int R = 0;
int L1 = 0;
int R1 = 0;
Servo servo;
AF_DCMotor M1(1);
AF_DCMotor M2(2);
AF_DCMotor M3(3);
AF_DCMotor M4(4);
void setup() {
[Link](9600);
pinMode(Trig, OUTPUT);
pinMode(Echo, INPUT);
[Link](motor);
[Link](Speed);
[Link](Speed);
[Link](Speed);
[Link](Speed);
void loop() {
//Obstacle();
//Bluetoothcontrol();
//voicecontrol();
void Bluetoothcontrol() {
if ([Link]() > 0) {
value = [Link]();
[Link](value);
if (value == 'F') {
forward();
} else if (value == 'B') {
backward();
} else if (value == 'L') {
left();
} else if (value == 'R') {
right();
} else if (value == 'S') {
Stop();
void Obstacle() {
distance = ultrasonic();
if (distance <= 12) {
Stop();
backward();
delay(100);
Stop();
L = leftsee();
[Link](spoint);
delay(800);
R = rightsee();
[Link](spoint);
if (L < R) {
right();
delay(500);
Stop();
delay(200);
} else if (L > R) {
left();
delay(500);
Stop();
delay(200);
} else {
forward();
void voicecontrol() {
if ([Link]() > 0) {
value = [Link]();
[Link](value);
if (value == '^') {
forward();
} else if (value == '-') {
backward();
} else if (value == '<') {
L = leftsee();
[Link](spoint);
if (L >= 10 ) {
left();
delay(500);
Stop();
} else if (L < 10) {
Stop();
} else if (value == '>') {
R = rightsee();
[Link](spoint);
if (R >= 10 ) {
right();
delay(500);
Stop();
} else if (R < 10) {
Stop();
} else if (value == '*') {
Stop();
// Ultrasonic sensor distance reading function
int ultrasonic() {
digitalWrite(Trig, LOW);
delayMicroseconds(4);
digitalWrite(Trig, HIGH);
delayMicroseconds(10);
digitalWrite(Trig, LOW);
long t = pulseIn(Echo, HIGH);
long cm = t / 29 / 2; //time convert distance
return cm;
void forward() {
[Link](FORWARD);
[Link](FORWARD);
[Link](FORWARD);
[Link](FORWARD);
void backward() {
[Link](BACKWARD);
[Link](BACKWARD);
[Link](BACKWARD);
[Link](BACKWARD);
void right() {
[Link](BACKWARD);
[Link](BACKWARD);
[Link](FORWARD);
[Link](FORWARD);
void left() {
[Link](FORWARD);
[Link](FORWARD);
[Link](BACKWARD);
[Link](BACKWARD);
void Stop() {
[Link](RELEASE);
[Link](RELEASE);
[Link](RELEASE);
[Link](RELEASE);
int rightsee() {
[Link](20);
delay(800);
Left = ultrasonic();
return Left;
int leftsee() {
[Link](180);
delay(800);
Right = ultrasonic();
return Right;