Introduction: Fifty Dollar Box Bot
The objective is to construct a programmable hobby bot that is affordable and simple to make. The parts will be purchased from places such as Wal-Mart, Radio-Shack, any Hobby Store, or online store that is accessible to the public. The price range is 50 dollars or lower for the entirety of the robot.
Step 1: Gather Your Materials
Here is a list of all materials needed to complete the bot and their prices.
-Arduino Uno (The Brain)
-4xAA to barrel jack holder (Power for the Brain)
-9V Snap Connector (Power for the motors)
-Dual Motor Gearbox
-Motor Driver (Logic Controller between Arduino and Motors)
-Resistor 10k Ohm
Two minute maid juice lids were used
with rubber bands wrapped around them
Any good sized cardboard box
(Go buy a towel with the change in case panic ensues)
Some additional notes about the parts list:
Batteries not included.
There are multiple colors of hook up wire that can be used. For the sake of being able to see how I wired everything shown in later steps I used multiple colors.
I did use jumper wires for the leads on the motors again for the sake of having a different color. The hook up wire should suffice.
Step 2: Gather Your Tools
Tools you will need:
-Sharpies (Red, Green, Black, Blue)
Step 3: Assemble the Gearbox & Attach the Wheels
I chose this step to be first for two reasons
1. If you are using gorrila glue it takes about 2 hours to dry and harden completely.
2. The gearbox assembly is the most complicated portion of the construction.
If you are using gorilla glue remember that both surfaces need to be wet in order for the glue to activate.
Use of a hot glue gun reduces the time by quite a bit and reduces the amount of mess created.
Sparkfun provides a wonderful tutorial on assembling the gearbox linked below.
Step 4: Soldering the Leads on the Motors
After the leads have been soldered on you can place the motors in the gearbox.
Now to move on to the wiring of the breadboard and arduino.
Step 5: Prep the 9V Snap Connector
The 9V is what is going to power the motors and this will be done through the breadboard the picture above shows what the leads need to look like after stripping them.
I found a piece of heat wrap to put around the loose wires so they would not catch on anything and provide them with a bit of protection.
Step 6: Preparing the Bread Board
Place the H-driver in the breadboard positioned so that pin 1 is in slot 10 E.
The Top left pin is pin one. The Top of the H-Bridge Can be determined by looking for the indent in the chip.
Color the bread board with the sharpie markers accordingly.
All GND/Ground slots will be black.
All 5V/Power slots will be red
All of the motor ports will be green
All of the ports going to the logic pins on the arduino board will be blue.
I put a black or red line above and below each column on the left and right of the board as a visual reference that the entire column is charged or grounded.
Instructables provides a great description of how breadboards work in the link below.
Step 7: Wiring the Breadboard and Arduino
When wiring the breadboard to the arduino keep the following in mind:
On the H Bridge pins 1 and 9 (1,2EN, 3,4EN respectively) need to be connected to a pin on the arduino that has a "~" so that it can receive speed signals.
Cut the wire longer than you need it. You can always shorten a wire, making one longer is difficult.
The Positive and Ground leads seen attached to the far right of the breadboard belong to the 9V snap connector.
I ran out of black wire and though green is commonly used as a color for ground/negative lines I used a sharpie to color them black for visual purposes.
You do not need to bend the wire or even cut them as exactly as I did, again this was for visual purposes only and is a bit more difficult than necessary.
Step 8: Adding a Photoresistor
The leads on the photoresistor and resistor can be left at the length they are at or cut shorter.
Step 9: Prepare the Box
Place everything in the box before you begin cutting to be sure everything fits comfortably.
Cut slots for the wheels.
Step 10: Connect the Motor Leads to the Breadboard
Attach the wires in the board slots that are green.
Use Electrical Tape to adhere the gearbox to the cardboard box.
Step 11: Finishing Touches
Tape the 9V to the side of the box to keep it from moving around and away from the gearbox.
You have completed the construction of Box Bot!
Step 12: Box Bot in Action
Note: During the course of making the bot run around I found out a few things.
1. It is actually more secure to tie down the gear box by using some of the hook up wire.
2. Make sure the wheels are centered in the video my bot drags a little to the right and I believe this is because of having an off centered wheel.
You can copy & Paste the code below(I attempted to attach the file several ways and it would not show up.):
*Simple arduino code
*to show off capabilities
*of the robot
*Comments to the side of any code is
*"If you have never used arduino before,..."
//define a pin for the photoresitor and its threshold
int lightPin = 0;
int threshold = 750;//In the room I was working in 1000 was really dark
//and 525 was really bright you might have to play
//around with this value depending on your setting.
//Define and initialize motor variables
//Motor speed range is from 0 to 255 (Slowest to fastest)
int speedPin1 = 9;
int motor1APin = 4;
int motor2APin = 3;
int speed_value_motor1 = 64; //quarter speed
int speedPin2 = 10;
int motor4APin = 12;
int motor3APin = 11;
int speed_value_motor2 = 64; //quarter speed
//initial setup before the loop begins
Serial.begin(9600); //Begin serial communcation
//This will only affect the arduino
//when it is connected to the PC
//Set the digital pins as outputs for the left and right motor
//This is what actually runs
if(analogRead(lightPin) > threshold )//Reads in the serial value if it is dark do the code within the brackets below
Serial.println("dark"); //Will only show when connected to PC used for testing purposes
else //Otherwise (if it is not dark) do the code within the brackets below
Serial.println("bright"); //Will only show when connected to PC used for testing purposes
//this method calls the appropriate methods to
//cause both motors to rotate in such a way
//that moves the bot forward
//This method makes only the right
//motor to rotate in a forward direction
//puts the motor in the forward motion
//This method makes only the left
//motor to rotate in a forward direction
/This method causes both motors to come to a full stop
//Sets the speed to 0 causing the left motor to stop spinning
//Sets the speed to 0 causing the right motor to stop spinning
We have a be nice policy.
Please be positive and constructive.