Obstacle Avoiding Robotic Vehicle

1,798

25

Posted

Introduction: Obstacle Avoiding Robotic Vehicle

This robotic vehicle project was designed so that it can intelligently avoid obstacles in its path.
The avoidance algorithms are encoded using the Arduino computing platform. This project is a marriage of software, hardware, mechanical components, and design.

Step 1: ​List of Required Materials

Cut to Size Plastic Board to Build Vehicle Frame

Arduino Uno Microcontroller Board

Motors *2

Wheels *2

Ultrasonic sensor

Nuts and Bolts

DuPont Wires

Omnidirectional wheel

Batteries

Battery holder

Step 2: Assembling

  1. Cut your board into a shape of a car and attach the Arduino
    board on the top side of the board and the two motors and battery holder on its back.

  2. Add wheels to the motors. Afterward, put your omnidirectional wheel at the front of the vehicle. Then connect the wheels and motors to the Arduino via the DuPont wires.

  3. Connect the ultrasonic sensor to the car and link it to Arduino controller

  4. Note that the motor’s VCC should be linked on pins #5 and #6 and its direction is linked to pins #4 and #7. For the ultrasonic sensor, its echo should be attached to pin #2 and trig is linked to #1

Step 3: Code

  • Program the Arduino by loading the following code onto the chip.

  • Insert batteries and watch the vehicle navigate to avoid obstacles in its way.

long block;

float checkdistance_2_3() {

digitalWrite(2, LOW);

delayMicroseconds(2);

digitalWrite(2, HIGH);

delayMicroseconds(10);

digitalWrite(2, LOW);

float distance = pulseIn(3, HIGH) / 58.00;

delay(10);

return distance;

}

void setup()

{

Serial.begin(9600);

pinMode(4, OUTPUT);

pinMode(7, OUTPUT);

block = 0;

digitalWrite(4,LOW);

digitalWrite(7,HIGH);

analogWrite(5,125);

analogWrite(6,125);

pinMode(2, OUTPUT);

pinMode(3, INPUT);

}

void loop()

{

block = checkdistance_2_3();

Serial.println(block);

if (block < 25) {

digitalWrite(4,LOW);

delay(700);

digitalWrite(7,LOW);

}

if (block >= 25) {

digitalWrite(4,HIGH);

digitalWrite(7,HIGH);

}

}

Share

    Recommendations

    • Microcontroller Contest

      Microcontroller Contest
    • Science of Cooking

      Science of Cooking
    • Trash to Treasure

      Trash to Treasure
    user

    We have a be nice policy.
    Please be positive and constructive.

    Tips

    Questions

    Comments