This is a sequel, so to speak, of the 'Obstacle-Avoiding Robot with a Personality' instructable. In that instructable, I decided to call the robot 'BOB'. BOB had quite a few flaws and drawbacks, so I have now improved BOB in a few ways. (He? It?) now has better:

  • Stamina (improved power system)
  • 'Vision' (extra sensors)
  • 'Nerves' (connections are made more securely)
  • Brainpower (different microcontroller)

Bob now uses a switching regulator and a 9.6V RC battery for power, better sensor mounts, an extra GP2D12 IR sensor, a panning servo for the ultrasonic rangefinder, and an AVR ATmega168 microcontroller on an Arduino development board.

I have always loved building projects with microcontrollers, and what would be better than building a robot with one to showcase the microcontroller's fullest abilities!

Step 1: Parts List

Here's a list of what BOB comprises of, and where to get them:


  • 1x Futaba S3003 (Hobby Servo) - Hobbytown USA, Futaba.com
  • 2x Parallax Continuous Rotation Servos - Parallax.com, Acroname.com

Prototyping Hardware/Cables:

  • 1x 3-Wire Sensor Cable - Any online robotic parts reseller. I got mine from Trossenrobotics.com.
  • 4x 'Board Mounting Analog Jacks'. - I got these HERE. I think you can also get them from Digikey.
  • Breadboard - Radioshack
  • Various lengths of wire (for the connections on the breadboard). I used a breadboard because I HATE soldering. The breadboard is used for making all the connections between the sensors and the microcontroller.
  • Male Headers - I've had some I got from sparkfun HERE.


  • 3x Sharp GP2D12 IR Sensors (with 3-wire cables) - Acroname, Trossen Robotics (that's where I got mine), Devantech
  • 'Ping)))' Ultrasonic Rangefinder - Parallax.com, I think I've seen it other places online...


  • 9.6V Ni-Cd Rechargeable Battery (or any other 8-AA cell battery pack/any rechargeable batter yback above 9V) - I had this one from a long time ago when it was once used for a RC racecar. You can get these practically any hobby shop.
  • 5V 1A Switching Voltage Regulator - Dimension Engineering.com or Trossen Robotics (where I got mine)
  • Appropriate connector to fit the battery you're using (for making the connection between the battery and the electronics).


  • Arduino Microcontroller (Arduino Diecimila; I know the picture shows an NG; that was an accident. I meant to upload a pic of the Diecimila. I used the Diecimila, but you don't have to have the latest model of Arduino for this robot.)


  • The chassis I used is one I got from a kit from Parallax called the 'BOE-Bot Kit'. You can use plexiglass, an appropriately-sized sheet of plastic, a pre-machined chassis from an online retailer, or even a block of wood.

Cable Management:

  • Cable Ties - (those white, plastic things you find in packaging for holding things together) You can get them at the home depot, lowes, or practically any hardware store.


  • 1x Piezo Speaker/Element - I used this as an indicator; the Arduino beeps when the program begins running
  • 1x LED
  • 1x 200ohm resistor (for the LED)

Step 2: Starting the Assembly - Mounting the Sharp IR Sensor Bracket

There are some slits that line up with the holes and slits on the chassis. Secure the sensor mounting bracket with two screws and nuts on the underside.

Step 3: Mount the Pan Servo and Ultrasonic Rangefinder

The panning servo serves to pan the Ping))) horizontally for a wide range of object detection, as well as measuring distances at various angles to determine the clearest path of travel.

I used some standoffs to mount the servo, and some of the screws I had. The size you want to use for this hardware is really small; I haven't been able to find screws of the appropriate 'thread' anywhere but online. I get this hardware either from Sparkfun Electronics or Parallax (both online). Both of those retailers have all the same-sized screws and standoffs.

Now, for the ultrasonic rangefinder.

I custom-made a mounting bracket for the Ping))) ultrasonic ranger because I didn't want to have to spend the extra cash on one online. I used some plexiglass, a straight edge (razor blade), and a c-clamp for snapping the plastic apart. All you need to do to make this mount is measure the ultrasonic rangefinder, cut out two identical pieces of plexiglass a couple mm larger than the size of the ultrasonic ranger, drill the holes where necessary, and glue them at a right angle as shown. Lastly, drill a small hole just slightly bigger than the screw that came attached to the servo head, insert the screw, and then attach the whole assembly to the servo. I may be good with programming and creativity, but machining the hardware for a home-brew robot is definitely not one of my high points. So what does that mean? If I can do it, you definitely can!

Notes about the servo:

You don't have to buy specifically a Futaba S3003 like I used; you can use any servo you'd like, as long as it has a wide degree of motion; that is important for this project! I think the Futaba servo I used has ~180 degrees of motion. When I went searching for a servo to use as the panning servo for BOB, I looked for the most inexpensive one I could find, and the one I'm using does the job perfectly. If you've got a standard hobby servo with ~180 degrees of motion, then you're all set for this part, BUT-- you may need to adjust the PWM values in the source code to fit your servo, because if you don't, you may DAMAGE THE SERVO. I've ruined a servo accidentally like that before, so be careful when using a new servo; find out the 'limits' of PWM values, otherwise it will try to turn farther than it physically can (servos are 'dumb'), and it will ruin the gears inside it (unless you bought a really nice one with metal gears).

Step 4: Add BOB's Brain (the Arduino) & Make the Connections

For a faster 'brain', I decided to use the Arduino (ATmega168) which, despite running at only 16Mhz (compared to the BS2's 20Mhz), is much faster than the BS2 because it does not have the interpreter involved that the BASIC Stamps have to use. While the BASIC Stamps are great for simple projects and are easy to use, they aren't that powerful, and didn't fit the bill (as I found out the hard way with 'BOB V1.0').

Somewhere on the 'net, I saw a cheap alternative to the 'Arduino Proto Shield'; all you have to do is get one of those yellow radioshack breadboards, and strap it to the back of the arduino with a rubber band! The you can bring the necessary pins around to the breadboard with some short wire.

I would post a schematic, but there are no circuits you need to construct, just the signal, vcc, and gnd connections. The connections are:

  • Pin (Analog) 0: Left GP2D12
  • Pin (Analog) 1: Center GP2D12
  • Pin (Analog) 2: Right GP2D12
  • Pin 5: Pan Servo
  • Pin 6: Left Drive Servo
  • Pin 7: Ultrasonic Rangefinder ( 'Ping)))' )
  • Pin 9: Right Drive Servo
  • Pin 11: Piezo Speaker

I didn't use any extra filter capacitors because the 5V switching regulator has them built in.

The only raw component that you need to use is a 220 ohm resistor for the LED hooked up to VCC (+) as a power indicator.

Step 5: Turn the Hardware Into a Working Robot!

Here's the code for BOB. There are a lot of comments in there to help understand what is going on. There's also 'commented out' code that either isn't being used, or is used for debugging. The code section that handles the ultrasonic rangefinder readings was made by another author; I got it off the Arduino site. Credit to that section goes to that author.

*IMPORTANT* : I have found out that in order to view the code, you have to open it in a word processor (Microsoft Word, Notepad, Wordpad, OpenOffice, etc.). For some reason it defaults to being a 'Windows Media TMP File'.

Step 6: Final Notes

I will be expanding BOB's abilities - I hope to soon add a sound sensor, a light sensor, a PIR sensor for detecting people, and maybe even some other sensors.

At the present time, the BOB just avoids obstacles. The 3 IR sensors serve for detecting objects as the robot moves forward, and the ultrasonic ranger is there for: A) when the robot is moving forward, detecting objects in the IR sensors' blind spots, and B) when BOB detects too many objects within a given time, he'll 'search' for the cleares path of travel; panning the servo and checking various angles for a clearer path.

I think BOB will last about 1hr 20mins on a full charge with the switching voltage regulator and the 9.6V battery.

Also, I know the way the breadboard and the Arduino is sitting on the chassis is a little precarious, but It stays on with a rubber band I'll soon find some way to attach it with some hardware and therefore make it look more polished. I will be adding to this instrucable in the future...

Below is a video of it in action! I've also included the manuals for the sensors just like in the BOB 1.0 instructable ("Obstacle-Avoiding Robot With A Personality"). The 'DE-......' one s for the switching regulator.

puedo tener acceso a planos y materiales de algún proyecto?
good day.. your sensor (ultrasonic range finder) has 3 pins how about the 4 pins ( VCC,.trig(T),echo(R),GND) how a should connect it.?? and how i change the code?? looking for your immediate reply..
<p>This is probably way too late to tell you, but I'll share anyways in hope of helping others. The three pin ultrasonic range sensors use the middle pin for both the echo and trigger, so some extra code is needed to be implemented. However if you use a four pin sensor, the code merely needs to recognize which pin is the trig and which is echo. If you check out my Instructable https://www.instructables.com/id/Motion-Following-Robot/ , you can find code that pertains to a four pin sensor.</p>
FYI: If I right-click on the file; select 'Save Link As..'; rename file 'BOB_V2_0.pde; I can open it by double clicking, in which case it opens using the default association you have set on your OS; or in the alternative, open your favorite editor (Arduino sketch or, in my case, Microsoft Visual Studio ultimate with the Visual Micro plugin (see http://www.visualmicro.com/). Works like a charm.<br><br>I was hoping for better commenting/documentation as my preferred method of code proofing is to simply read the comments for an overall understanding. In this case, however, the code is very simple, so no biggie.<br><br>I really like this design schema and may &quot;borrow&quot; some of the ideas for my own project. That is what is so great about these instructables!
Can someone explain how everything is hooked up? I wanted to use an 11 v battery to power everything. The arduino uses 9v so do I have to hook up two sets of wires one to a breadboard with the 5 v regulator and one direct to the arduino or how does it work?
Are you using an arduino uno or duemillonove? or is it an old NG or something?
answers in step 1 :)
Wow! Bobs' had a MAJOR upgrade! That's a fantastic lil beasty you made there :D
How much did the whole thing cost to make?
are rangefinders exspensive?
depends, ultrasonic is $32, infrared is $10 to $20
I just noticed that even though you said that the only raw component needed is a resistor, there's a small rectifier diode on the breadboard. What is that connected to?<br />
Wow I love going to have to Build me one :)
can you tell me what is the extension of this ATmega168 i found ATmega168 20pu ATmega16820 mu etc which is that particular one you used & how did u programmed it?
Mine was marked 'ATmega168PU'. I programmed it using the Arduino development board and software.
where did you got ATmega168PU& Arduino development board and software. ?
just Google search it you should find a whole bunch of people that carry it.<br />
I like it. It seems a bit too sensitive though, it started freaking out at the end of that video. By the way, I tried your software, it's great.<br />
please mortaldoom can you put a scamatic because in the arduino i dnt found pin 5 and 6 , 7, 9, 11 because its the first time i use arduino atmega168 please help me explain me how to make all the connection and thnks
Hi , Mortal! I have just finished a robot made with your software and ArduinoFun's LARS robot shield. I have built many robots but I have yet to build one any easier. It was great. here is a picture if I can find it. Also, I wish to expand on it, I am not a c programmer, but I am trying to get eyebrows attached software wise. I did this before on the basic stamp, but it came out doing everything too slow. So, like you, I moved to the Arduino. But, I could use some advise on c. Thanks! Maybe you could send me a private message and I could talk straight to you through email. Anyway, here is my image.
That's an excellent build! I love the design; very creative! Who knew you could use a frisbee for a robot!!! It would be really neat, though, to have the top portion of the robot mounted on a center 'pillar' of sorts, that can be panned via a servo. Then you could mount any amount and type of sensors you please, and they could be rotated in any direction; kindof like R2-D2! Not to mention it would look pretty sweet. I've moved on to a new robot; maybe it'll be deemed 'super-BOB' (BOB V3.0, anyone?); this one uses an iRobot Roomba Red, and some other high-tech goodies. It has the capability to follow a person around, carrying a small (up to probably 50 pounds) payload, and avoids obstacles along the way. Right now it doesn't do a very good job of all this, but I'm working on it! I just recently fried the battery somehow :(, so I'll have to buy a new one. Apparently you can get one on ebay for about 30 bucks... Anyways, now that I know about it, I recommend that you (along with anyone else making a 'BOB') use the servo library for the arduino, which uses internal timers, freeing up your program and not 'blocking' it. This way you can do more while running servos instead of wasting the time 'waiting' for each delay between servo pulses.
I had an UGLY gold roomba530. Who says you have to keep Ugly. Look at it now! Another Question for Mortal, There must be ONE place in your program that the PING sees something. Also ONE place in your program that the IR sees something. Where is which place? I tried to inject an eyebrow UP or Down in some spots, but when I did that, it stopped the program completely at that point. I hope you understand my question. Thanks!
wow. i really like its program. if it gets confused (finds its surrounded) then it stops to look around and find out whats near it. that is really neat.
Lol, now just put a red LED on the head and put a case on it. It will look like a cylon with the red eye
a laser!
Fantastic tutorial, well done and thanks for sharing. It looks like the ultrasonic range finders didn't like so much being tilted.
The only parts i can not find are the analog jacks and the mount you used for the sensors that attached to the Boe Bot chassis. Digikey says the analog jacks are discontinued. Do you know any place else for them?
I got the analog jacks and the IR sensor mount from Trossen Robotics. I found the sensor mount here: (http://www.trossenrobotics.com/store/c/3107-Wiring-Cables.aspx) but it looks like they no longer carry/are out of stock of the analog jacks. If they ever pop up again they'd be here: (http://www.trossenrobotics.com/store/c/3107-Wiring-Cables.aspx). But you can find those elsewhere. I used them because they make the wire mess a little neater, but you don't need them. Note that I didn't buy the mount for the ultrasonic sensor; I machined it myself because I didn't want to have to pay for one. Good luck and let me know how it goes! <br/>
Thank you. This is the first project that me and my son (11 yrs old) are going to tackle together. We are looking forward to working on it together and learning.
Oh great to hear that! I will say that it'll definitely be an enriching learning experience! Let me know if you have any questions and I'd be glad to help.
i dont understand how you wire the wires to the breadboard, looks all too complicated.
love it man!, here is my bugbot I got tired of the wally/bobot replicants and am now playing with different chassis and building my own z80 based controler board too. take a look and have a laugh.. I just started casting my own aluminum chassis parts so the next bug will be a scorpion then I want to do a wasp im now figureing howto get it to fly..
CoOl! Good job with the handiwork!
I really want to biuld one but ive never done anything like this would it be to hard and how much would it cost
you could hack an old r/c car.
could but how
<a rel="nofollow" href="https://www.instructables.com/id/Put-your-RC-car-under-computer-control/">like this</a><br/>
To conserve even more power you can add a power sink driver chip toy your robot. so that you can turn off the sensors that are not currently being read. I use this chip from Allegro named A6801SA-T there are lots of others. but i use this one.
it works well but if your really good then you can add arms or even make it walk!
Hi i Just wanted to know how much does this robot costs $ Cause if you want to sell one i would love to buy one at any costs PLEASE send me a message
hi could you please tell me some thing more about this robot
That's pretty nice! A lot like one I built: <a rel="nofollow" href="http://blog.digitalhaunt.net/?page_id=13">http://blog.digitalhaunt.net/?page_id=13</a><br/>
Oh, neat! Where did you get that chassis? Or did you CNC-mill it...?
I got the chassis and turret server here: <a rel="nofollow" href="http://www.budgetrobotics.com/">http://www.budgetrobotics.com/</a><br/>It'd be easy enough to mill yourself tho.<br/>
very nice! How much did it roughly cost?
Thanks! Well, I already had a lot of the materials such as the battery pack and arduino. But if you had to get everything to make it; probably about $180 - $200.
Whats the difference between switching voltage regulator and a normal one?
Switching regulators are more efficient and don't get as hot. A switching regulator, when used with a high input/output voltage, will give you a LOT more battery power.
oh, i see
kool :)

About This Instructable




More by RPisces:Room Visitor Counter with Relay Control ATX Power Supply --&gt; Cheap Bench-Top Power Supply Automated Plug-In Appliances 
Add instructable to: