Obstacle Avoiding Car

1,717

24

Posted

Introduction: Obstacle Avoiding Car

This car could avoid obstacles automatically and it is powered by Arduino.

Step 1: ‚ÄčList of Needed Materials

Board (cuttable)

Arduino Uno

Engines *2

Wheels *2

Ultrasonic senser

Bolts and Nuts

Dupont lines

Omni-directional wheel

Battery holder

Step 2: Assembling

  1. Cut your board into a shape of a car and attach the Arduino board on the up side of the board and the engines and battery holder on its back.
  2. Add wheels to the engines. Subsequently, put your omni-directional wheel at the front. Then link the wheels on your engines to the Arduino by the dupont lines.
  3. Hold your ultrasonic sensor on your car and link it to Arduino
  4. Note that engines' vcc should be linked on pin #5 and #6 and its direction is licked to #4 and #7. For ultrasonic sensor, its echo should be attached to pin #2 and trig is linked to #1

Step 3: Code

  • Add wheels to the steering engines. Subsequently, put your omni-directional wheel at the front. Then link the wheels on your engines to the Arduino by the dupont lines.

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

  • Epilog Challenge 9

    Epilog Challenge 9
  • Sew Warm Contest 2018

    Sew Warm Contest 2018
  • Gluten Free Challenge

    Gluten Free Challenge
user

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

Tips

Questions

Comments