I Built This Autonomous Robot to Detect and Avoid Obstacles. The Code is Included.

This is a simple autonomous robot able to detect and avoid obstacles. I use a cheap 4WD robot platform (You can use any of these platforms), an Arduino UNO($18.59 on Amazon), and a cheap HC-SR04 sensor (2 pieces at $2.83 on Amazon).

The robot is programmed to drive forward till an obstacle is detected. Then it turns the sensor left and right. Compare the values returned by the ultrasonic sensor and take a decision.

This is the Arduino code:

And this is how the robot navigates autonomously in my kitchen:

8 comments » Write a comment

  1. Hello. Thank you for this. Can you tell me the component you used to move the sensor from side to side. I have found some online but they seem quite expensive?

Leave a Reply to Dave P. Cancel reply

Required fields are marked *.