In this tutorial, you will learn how to build a robot car which will avoid the obstacles present in its path. The concept can be used and applied in various ways according to the conditions.
Pre-requisite: Arduino programming, bread board connections, ultrasonic sensor, basic electronics.
Bread Board x 1
Aruino Uno x 1
Ultrasonic sensor x 1
DC motors x 2
Jumper cables x 10
Chassis and wheels
Step 1: About Arduino
Arduino is an open-source electronics platform based on easy-to-use hardware and software. Arduino boards are able to read inputs - light on a sensor, a finger on a button, or a Twitter message - and turn it into an output - activating a motor, turning on an LED, publishing something online. You can tell your board what to do by sending a set of instructions to the microcontroller on the board. To do so you use the Arduino programming language (based onWiring), and the Arduino Software (IDE), based on Processing.
Step 2: Theory & Data Collection of Ultrasonic
The robot works on four main aspects: data collection, data interpretation and modulation, logic designing and execution.
The data collection is done with the use of ultrasonic sensor. The ultrasonic sensor has a signal generator and a receiver. The signal generator generates an ultrasonic wave and transmits in the forward direction. The transmitted wave strikes any obstacle in its path and a huge part of it gets reflected. The receiver receives the reflected wave.
Data interpretation and modulation:
The obtained values from the ultrasonic sensor need to be calibrated in order to get a meaningful data (distance). The distance of the object is calculated on the basis of the time taken by the wave in the process of transmission, reflection and collection. The speed of the wave is known (equal to the speed of sound= 330m/s). Also the time taken is known (found by the ultrasonic sensor). We know that, Speed=distance/time Therefore distance= speed*time The obtained distance will be twice the distance between the sensor and the object. So by dividing the distance by a factor of 2, we will get the required distance.
Step 3: Logic Designing & Execution
The main heart of the system is the arduino. The interpreted data (distance) is calculated in the previous step and now it needs to be used to design the logic of the system.
To avoid the obstacle in the path, a condition is put in the system which says: if the distance between the robot and the object gets below a certain level, turn the robot car into other direction and continue. This logic is applied to the system using basic C programming which is used in arduino.
We now have the conditions set up for the robot car. But it needs to be executed/implemented on the hardware. The hardware used is the DC motor.
Two motors are used in this process: left motor and right motor. To move the robot car forward, both the motors are turned on. To turn the robot car to avoid obstacle, one of the motor is turned off for a while, keeping the other motor on.
Step 4: Code & Circuit Design
Here is code and the circuit design for the project.
Step 5: Complete Robot