Skip to main content

Obstacle Avoiding Robot

Obstacle Avoiding Robot using Arduino and Ultrasonic Sensor



A simple project on Obstacle Avoiding Robot is meant here. Robotics is a stimulating and fast growing field. Being a branch of engineering, the applications of robotics are increasing with the advancement of technology.The concept of Mobile Robot is fast evolving and therefore the number of mobile robots and their complexities are increasing with different applications.There are many kind of mobile robot navigation techniques like path planning, self – localization and map interpreting. An Obstacle Avoiding Robot may be a sort of autonomous mobile robot that avoids collision with unexpected obstacles.
In this project, an Obstacle Avoiding Robot is supposed. It's an Arduino based robot that uses Ultrasonic range finder sensors to avoid collisions. 
Components Required
  1. Arduino NANO or Uno  🛒
  2. HC-SR04 Ultrasonic Sensor  🛒
  3. LM298N Motor Driver Module  🛒
  4. 5V DC Motors  🛒
  5. Battery  🛒
  6. Wheels 🛒
  7. Chassis  🛒
  8. Jumper Wires  🛒

Circuit Diagram


Design of Obstacle Avoiding Robot using Arduino

Arduino is that the main processing unit of the robot. Out of the 14 available digital I/O pins, 7 pins are utilized in this project design.The ultrasonic sensor has 4 pins: Vcc, Trig, Echo and Gnd. Vcc and Gnd are connected to the +5v and GND pins of the Arduino. Trig (Trigger) is connected to the 9th pin and Echo is connected to 8th pin of the Arduino UNO respectively.A Servo Motor is used to rotate the Ultrasonic Sensor to scan for obstacles. it's three pins namely Control, VCC and GND. The Servo Control Pin is connected to pin 11 of Arduino while the VCC and GND are connected to +5V and GND. L293D may be a 16 pin IC. Pins 1 and 9 are the enable pins. These pins are connected to +5V. Pins 2 and seven are control inputs from microcontroller for first motor. they're connected to pins 6 and seven of Arduino respectively.Similarly, pins 10 and 15 are control inputs from microcontroller for second motor. they're connected to pins 5 and 4 of Arduino. Pins 4, 5, 12 and 13 of L293D are ground pins and are connected to Gnd.First motor (consider this because the motor for left wheel) is connected across the pins 3 and 6 of L293D. The second motor, which acts because the right wheel motor, is connected to 11 and 14 pins of L293D.The 16th pin of L293D is Vcc1. this is often connected to +5V. The 8th pins is Vcc2. this is often the motor supply voltage. this will be connected anywhere between 4.7V and 36V. during this project, pin 8 if L293D is connected to +5V supply.
NOTE: the facility supply to the Motor Driver i.e. Pins 1 (enable 1), 8 (VCC2), 9 (enable 2) and 16 (VCC1) should tend a seperate power supply.
Motor Driver boards are available with on – board 5V transformer . an identical one is employed within the project.

How Ultrasonic Sensor are often used to Avoid Obstacles

Before getting to working of the project, it's important to know how the ultrasonic sensor works. the essential principle behind the working of ultrasonic sensor because this sensor will have important role in detecting obstacle. The fundamental principle behind the working of ultrasonic sensor is discovered as the time taken by sensor to transmit ultrasonic beams and receiving the ultrasonic beams after striking the surface. Then further the space or dis is calculated using the formula. In this project, the commonly available HC-SR04 Ultrasonic Sensor is used. To use this sensor, similar approach are going to be followed explained above.


So, the Trig pin of HC-SR04 is formed high for a minimum of 10 us. A sonic beam is transmitted with the 8 pulses of 40 KHz each.

So, the Trig pin of HC-SR04 is formed high for a minimum of 10 us. A sonic beam is transmitted with the 8 pulses of 40 KHz each.


Code:

/* Obstacle Avoiding Robot Using Ultrasonic Sensor and Arduino */

int trigPin = 9; // trig pin of HC-SR04
int echoPin = 10; // Echo pin of HC-SR04 int revleft4 = 4; //reverse motion of Left motor
int fwdleft5 = 5; //forward motion of Left motor
int revright6 = 6; //reverse motion of Right motor
int fwdright7 = 7; //forward motion of Right motor long duration, distance; void setup() {

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 or length in appropriate unit distance
delay(10);
// If you don't get proper movements of your robot then change or alter the pin numbers
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); //move backward
digitalWrite(revright6, HIGH);
digitalWrite(fwdleft5, LOW);
digitalWrite(revleft4, HIGH);
delay(500);
digitalWrite(fwdright7, LOW); //Stop
digitalWrite(revright6, LOW);
digitalWrite(fwdleft5, LOW);
digitalWrite(revleft4, LOW);
delay(100);
digitalWrite(fwdright7, HIGH);
digitalWrite(revright6, LOW);
digitalWrite(revleft4, LOW);
digitalWrite(fwdleft5, LOW);
delay(500);
} } //code END Hope you would have liked this Project!!

Applications:

  • Obstacle avoiding robots are often utilized in most mobile robot navigation systems.
  • They can be used for household work like automatic vacuum cleaning and many other.
  • They can even be utilized in dangerous environments, where human penetration might be fatal.

Hope you would have liked this Project!!


Comments

amazon banner

Popular posts from this blog

Motion Detector Camera

Motion Detector With Photo Capture Camera   Hello friends!! Welcome to This Blog. In this Blog, we will make a motion sensor detector with photo capture using ESP32CAM and the PIR module. The logic behind is when the PIR sensor detects any motion, the ESP32CAM will start taking the pictures. So you can use this project as a security camera. In thisblog, I will share the circuitdiagram, Arduino sketch, and the component list, so after reading the complete article you can easily make this project. Now ESP32 CAM is a small camera module that has ESP32S chip on the back and some GPIO pins to connect peripherals and it also has a micro-SD card slot, where you can insert the micro-SD card and store the pictures. Now before going to the circuit diagram and Arduino sketch, let me give you a quick overview of this project.  Components Required ESP32-CAM  PIR Motion Sensor Module BC547 NPN Transistor 220ohm, 1k, 10k Resistor. LED 5-mm FTDI 232 USB to Serial Interface board 5 volt DC supply  The

Bidirectional Visitor Counter

Bidirectional Visitor Counter using Arduino A bidirectional visitor counter using Arduino may be a reliable circuit that takes over the task of counting variety of Persons/Visitors within the Room very accurately. if somebody enters into the space then the Counter is incremented by one and also leaves it might be incremented. MATERIALS REQUIRED: Arduino IR Module 16*2 LED 5V Relay Resistor(1K,220 ohm) Breadboard Jumper Wires The total number of persons inside the space is Shows on the 16X2 LCD module. The microcontroller does the work it receives the signals from the sensors, and this signals operated under the control of software which is stored in EPROM of Arduino. There are two IR Modules are used. first, one are often wont to count the amount of persons entering a hall within the up mode at the doorway gate. and therefore the other can count the amount of persons leaving the hall by decrementing the count at the exit gate. In this Project will helps to Wastage of electricity. In ou