loading

This instructable is the written version of my "Arduino: How To Build An Obstacle Avoiding Robot" Youtube video that I've uploaded recently. I strongly recommend you to check it out.

My YouTube Channel. Please Subscribe for Support


So, without further ado, Let's get started !

Step 1: Video Tutorial : Just 6 Minutes - Watch and Make...

Arduino Tutorial : How To Build An Obstacle Avoiding Robot

Watch carefully

Step 2: Materials : Necessary Materials and Equipments

* Arduino Uno R3

* Adafruit Motor Shield

*HC-SR04 Ultrasonic Module Distance Sensor for Arduino

* Tower Pro SG90 RC Mini Servo Motor

* Bracket / Holder for HC-SR04

* DC Motors and Wheels

* Bovine Wheel

* Plate or something like that

* Jumper

* Battery Buckle 9V

* Battery 9V

* Glue Gun or Cable Ties

Step 3: A Chassis and Sensor Connections

A Chassis

Attaching The Arduino To The Chassis

Connecting The Sensor To The Arduino

Step 4: Motors and Motor Shield Connections

Attaching The Motor Shield To The Ardunio

Connecting Motors To The Shield

Step 5: Programming the Robot

Step 6: For Me + What's Next ?

First of all, I would like to thank you for reading this guide ! I hope it helped you build your own robot and improved your knowledge about robotics and arduino.

I think now it's a good time to introduce myself. My name is Mert . Likes Math, Computers, Robotics and programming. I've just started a youtube channel, hoping to help people, share some of my knowledge and learn myself.

My YouTube Channel

My next Youtube (and Instructables) tutorials will deal with different methods of controlling electronics (Smartphone-Bluetooth control, remote control and much more) and specifically robots. There will also be videos about home automation (controlling every day appliances with your smartphone or computer using arduino). so make sure you are a subscriber so you won't miss them, and I will see you next time.

Bye !

<p>Your program is giving errors it is not working correctly.</p><p>please check it positively.</p>
<p>Why do you think it's not correct? Maybe you made a mistake! If you are getting an error, first share the error. Maybe then I can help you.</p>
<p>can u give me the code on text pad </p>
<p>You can copy from here: http://mertarduinotutorial.blogspot.com.tr/2016/12/arduino-project-tutorial-01-obstacle.html</p>
<p>thanks!</p>
Sir here are the errors.
<p>if needed i wil help you </p><p>pleace tell me what boards you use and if you exact connect it like the IBLE.</p><p>make pictures ,please.</p><p>its not difficult, i know that's easy to say, but if you let me help. we will get it done.</p><p>and let me tell you this, (i wil even let your motors make a party sound, watch me) you will all understand it when we go do it. hahahaha.</p><p>some of the people here know exactly what i mean. (its music to my ears.)</p><p>And look at mine, O YES its a Police robot with front and back lights </p><p>he is called KNIGHTRIDER.</p><p>WannaDuino!!!</p>
<p>Congratulations for your work. But I helped my followers. Just like I helped you. ;)</p><p>This comment has been a bit disrespectful. :/</p><p> I think you should open an instructables account, you can share your work from your own account.</p>
<p>You sent 5 different codes. They all made an error! Where's my code? And why are there 5 codes? Download my code again! Do what I told you before and upload it! Do not forget to install NewPing and AFMotor.h libraries. And do not run my code directly! Just copy it. Then open a new page in Arduino and paste it. Connect the robot, choose which port you have connected and upload it!</p>
<p>Thank you so much,</p><p>I MADE IT!!!!</p><p>WannaDuino!!! made it. YES.</p><p>And not like you told, by blank screen and copy your code in it.</p><p>i added the LIBRAIRYS to mine, and then opened the scketch code of you.</p><p>and it finaly works. But not 100% but it rides and somtimes banges up to somthing, but that i wil look after tommorow.</p><p>I just wanted you to tell this GOOD IBLE news friend.</p><p>WannaDuino!!!</p>
<p>Congratulations. I hope it helps ;)</p>
See sir
<p>Only the rotation of the wheels may not be equal. If this is the case, it is enough to replace the DC motor connections in the motor shield.</p>
Sir please help me I really need to know
<p>Connections seem right. Is there any problem?</p>
5&amp;6
4
3
2
Sir in the 2nd step you wrote install arduino libraries , does that mean the af Motor and new ping 7 or something else ?
<p>If you installed libraries, you can try. If you get any errors write me again.</p>
Do I install your code as a library?
It happened even after following your instructions. Sir my project is due in 2 weeks so please help me.
<p>If there is a continuation of the error code, send it as well. If it's just that; Copy the whole code and close the IDE window. Then open the Arduino IDE again. Open a new window. Delete the contents. And paste the code. Make sure the COM entry is correct. (For example COM5 - COM8 and so on). Finally, upload the code. Use Windows 10? Did you download the Arduino program from the Windows market or is the arduino from its official website?</p>
<p>And check following;</p><p>I will explain step by step. I hope it helps.</p><p>1) It is already installed on the Arduino IDE</p><p>2) First Install the Arduino Library.</p><p>2.1) Before you can use the Motor shield, you must install the AF_Motor Arduino library.</p><p>a) First, grab the library from github : <a href="https://codeload.github.com/adafruit/Adafruit-Motor-Shield-library/legacy.zip/master">https://codeload.github.com/adafruit/Adafruit-Motor-Shield-library/legacy.zip/master</a></p><p>b) Uncompress the ZIP file onto your desktop</p><p>c) Rename the uncompressed folder AFMotor</p><p>d) Check that inside AFMotor is AFMotor.cpp and AFMotor.h files</p><p>e) Place the AFMotor folder into your arduinosketchfolder/libraries folder. For Windows, this will probably be something like MY Documents/Arduino/libraries for Mac it will be something likeDocuments/arduino/libraries. If this is the first time you are installing a library, you'll need to create the libraries folder. Make sure to call it libraries exactly, no caps, no other name.</p><p>f) Check that inside the libraries folder there is the AFMotor folder, and inside AFMotor isAFMotor.cpp AFMotor.h and some other files</p><p>g) If open Arduino IDE pls quit.</p><p>2.2) You must install the NewPing.h library.</p><p>a) Download v1.7 : <a href="https://bitbucket.org/teckel12/arduino-new-ping/downloads">https://bitbucket.org/teckel12/arduino-new-ping/downloads</a></p><p><br>b) Uncompress the ZIP file onto your desktop</p><p>c) NewPing Folder copy and paste in libraries folder</p><p>3) My code edit and use</p><p>a) Download my Arduino code : <a href="https://drive.google.com/drive/folders/0B8SAF49tU-QoVkc5VTVONDRZZ3M">https://drive.google.com/drive/folders/0B8SAF49tU-QoVkc5VTVONDRZZ3M</a></p><p>b) Open the Arduino IDE and Create New Page. Delete everything in the page. Keep empty page</p><p>c) Open downloaded code (my code) in different page. Copy my code and paste in opens you to the previous page (empty page)</p><p>d) Save as and quit IDE.</p><p>e) Open IDE (It would probably be the last display saved pages)</p><p>f) You should see now active in the dark and red tones (afmotor.h and newping.h)</p><p>e) Now Upload to Arduino</p>
Like this ?
<p>I'm warning you! bare wires should not be touch each other! You need to work more carefully. It can damage the Arduino.</p><p>When you solve the problem would be correct connections.</p>
<p>look</p><p>almost only the codes/librairies?????? or so</p>
<p>Congratulations. I like it ;)</p>
i need HELP<br>how to code it <br>pleace help<br>how and in wat way to get it running with your code and librairy<br>how exactly do i put it in arduino IDE<br>i am new to this.
<p>I will explain step by step. I hope it helps.</p><p>1) It is already installed on the Arduino IDE</p><p>2) First Install the Arduino Library. </p><p>2.1) Before you can use the Motor shield, you must install the AF_Motor Arduino library.</p><p>a) First, grab the library from github : <a href="https://codeload.github.com/adafruit/Adafruit-Motor-Shield-library/legacy.zip/master">https://codeload.github.com/adafruit/Adafruit-Motor-Shield-library/legacy.zip/master</a> </p><p>b) Uncompress the ZIP file onto your desktop </p><p>c) Rename the uncompressed folder AFMotor </p><p>d) Check that inside AFMotor is AFMotor.cpp and AFMotor.h files </p><p>e) Place the AFMotor folder into your arduinosketchfolder/libraries folder. For Windows, this will probably be something like MY Documents/Arduino/libraries for Mac it will be something likeDocuments/arduino/libraries. If this is the first time you are installing a library, you'll need to create the libraries folder. Make sure to call it libraries exactly, no caps, no other name. </p><p>f) Check that inside the libraries folder there is the AFMotor folder, and inside AFMotor isAFMotor.cpp AFMotor.h and some other files </p><p>g) If open Arduino IDE pls quit.</p><p>2.2) You must install the NewPing.h library.</p><p>a) Download v1.7 : <a href="https://bitbucket.org/teckel12/arduino-new-ping/downloads">https://bitbucket.org/teckel12/arduino-new-ping/downloads</a></p><p><br>b) Uncompress the ZIP file onto your desktop </p><p>c) NewPing Folder copy and paste in libraries folder</p><p>3) My code edit and use</p><p>a) Download my Arduino code : <a href="https://drive.google.com/drive/folders/0B8SAF49tU-QoVkc5VTVONDRZZ3M">https://drive.google.com/drive/folders/0B8SAF49tU-QoVkc5VTVONDRZZ3M</a> </p><p>b) Open the Arduino IDE and Create New Page. Delete everything in the page. Keep empty page </p><p>c) Open downloaded code (my code) in different page. Copy my code and paste in opens you to the previous page (empty page) </p><p>d) Save as and quit IDE. </p><p>e) Open IDE (It would probably be the last display saved pages) </p><p>f) You should see now active in the dark and red tones (afmotor.h and newping.h) </p><p>e) Now Upload to Arduino</p>
Image1- When I connect the sensor and Motor shield to UNO board. Image2- When I connect Motor shield to UNO board on one side the needles are put in properly. Image3- the needs are not pout in properly. Is that normal ?
<p>It's a great idea, but not helpful. Now, you must cut off the end of the wire. So you should cut the cable headers you want to attach to the motor drive. Then peel off the end of a small amount of wires. Connect in this way the cables to motor drive.</p><p>Be sure to watch the video carefully.</p><p>like these</p>
I am an absolute beginner for robotics and I only know how to code scratch. So for the code can I just open the file in arduino ide app on my pic and program it ?
<p>sir i would like to ask for your email for a lot of questions if you won't mind sir. Just an 18 year old student, still new to arduino projects. Thank you so much sir.</p>
<p>bilgi.programci@gmail.com</p>
<p>excure me !!!</p>
<p>Please try the followings;</p><p>- Install the required libraries (Please check)</p><p>- Open the Arduino editor (New / Empty page)</p><p>- After download the my code</p><p>- Downloaded code open different page. Copy code and paste in new (empty) page</p><p>- Save as and quit (restart)</p><p>- Open the editor again and upload code</p><p>If all connections true, this will be the solution</p><p>Write again if it does not work. Good luck with</p>
<p>I added AFmotor to libraries but It still error. Please ,help me !!! </p>
<p>Great beginner robotics project!</p>
<p>Thank you so much..</p>
<p>One friends left comment as below;</p><p><strong>&quot; this code show error please verify your code , help me &quot;</strong></p><p>If have a problems like that !</p><p>Please try the followings;</p><p>- Install the required libraries (Please check)</p><p>- Open the Arduino editor (New / Empty page)</p><p>- After download the code</p><p>- Downloaded code open different page. Copy code and paste in new (empty) page</p><p>- Save as and upload Arduino Uno</p><p>If all connections true, this will be the solution</p>
<p>Problem solved ... Be sure to install the library</p>
<p>That is a cool little bot, I will have to make one.</p>
<p>Thanks for your comment</p>

About This Instructable

9,876views

161favorites

License:

Bio: I've just started a youtube channel, hoping to help people, share some of my knowledge and learn myself. My next Youtube (and Instructables) tutorials ... More »
More by MertArduino:Arduino - Make a Low Cost Robotic Hand with Wireless Controlled (using nRF24L01) Arduino - Make a Robotic Hand (Low Cost) Arduino - Make a Flex Sensor for Robotic Hand (Cheap and Simple) 
Add instructable to: