How to Build Obstacle Avoiding Robot for Beginners With Arduino Tutorial




About: My name is Matthew and I attend the University of Pittsburgh. Currently I am a senior, going for a bachelors in Information Science with a minor in CS. Current interests include augmented reality, virtual re...

This Tutorial is for anyone getting started with arduino. We will be building an obstacle avoiding robot that uses an ultrasonic HC SR-04 sensor to detect objects and 2 continuous (360 degree) servos wired to an external battery supply. This project uses an Arduino Uno without motor shield. The code is not mine, but not sure who to give credit to as I combined about 4 different sketches I found online.

Comment with any questions and sorry I said UMMM about 3000 times, I get nervous on camera...

All parts and code can be found here :

CH340g driver for chinese arduino uno can be downloaded here:

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1:

Be the First to Share


    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest

    26 Discussions


    3 years ago

    hey .. very nice vedio ..can i have the program plz i checkde with the link that you have mentioned bt unable to get the code

    1 reply

    Reply 3 years ago

    Sorry about that just fixed the link, it's not pretty but it works for now.


    3 years ago

    I made the robot and it worked finally :) BUT now I went to use it again after it sat for 4 or 5 days and I went to show it to someone, and it only goes in circles. Can you maybe explain to me what I did wrong that this could happen? Thank you so much.

    1 reply

    Reply 3 years ago

    Yeah my bad, I should have mentioned somewhere to undo the power wire while its sitting I think the battery may have slowly drained. Change the batteries and it should work again no problem.


    Reply 4 years ago

    You can but you would need geared DC motors and you would have to connect the to the board through a motor shield or an h bridge set up

    I do not believe those servos will work, they need to be labeled continuous or 360 degree to work for this tutorial. However, with some modification you can make it rotate continuously to work for this tutorial. Check this out

    sorry it worked only once and now servos are not moving when changed with180 degree once they workrd but when i connect 360 degree once they are not working