Header Ads

Header ADS

Easily Make A Obstacle Avoid Robotics Car At Home for School/Collage/University Project

Easily Make An Obstacle Avoid Robotics Car At Home for School/Collage/University Project


Every electronic device needs PCBs. Are you looking for the Best PCB order? PCBWay is one the best PCB manufacturing companies. Order 10 pcs PCB for only $5. Visit now https://www.pcbway.com/?from=technology4power


Looking for an exciting robotics project for your school, college, or university? We have just the thing for you! In this comprehensive guide, we'll show you how to easily create an obstacle-avoidance robotic car at home. This hands-on project combines the thrill of building with the wonders of technology, using the versatile Arduino Uno microcontroller board. Get ready to dive into the world of robotics and impress your peers with your DIY skills!

Section 1: Understanding the Project

1. Discover the concept of obstacle avoidance robotics and its real-world applications.

2. Learn about the essential components required for this project.

3. Get acquainted with the Arduino Uno microcontroller and its capabilities.

Section 2: Gathering the Materials

1. A detailed list of all the components and materials you'll need.

2. Tips on where to find the necessary parts at affordable prices.

3. Alternative options for specific components, based on availability.

Section 3: Building the Robotic Car

1. Step-by-step instructions on assembling the chassis, wheels, and motor.

2. Wiring the components and connecting them to Arduino Uno.

3. Detailed illustrations to ensure accurate construction.

Circuit Diagram


Every electronic device needs PCBs. Are you looking for the Best PCB order? PCBWay is one the best PCB manufacturing companies. Order 10 pcs PCB for only $5. Visit now https://www.pcbway.com/?from=technology4power


Section 4: Programming the Robot

1. Introduction to the Arduino programming language (based on C/C++).

2. Writing code for obstacle detection using ultrasonic sensors.

3. Implementing motor control commands to ensure smooth navigation.

Code:

#include <Servo.h>          //Servo motor library. This is standard library
#include <NewPing.h>        //Ultrasonic sensor function library. You must install this library

//our L298N control pins
const int LeftMotorForward = 7;
const int LeftMotorBackward = 6;
const int RightMotorForward = 4;
const int RightMotorBackward = 5;

//sensor pins
#define trig_pin A1 //analog input 1
#define echo_pin A2 //analog input 2

#define maximum_distance 200
boolean goesForward = false;
int distance = 100;

NewPing sonar(trig_pin, echo_pin, maximum_distance); //sensor function
Servo servo_motor; //our servo name


void setup(){

  pinMode(RightMotorForward, OUTPUT);
  pinMode(LeftMotorForward, OUTPUT);
  pinMode(LeftMotorBackward, OUTPUT);
  pinMode(RightMotorBackward, OUTPUT);
  
  servo_motor.attach(10); //our servo pin

  servo_motor.write(115);
  delay(2000);
  distance = readPing();
  delay(100);
  distance = readPing();
  delay(100);
  distance = readPing();
  delay(100);
  distance = readPing();
  delay(100);
}

void loop(){

  int distanceRight = 0;
  int distanceLeft = 0;
  delay(50);

  if (distance <= 20){
    moveStop();
    delay(300);
    moveBackward();
    delay(400);
    moveStop();
    delay(300);
    distanceRight = lookRight();
    delay(300);
    distanceLeft = lookLeft();
    delay(300);

    if (distance >= distanceLeft){
      turnRight();
      moveStop();
    }
    else{
      turnLeft();
      moveStop();
    }
  }
  else{
    moveForward(); 
  }
    distance = readPing();
}

int lookRight(){  
  servo_motor.write(50);
  delay(500);
  int distance = readPing();
  delay(100);
  servo_motor.write(115);
  return distance;
}

int lookLeft(){
  servo_motor.write(170);
  delay(500);
  int distance = readPing();
  delay(100);
  servo_motor.write(115);
  return distance;
  delay(100);
}

int readPing(){
  delay(70);
  int cm = sonar.ping_cm();
  if (cm==0){
    cm=250;
  }
  return cm;
}

void moveStop(){
  
  digitalWrite(RightMotorForward, LOW);
  digitalWrite(LeftMotorForward, LOW);
  digitalWrite(RightMotorBackward, LOW);
  digitalWrite(LeftMotorBackward, LOW);
}

void moveForward(){

  if(!goesForward){

    goesForward=true;
    
    digitalWrite(LeftMotorForward, HIGH);
    digitalWrite(RightMotorForward, HIGH);
  
    digitalWrite(LeftMotorBackward, LOW);
    digitalWrite(RightMotorBackward, LOW); 
  }
}

void moveBackward(){

  goesForward=false;

  digitalWrite(LeftMotorBackward, HIGH);
  digitalWrite(RightMotorBackward, HIGH);
  
  digitalWrite(LeftMotorForward, LOW);
  digitalWrite(RightMotorForward, LOW);
  
}

void turnRight(){

  digitalWrite(LeftMotorForward, HIGH);
  digitalWrite(RightMotorBackward, HIGH);
  
  digitalWrite(LeftMotorBackward, LOW);
  digitalWrite(RightMotorForward, LOW);
  
  delay(500);
  
  digitalWrite(LeftMotorForward, HIGH);
  digitalWrite(RightMotorForward, HIGH);
  
  digitalWrite(LeftMotorBackward, LOW);
  digitalWrite(RightMotorBackward, LOW);
 
  
  
}

void turnLeft(){

  digitalWrite(LeftMotorBackward, HIGH);
  digitalWrite(RightMotorForward, HIGH);
  
  digitalWrite(LeftMotorForward, LOW);
  digitalWrite(RightMotorBackward, LOW);

  delay(500);
  
  digitalWrite(LeftMotorForward, HIGH);
  digitalWrite(RightMotorForward, HIGH);
  
  digitalWrite(LeftMotorBackward, LOW);
  digitalWrite(RightMotorBackward, LOW);
}

 

Video Tutorial:


Every electronic device needs PCBs. Are you looking for the Best PCB order? PCBWay is one the best PCB manufacturing companies. Order 10 pcs PCB for only $5. Visit now https://www.pcbway.com/?from=technology4power



Section 5: Testing and Troubleshooting

1. Tips for testing your robot's functionality and identifying potential issues.

2. Common troubleshooting techniques and solutions.

3. Debugging strategies to overcome programming and hardware challenges.

Section 6: Taking It Further

1. Suggestions for expanding and customizing your robotic car project.

2. Exploring advanced features such as line following or Bluetooth control.

3. Recommendations for additional resources and further learning opportunities.


Conclusion: 

Congratulations! You have successfully built an obstacle-avoidance robotic car using Arduino Uno. This engaging project has not only honed your technical skills but also deepened your understanding of robotics and programming. Whether you're a student or an enthusiast, this project showcases your creativity and passion for hands-on learning. Don't forget to document your progress, share your experiences, and inspire others with your achievement. Stay curious, keep exploring, and unlock a world of possibilities with DIY robotics!


Remember to subscribe to our blog for more exciting projects, tutorials, and updates. Join our community of like-minded individuals and continue your journey in the fascinating realm of robotics. Start building your obstacle-avoidance robotic car today and make an impact with your ingenuity and innovation!


No comments

Theme images by Bim. Powered by Blogger.