Hey guys! My goal for this instructable is to document my first ever robot build! I hope that it will be easy, clear and well written enough for even a complete beginner and electronics novice to follow. The robot itself is simple and follows a general design of many arduino robots and first robots, but you've got to start somewhere and I hope to go up from here with a slightly bigger and more complicated robot next! It is definitely a work in progress so please let me know in the comments if you have any suggestions or tips for the robot, future ideas or how to make this intstructable better!
Step 1: Materials and Preparation
This project requires relatively little, the parts you need are listed below and I included links to everything I could. More than anything else, you just need some time, a willingness to learn a few things and you're on your way.
- an Arduino Uno R3 (this means revision 3 which is the most current board)
- an HC-SR04 ultrasonic sensor: http://www.amazon.com/gp/product/B0089VA3AY?psc=1&...
- Tamiya 70101 Truck Tire Set: http://www.amazon.com/gp/product/B001VZNA96?psc=1&...
- Tamiya 70097 Twin Motor Gearbox Assembly Set (This is what I used, but any two small dc motors and wheels will work): http://www.amazon.com/gp/product/B001Q119AC?psc=1&...
- male to female wires: http://www.amazon.com/gp/product/B00A6SOGC4?psc=1&...
- An arduino motor shield, I used the older Version1 of adafruit's motor shield, however I would highly recommend trying their new version 2 shield which I will link to here: http://www.amazon.com/Adafruit-Motor-Stepper-Shiel... or the official arduino motor shield, which you can get here: http://www.makershed.com/products/official-arduino...
- A base of some sort: I actually tried my hand at tinkercad with some success and 3d printed a base, I will include that .stl file if you would like to use it and 3d print a base, if not, you can use either wood, aluminum or plastic, even lean/plexiglass. I would simply recommend that you make it at least 1/4 inch though, for sizing, my base is about 6 inches or so to give you an idea.
- batteries! I'm starting with a double a battery pack but it's much better to use a lithium ion rechargeable pack.
- (optional) leds
- (optional) this depends a little on which motor shield you use, but you may need solder(get rosin core solder! NOT acid core) and a soldering iron(very cheap at radio shack). Even if you don't use them for this project a soldering iron is an important tool to have around for any future electronics project!
Step 2: Assembling the Motors, Gearbox and Tires
This is where the fun begins! For the Taimiya motors and gearbox it should come with directions including a full diagram. Simply follow the directions to assemble the gearbox and then install both of the included motors in the gearbox. The only tricky part is that you can assemble the gearbox in one of two ratios: one is faster and the other is slower and geared more for power. I geared mine for speed but you can choose whichever setup you want, just watch out for that in the directions, one side shows one configuration and the other side of the directions is the other configuration.
Next for the wheels simply punch out the tires and attach them to the wheels. Then you should be able to pop the wheels onto the axels of the gearbox. The last step is soldering on a positive and negative wire to each motor. Once you've managed all that, you're nearly there! I've included a picture of the complete tamiya gearbox with motors and of an assembled tamiya castor wheel as well.
Step 3: The Motor Shield and Programming
Now you should have a completed gearbox with motors and wheels ready to go. The next thing to do is attach your motors to the motor shield. If you are using the same motor shield as me, then simply loosen the screw terminals and attach the wires to the M1 (motor 1) section on the shield. It should be labeled on the shield. If you are using the updated version of Adafruit shield, it should be the same but double check the layout/instructions on adafruit's website. Keep in mind though, depending on your base you may need to first attach the gearbox to your base and then to the motor shield . Next you should be able to simply place the motor shield onto the Arduino and then mount it all to your base if you haven't done so already.
Additionally you want to then add your ultrasonic sensor to the base and wire it to the shield as well, for the old shield you will need to attach some of the female to male jumper wires to the sensor and then solder it to the shield, for newer and stackable shields you may be able to connect the wires straight to the shield via female headers.
Now, for programming....programming should be pretty straight forward and I'll include my sketch as a jumping off point but fair warning my robot is a work in progress so I include my code as is! Use is as you will! The important thing is to download and use the proper library for your motor shield. You can find this by going to the adafruit or other website for the maker of your shield and then finding your shield and it should have a link to download the library or instructions on how to program it.
Side note: my .stl file of my base is included on this page for modifying and 3d printing
Step 4: Power and Testing!
The last and final step! Connect your battery pack and/or turn the robot on and see how it goes! Good luck and I hope you've been able to successfully make a small robot(or at least get some ideas)!