Hey
guys in this tutorial we will see how to make an autonomous obstacle avoiding
Robot.This robot is designed and programmed in such a way that it avoids
collision.The robot basically moves in a forward direction and whenever it
detects a object/obstacle in its path it takes an diversion and avoids the
collision.
COMPONETS REQUIRED:
- Arduino UNO
- HC SR-04(Ultrasonic sensor)
- ultrasonic sensor clamp(optional)
- L293D motor driver
- metal chassis
- 2x BO motors
- 1x caster wheel
- 2x wheels
- 2x 9v battery
- 2x dc battery connectors
- connecting wires
WORKING PRINCIPLE:
The
obstacle avoidance robotic vehicle uses ultrasonic sensors for its movements. A
UNO of Arduino family is used to achieve the desired operation. The motors are
connected through motor driver IC to Arduino uno. The ultrasonic sensor is
attached in front of the robot.Whenever the robot is going on the desired path
the ultrasonic sensor transmits the ultrasonic waves continuously from its
sensor head. Whenever an obstacle comes ahead of it the ultrasonic waves are
reflected back from an object and that information is passed to the arduino.
The arduino controls the motors based on ultrasonic signals.
ULTRASONIC SENSOR:
The
ultrasonic sensor is used for obstacle detection. Ultrasonic sensor transmits
the ultrasonic waves from its sensor head and again receives the ultrasonic
waves reflected from an object.The ultrasonic sensor emits the short and high
frequency signal. These propagate in the air at the velocity of sound. If they
hit any object, then they reflect back echo signal to the sensor. The
ultrasonic sensor consists of a multi vibrator, fixed to the base. The multi
vibrator is combination of a resonator and vibrator. The resonator delivers
ultrasonic wave generated by the vibration.
The ultrasonic sensor
actually consists of two parts; the emitter which produces a 40 kHz sound wave
and detector detects 40 kHz sound wave and sends electrical signal back to the
arduino.
The
ultrasonic sensor enables the robot to virtually see and recognize object,
avoid obstacles, measure distance. To
use this sensor to measure distance, the robot's brain must measure the amount
of time it takes for the ultrasonic sound to travel.
Sound travels at
approximately 340 meters per second. This corresponds to about 29.412µs
(microseconds) per centimeter. To measure the distance the sound has travelled
we use the formula: Distance = (Time x SpeedOfSound) / 2. The "2" is in
the formula because the sound has to travel back and forth. First the sound
travels away from the sensor, and then it bounces off of a surface and returns
back. The easy way to read the distance as centimeters is to use the formula:
Centimeters = ((Microseconds / 58.2).
LETS MAKE THE ROBOT:
STEP1:
Fix
the wheels on the metal chassis and mount the Dc BO motors on the back wheels
and fix a caster wheel in the front.
connect
the L293D motor driver with the arduino and dc motors.
CONNECTIONS:
3,6(l293d) to left motor(output)
11,14(l293d) to right motor(output)
2,7,10,15(l293d) to pins 2,3,4,5 of Arduino(inputs)
NOTE: you can use an l293d ic or an readymade module,each module differs so check L293D IC pin diagram to make correct connections.
STEP 2:
connect
the ultra sonic sensor with your arduino,
pin
8 of arduino to echo pin
pin
9 of arduino to trigger pin
vcc-5v
,gnd-gnd
STEP3:
Interface your arduino with arduino IDE software and upload the below
program.
#define echopin 8 // echo pin
#define trigpin 9 // Trigger pin
int maximumRange = 30;
long duration, distance;
void setup() {
Serial.begin (9600);
pinMode (trigpin, OUTPUT);
pinMode (echopin, INPUT );
pinMode (2, OUTPUT);
pinMode (3, OUTPUT);
pinMode (4, OUTPUT);
pinMode (5, OUTPUT);
}
void loop ()
{
{
digitalWrite(trigpin,LOW);
delayMicroseconds(2);
digitalWrite(trigpin,HIGH);
delayMicroseconds(10);
duration=pulseIn (echopin,HIGH);
distance= duration/58.2;
delay (50);
Serial.println(distance);
}
if (distance >= 30 ){
digitalWrite(2,HIGH);
digitalWrite(3,LOW);
digitalWrite(4,HIGH);
digitalWrite(5,LOW);
delay (200);
}
else if (distance >=15 && distance <= 25) {
digitalWrite (2,HIGH);
digitalWrite (3,LOW);
digitalWrite (4,LOW);
digitalWrite (5,LOW);
delay (1000);
}
else if (distance < 15){
digitalWrite (2, LOW);
digitalWrite (3, HIGH);
digitalWrite (4, LOW);
digitalWrite (5, HIGH);
delay (1000);
digitalWrite (2,LOW);
digitalWrite (3,LOW);
digitalWrite (4,HIGH);
digitalWrite (5,LOW);
delay (1000);
}
}
DOWNLOAD PROGRAM:click here
STEP 4:
connect
the power supply to your arduino and motor driver....
YOUR
BOT IS READY TO GO.......
Nice wrk kar....
ReplyDeleteThank you :-)
DeleteL293d Dual Motor Driver H-BRIDGE Module.... Will this module work with this?
ReplyDeleteyes kishore you can use L293D H-BRIDGE module...I have used the same module in the above tutorial
ReplyDeleteCan i use l298n instead of l293d module???
ReplyDeleteCan i use l298n instead of l293d module???
ReplyDeletehello!!! first of all nice work....my problem is my code is running only when connected to the pc...it wont run on a 9v battery (standalone)...pls suggest
ReplyDeletehello!!! first of all nice work....my problem is my code is running only when connected to the pc...it wont run on a 9v battery (standalone)...pls suggest
ReplyDeleteThnak u for nice tutorial. I am very new for arduino project. On my site I saw there use separate ping liberary for sensor. Is it necessary for our project ?
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteHello Karthik, Myself Raghudathesh G P. I saw you project on home automation using arduino and bluetooth. Can you send me the MIT app inverter Source (.aia)code to my mail ID datheshraghubooks@gmail.com it will be helpful as I am working on same project with 7 actuators and I am not good at android part. I will share you the project code once I complete the project.
ReplyDeleteCan u suggest where to connect two 9v batteries?
ReplyDeleteCan u suggest where to connect two 9v batteries?
ReplyDeletehello sir will this code work on L298N motor shield???
ReplyDeleteIn this modern world, the advancement of techniques has led people to work more comfortably and with more appropriateness. Using sensor in industries such as for evaluating the proper portion of chemicals, the specialists prefer to use chemical level sensors which can immediately tell the result or show the quantity for reactions.
ReplyDeleteChemical Level Sensor
JT Casino Resort - Reno Hotels - KTNV
ReplyDeleteFind your perfect spot at JT Casino Resort in Reno, 나주 출장안마 Nevada for a 의정부 출장마사지 quick getaway. We offer the best of Reno, NV 세종특별자치 출장샵 vacation 정읍 출장마사지 packages 용인 출장안마 and offers for