This instructable is the written version of my “Arduino: How To Build An Obstacle Avoiding Robot” Youtube video that I’ve uploaded recently. I strongly recommend you to check it out.
So, without further ado, Let’s get started !
The first step and the base of any robot is a chassis. I made my own chassis by using acrylic sheet. The chassis has to include a body, two motors and sometimes even a battery holder and a switch.
Micro-controller (Brain of electronics)
Now we need something that will guide our motors, a micro-controller.
We will use Arduino Uno. Why?
Well, the answer is simple. Arduino (or, specifically, Arduino Uno) is a compact, comfortable and relatively cheap micro-controller. In addition, it is very common and you can get it literally everywhere online.
Now simply use some screws to attach the Arduino to the chassis or use double sides tape for the same as per availability .
In Order to make a robot that can maneuver by its own we need some sort of an input, so it can “know” or “judge” what to do. a very comfortable sensor that fits our goal (avoiding obstacles) is the HC-SR04 ultrasonic sensor.
Scientific Explanation Of the sensor’s action:
What the sensor does it is calculating the distance from an object by sending bursts of ultrasound towards it and measuring the time it takes to the sound waves to get back (Distance = Velocity * Time). we can use this information in order to determine whether there’s a close “obstacle” near the robot and then- avoid it !
So now you know how an ultrasonic sensor work, Scientifically. Now, Let’s use it !
Wiring up Arduino Uno and Sensor
Sensor pins Arduino pins
Connecting Arduino uno with motors
I am using Motor shield in order to connect Arduino Uno to DC motors (which will help the robot to travel anywhere).
This is the way to attach shield to Arduino Uno.
Now connect Motor outputs and power terminals on given pins