How to Make an Obstacles Avoiding Robot- Arduino Style

 by robotkid249
IMG_1279.jpg
You've always wanted to make one of those cool robots that can basically avoid any object. Yet you didn't have enough money to buy one of those really expensive ones, with already cut parts where all the materials where there for you. If you're like me you like to use some parts you already have around, like scrap metal and plastic. This is the project for you.

Check out my new project on sending a balloon into space!!
http://www.instructables.com/id/My-Space-Balloon-Project-Stratohab-Success-High/

Step 1: Get the Materials

pRS1C-4174483w345.jpg
Arduino- which you can get at the maker shed
http://www.makershed.com/ProductDetails.asp?ProductCode=MKSP4

Then you'll need a Ping UltraSonic Sensor which you'll find at most radioshack stores...
http://www.radioshack.com/product/index.jsp?productId=2909789

A base and scrap metal or plastic that you have lying around.

Some extra wires.

Some cheap mounting tape from Walgreens or the dollar store.

Two Futaba S3003 servos.

Some lego wheels -4 of them ......or other small wheels.

Also a rechargeable battery. (The only reason is that the servos use a lot of energy.

Now your all set to go!

Step 2: Making your Servos Move 360 degrees

So you have your servo's great! Now twist the the external spoked plastic thing.... Wow! It only goes 180 degrees what are we going to do about that?

We're gonna make it move all of the way around....

Basically changing some of the mechanics inside it.
Follow this tutorial and get your servo to go all of the way around and you can go to the next step!

Hacking Some Servos

This should give you two perfectly, well yea, they move all the way around.

Step 3: Putting it all together

IMG_1285.jpg
IMG_1282.jpg
IMG_1286.jpg
Use some of the very sticky mounting tape and put it onto the piece of metal, like this. Also do this to the lego wheels.

Then attach the (giant) in my case battery to the top of the metal. Then place the Ping sensor into a piece of pcb and make it with the end of the servo you cut off and now you have most of it done.

Then attach the Arduino on top of the battery. For a little size comparison here is how large this robot should be....

Step 4: Attach the electronics.

Simple put if you would like to put a breadboard or circuit board on top to make this easier.

1. Attach both servo red wires (+) to (+) on arduino.
2. Attach both servo black wires (-) to GND on arduino.
3. Attach a wire you can solder on to the PING sensor, that is positive to positive on arduino.
4. Then the negative to the negative.
5. The signal wire on the ping goes to digital 7 on arduino.
6. The left servo white wire goes to 5 and right servo white wire goes to 6.

Then upload to arduino using the Arduino environment which you can find info on here this code.
arduino.cc

Thanks you to the person who made his code here it is..

http://www.obscurereality.org/?p=45

YOU will also need to get the servo library whoch can be found here...
arduino.cc also

Thanks you for viewing this instructable and i hope some of you get to make this cool robot..
admin says: Feb 13, 2009. 11:44 AM
This is a great Instructable, but you need to add a main image of the final project to the intro step. Please do that and leave me a message when you have so that we can publish your work. Thanks!
ride on toy dude says: Aug 9, 2012. 10:20 AM
Or you could buy continuous rotation servos at radio shack for $12 apiece. These puppies have an H-Bridge inside them so that you don't need a motor shield.
Cello62 says: Jan 17, 2012. 6:27 AM
Hello
Post the code pls!!! The link doesn't works.
Thanks
kamid99 says: Nov 4, 2011. 11:03 AM
Would this be a good science project for a 7th grader??
olivier12125 says: Sep 2, 2010. 4:10 PM
hey the code on the site is also with other components so can you post yours
pgurudatt in reply to olivier12125Oct 11, 2011. 11:06 PM
Can you plz show the wiring of your robot . I havea competition in two days. can you wire dc motors and write the same programe and logic for that,?
robotkid249 (author) says: May 22, 2011. 7:16 PM
http://www.instructables.com/answers/Would-You-Guys-Like-a-Wireless-Power-Kit/
computerlover says: Dec 14, 2010. 5:50 PM
I am still having problems with the code. I changed everything I could and uploaded the libraries. If you could upload working code that would be greatly appreciated!
robotkid249 (author) says: Jul 1, 2009. 12:56 PM
Replace #include with #include
afw11 in reply to robotkid249Jul 1, 2009. 1:56 PM
Nope, it is still coming up with error: 'class Servo' has no member named 'refresh'. Did you run into this problem?
occrushmegamanx in reply to afw11Jul 10, 2009. 9:56 PM
: 'class Servo' has no member named 'refresh'. Did you run into this problem? How did you fix the problem because I have the same problem
afw11 in reply to occrushmegamanxJul 13, 2009. 2:10 PM
Yeah, I was really annoyed by that. To fix it you need to use the servo library and the software servo library.At the beginning of the code where it defines "Servo leftservo", change "Servo" into "Software Servo" You can download libraries from the Arduino website. Also, I would download the Arduino 0016 environment.
afw11 in reply to afw11Jul 3, 2009. 11:54 AM
Haha! I have fixed that problem, but now have a new one. If I plug in the power supply, the servos turn for a second and then stop. Also the ultrasonic sensor gets hot. What battery configuration did you use?
afw11 says: Jul 6, 2009. 8:13 AM
Thanks, that fixed it after I rebooted my computer. One quick question, what battery configuration did you use?
robotkid249 (author) says: Jun 30, 2009. 7:52 PM
afw11, on the top of the code where it says #include put the full library "phrase" for the servo. That should fix your problem.
afw11 in reply to robotkid249Jul 1, 2009. 5:59 AM
Soryry, I can't get to my computer where the program is stored to look at it, so how would I do that?
afw11 in reply to afw11Jul 1, 2009. 11:02 AM
What I mean is, how would that piece of code look like?
afw11 says: Jun 30, 2009. 6:04 PM
Ok, so I have the code, but every time I compile it the software comes up with this error; In function 'void moveServoLeftTo (int, int)' : error: 'class Servo" has no member named "refresh" In function 'void moveServoRightTo(int, int)' : I included the servo library, is there anything else I need to add?
robotkid249 (author) says: Jun 19, 2009. 6:30 PM
Wow these are easy questions any engineer should know. Red is positive. Black is negative. The only wires on the ping sensor besides signal are positive and negative. The battery goes to the arduino power input.
robotkid249 (author) says: Jun 18, 2009. 7:51 AM
The left servo goes to digital pin 6, and the right servo goes to 5. It is in the code, i think..
afw11 in reply to robotkid249Jun 19, 2009. 6:23 PM
OK that helps, but where does the battery hook up again? Where do the PING sensor wires go? Sig(nal) goes to digital 7 but where do the other ones go? Where do the black and red servo wires go?
afw11 says: May 30, 2009. 12:31 PM
(removed by author or community request)
afw11 in reply to afw11Jun 16, 2009. 1:54 PM
Also, where do you hook up the battery? Do you hook up the servo black wires to the same GND? Also, where do the the other servo wires go to? digital 5 and 6, or analog 5 and 7?
kheks says: Feb 21, 2009. 8:34 AM
dude i have a optical mouse which i no longer use . can i by any means use it to detect weather there is a obstacle in front .???
fynflood in reply to kheksMay 22, 2009. 10:39 AM
You can do this with an old ball mouse for sure.. It seems like I've seen someone hack an optical mouse to do this, but I can't dig it up.

That being said, here's the link to get you started using a ball mouse:
http://hackaday.com/2008/05/16/how-to-scavenge-a-mouse-for-parts/#more-1838
fynflood says: May 22, 2009. 10:31 AM
Hey, nice work... thanks for shout out too ;)
robotkid249 (author) says: Feb 21, 2009. 9:29 AM
That picture got messed up
R = reciever P = paper E = emiter

/// //////// ///
R--P---E
robotkid249 (author) says: Feb 21, 2009. 9:26 AM
YA theres prolly a ir receiver emitter where the scroll wheel is. Pull that out. When the infrared light reflects off a wall and goes to a receiver the arduino will know a wall is there.

Like this ////// ******
RE paper EM
To arduino pins
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!