'BOB' V2.0

60K16251

Intro: 'BOB' V2.0

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:

Servos:

  • 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.

Sensors:

  • 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...

Power:

  • 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).

Computer:

  • 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.)

Chassis:

  • 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.

Other:

  • 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.


50 Comments

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..

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.

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.

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.

I really like this design schema and may "borrow" 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?
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?
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.
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.
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.
More Comments