Menu
Close
SIGN IN REGISTER
Forgot password?
Close
Cart
21.07.2023

Arduino Obstacle Avoiding Robot

Arduino Obstacle Avoiding Robot Construction

 

In this blog post, we will discuss how to build an obstacle avoiding robot kit using Arduino Uno.

 

What is an Obstacle Avoiding Robot?

 

An obstacle avoiding robot prevents a moving vehicle from colliding with obstacles by controlling its surroundings with sensors. According to your software, it determines its own path without colliding with obstacles. Sensors like Hc-sr04 or Mz80 are ideal for this project. We will use hc-sr04 in our project.

 

Required Materials

 

 

Circuit Diagram

Obstacle Avoiding Vehicle Connection Diagram

 

Arduino Codes

#define echoPin 12 //Echo pin of the Ultrasonic sensor connected to pin 12 of Arduino
#define trigPin 13 //Trig pin of the Ultrasonic sensor connected to pin 13 of Arduino
#define MotorR1 7
#define MotorR2 6
#define MotorRE 9 // Define motor pins
#define MotorL1 5
#define MotorL2 4
#define MotorLE 3
long duration, distance; // Define two variables for duration and distance
void setup() {
// Since the ultrasonic sensor sends waves from the Trig pin, it is defined as OUTPUT,
// and since it receives these waves from the Echo pin, it is defined as INPUT.
pinMode(echoPin, INPUT);
pinMode(trigPin, OUTPUT);
pinMode(MotorL1, OUTPUT);
pinMode(MotorL2, OUTPUT);
pinMode(MotorLE, OUTPUT); // Define our motors as output.
pinMode(MotorR1, OUTPUT);
pinMode(MotorR2, OUTPUT);
pinMode(MotorRE, OUTPUT);
Serial.begin(9600