“In this instructable, I will teach you how to make an obstacle avoiding robot that works with Arduino.You must be familiar with Arduino. Arduino is a controller board which uses the atmega microcontroller. You can use any version of Arduino but I have used the Arduino Uno r3 on my robot.
The code is very easy and the circuit has only 4-5 wires. The robot also uses the L293D motor shield which is Arduino compatible, to drive the motors. So, the shield fits straight onto Arduino, making everything easy… Basically, our robot is a car which moves forward and if any obstruction comes in its path, it stops there, moves a bit back, and then its head rotates left and right. Then it compares the distance and the robot turns in the direction with more distance. Then the robot again moves forward in that direction repeating the whole process again. To detect the distance, the robot uses the HC-sr04 ultrasonic sensor. So this sensor sends ultrasonic sound waves, every 10 microseconds, and if any obstruction is ahead, the sensor receives the echo. Based on the travel time, it knows the distance between the sensor and the object. So let’s start…”