- Stamina (improved power system)
- 'Vision' (extra sensors)
- 'Nerves' (connections are made more securely)
- Brainpower (different microcontroller)
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
- 1x Futaba S3003 (Hobby Servo) - Hobbytown USA, Futaba.com
- 2x Parallax Continuous Rotation Servos - Parallax.com, Acroname.com
- 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 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
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
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
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.