Automatic Obstacle-Avoiding Robot
An Automatic Obstacle-Avoiding Robot is a small robotic vehicle that can detect obstacles in its path and automatically change its direction. The robot uses an Arduino as the main controller and an ultrasonic sensor to measure the distance between the robot and an obstacle. When an obstacle is detected, the robot stops, moves backward, and rotates right before continuing its movement.
The project demonstrates the basic concepts of robotics, sensors, motor control, and Arduino programming.
Supplies
- Deshbot shield
- Arduino Nano
- HC-SR04 Ultrasonic Sensor
- Motor terminal
- 2 DC Motors
- LED(inbuild)
- Battery
- Robot chassis
Working:
The ultrasonic sensor continuously measures the distance in front of the robot.
- If the distance is 30 cm or more, the robot moves forward for 1 second and then stops for 0.3 seconds.
- If an obstacle is detected at less than 30 cm, the robot:
- Stops.
- Moves backward for 2 seconds.
- Stops for 0.3 seconds.
- Rotates right for 1 second.
- Stops for 4 seconds.
- Then checks the distance again.
The WS2812B LED indicates the robot's movement:
- 🟢 Green = Robot moving
- 🔴 Red = Robot stopped