Introduction: Obstacle Avoider Bot Using Arduino UNO & Ultrasonic Sensor
This is an obstacle avoider bot made using Arduino Uno and ultrasonic sensor.
Working of an Ultrasonic Sensor: The ultrasonic sensor has 4 pins, Vcc,GND, Trigger Pin and the Echo Pin. The trigger pin trigger ultrasonic sound waves and the Echo pin receives the sound wave that comes after deflecting from the obstacle, It has a range from 2cm to 4m. The duration the wave takes to go and come back after reflection is converted to distance by the mathematical formula given by d=t/58.2 where d=distance in cm and t=time in microsecs.
Step 1: Materials Required
1) Arduino Uno
2) Ultrasonic Sensor
3) L293D Motor Driver
6) 2 BO Motors
7) Chassis, etc.
Step 2: Connection
1) The Trigger pin of the Sonar sensor was connected to Digital Pin 3 of the microcontroller and the Echo pin to Digital Pin 2. The Vcc to 5V and GND to GND of the Arduino.
2) The L293D motor driver had inputs for the left BO motor from pins 4,5 (PWM) and for the right BO motor pins 6,9 (PWM). The outputs were connected to the two BO motors respectively. The 5V pin of the L293D motor was connected to 5V of arduino. The GND and 12V pins were connected in series to the two wires coming from the adapter (+ve for 12V and -ve for GND) on the bread board.
Step 3: The Code
You can find the code here: