Introduction: SpurtBot ShadowRunner
by ignoblegnome in Circuits > Robots
12274 Views, 48 Favorites, 0 Comments
Introduction: SpurtBot ShadowRunner
Spurt is an abbreviation of: School Projects using Robot Technologies. The SpurtBot ShadowRunner is a simple shadow avoiding robot. It will go straight until the sensor is in shadow, then back up and turn.
NOTE: After you have built and enjoyed your Shadow Runner, you may be able to adapt it by creating new circuits to control its behavior. I have an earlier Instructable on building a line following robot based on a similar design, but without the solderless breadboard. With a few alternative components, you should be able to adapt the SpurtBot as a line follower. Or create a whole new behavior with a circuit of your own design!
I designed this robot to be used for teaching young kids. Children can work with an assistant to build their very own SpurtBot that they can take home. If you want you can pre-build part of the robots so that wires are pre-soldered, and stripped. This way kids just need to assemble the kit.
The video below may be helpful, if you want to see someone walk through the build
Learning Objective
I've used this design and similar to run single day workshops and multi-day robotics classes for children. By making this simple robot, children and students of all ages will learn several basic concepts used in robotics. These concepts include differential steering and motor control, sensors, and automated behaviors. In addition, students will gain experience with hands on construction and prototyping a circuit on a solderless breadboard.
A version of these instructions can be found at:
http://letsmakerobots.com/node/31744
Behavior
The Shadow Runner will run from shadows. That is, it will drive forward in normal lighting conditions, but if you cover its light sensor with your hand or it runs into shadow, it will reverse and turn.
In many cases, this will remove the robot from shadow and it will start to drive forward again. A disadvantage of this simple robot is that if it drives too far into shadow, it will just spin in circles on one wheel! Then you will have to ‘rescue’ it.
Note that the Shadow Runner needs a well lit room to operatate properly.
Circuit
Refer to the circuit diagram in the second picture. When the photo resistor sees light, the robot will drive forward. Both left and right motors are receiving 9V via the normally closed contact of the relay.
When the photo resistor is in shadow, its resistance increases dramatically, and the voltage divider formed with the potentiometer (a ‘pot’ is a variable resistor) now increases the voltage at the input of the two BC337 transistors. These transistors work like electrical switches. They turn on when they get enough voltage to their base input. When used together in a Darlington array, they can provide a lot of current. When they turn on, they provide current to the coil inside the relay, turning it on.
Now the left motor will get ground on its + lead, and 9V on its - lead, reversing the motor.
The right motor's - lead is hard wired to ground from the battery. Since the + lead of the right motor is now also getting ground, the right motor will stop.
This combination causes a stop, backup and turn maneuver. If this maneuver removes the shadow from the photo resistor, it will revert the relay to its normal position, and both motors will drive forward again. If the robot stays in shadow, it will spin in circles with the right motor stopped and the left in reverse.
Gather Your Materials
I've used this design and similar to run single day workshops and multi-day robotics classes for children. By making this simple robot, children and students of all ages will learn several basic concepts used in robotics. These concepts include differential steering and motor control, sensors, and automated behaviors. In addition, students will gain experience with hands on construction and prototyping a circuit on a solderless breadboard.
Parts/Materials
- (2) motors Mabuchi FK-260A-10400 (Jamco p/n 2081908)
- (2) roller bearings 680z
- (1) 2 inch piece of 5/16 inch diameter wood dowel
- (1) craft stick
- (1) punch balloon
- (1) 8mm half round bead
- (1) mini solderless breadboard
- (2) BC337 NPN transistors
- (1) 1N4148 diode
- (1) photocell
- (1) 5k trim potentiometer
- (1) 9V DPDT momentary relay
- (1) 9V alkaline battery
- (1) 9V battery holder
- (1) 1 inch piece 3/16in shrink tubing
- Some 22AWG solid core wire
- Wire cutters
- Wire strippers
- Needle nose pliers
- Hot glue gun and glue sticks
- Sharp scissors
- Pen or pencil
Attach the Dowel
You want to be sure the dowel is square with the craft stick. I like to use the corner of a table to hold the two pieces of wood at 90 degrees while the hot glue is drying.
Attach the Bearings
The end of the dowel should be flush with the surface of the side of the bearing, as shown in the picture below.
Now repeat the process with the other bearing, so that you have one bearing on each side of the dowel. While you insert the second bearing, be careful to press down on the top of the dowel, rather than on the edges of the first bearing, or you might wind up with the dowel inserted too far into the first bearing.
Also be sure that the bearings are mounted at 90 degrees to the dowel. Congratulations, you now have a ‘rolling chassis’ for your SpurtBot.
Attach the Motors
- The motor shafts need to be parallel to the rolling surface of the bearings. In other words, the motor shafts should be at 90 degrees to the craft stick and parallel to the dowel.
- You don’t want too much space between the motor shaft and the bearing, because it will add too much tension to the wheel when the bands are installed.
- To keep tension roughly equal on both bearings, you want both motors positioned the same distance from the bearings.
- I generally place the motors directly against the wooden dowel, which sets the distance right for the band tension and keeps the motor shafts parallel to the dowel.
- The shaft of the right motor should be positioned directly behind the right bearing. The shaft of the left motor should be positioned directly in front of the left bearing.
- The shaft should overlap both sides of the bearing a little bit, so the tension bands will stay on the wheels.
Start with the right motor, which will be mounted to the rear of the dowel. Position the motor and get a good feel for where it will go, noting the points above. Once you are ready, place a generous amount of hot glue on the craft stick and the dowel on the side the motor will touch.
Pull the hot glue gun away quickly, and place it safely on the table. Working quickly, grab the right motor and place it on the SpurtBot. You will have a few moments as the glue hardens, so check that the shaft is positioned as you want it. Then hold it still for a minute while the glue dries.CAUTION: Hot glue is, well… HOT. It will stick to your skin and burn you. The end of the hot glue gun is very hot. Don’t touch it, and don’t let it touch anything that can burn.
After the glue is dry, you can break off the little annoying threads of hot glue that inevitably happen.
If you are happy with the way your right motor was mounted, repeat the procedure with the left motor. Remember that the left motor will be mounted in front of the dowel, with the shaft facing the left side of the robot.
Attach the Breadboard
This should be the side of the craft stick that is longer, as shown in the picture below.
Note that the breadboard should be attached so that the widest side rests against the front motor. Make sure your breadboard is centered on the craft stick, so the weight will be balanced.
Attach the Half-Bead
Flip your SpurtBot back over so it is top-side up. Be sure that the balance is so that the bot now rests on the half-round bead at the front of the robot.
Test the Motors
Insert the 9V battery into the battery holder.
Start with the right motor, which is mounted behind the dowel with its shaft behind the right bearing.
Looked at from the right side, the bearing needs to turn clockwise for the SpurtBot to move forward. Since the motor will be attached to the bearing directly using a band, the right wheel motor also needs to turn clockwise.
Temporarily attach the black wire from the battery holder to one lead of the motor and the red lead from the battery holder to the other lead of the motor. Note which way it is spinning when viewed from the right side of the robot.
If it is spinning clockwise, mark the motor lead attached to the red wire with a ‘+’ and the motor lead attached to the black wire with a ‘-’.
If the motor is turning counter-clockwise, then you need to reverse the markings. Mark the motor lead attached to the red wire with a ‘-’, and mark the motor lead attached to the black wire with a ‘+’.
Now test the left motor. Repeat the above procedure, making sure the motor will turn counter-clockwise when viewed from the left side when you attach the battery leads.
Take your time with this step. As they say in carpentry, “Measure twice, cut once.”
Connect the Motor Wires
I like to use red wire for the motor terminals marked with a ‘+’, and black or grey wires for the motor terminals marked with a ‘-’.
Cut two red wires and two black/grey wires, each about 5 ¼ inches long. Carefully strip about 1/8 inch of insulation from one end of each wire.
Solder the red wires to the ‘+’ terminals of each motor, and the black/grey wires to the ‘-’ terminals of each motor.
Then strip about ¼ inch of insulation from the other end of each wire, so they can be inserted into the solderless breadboard when needed.
Attach the Battery Holder
The front of the battery holder should be about even with the forward edge of the front motor. You want to be sure the front edge of the battery holder doesn’t interfere with your access to the breadboard. However, don’t set the battery too far back, or it might put too much weight on the back and and cause the front of the SpurtBot to lift.
Also be sure the battery holder is positioned so that it is centered left to right on either side of the craft stick, to keep the balance even.
Once you are happy with where you plan to place the battery holder, hot glue it to the top of the motors.
Cut the Traction Bands
Now cut two bands from the end of the neck, a tiny bit wider than the width of the bearings. Try to keep the cuts nice and straight.
You can fit the traction band onto the left bearing and motor shaft now. Start by stretching one band over the bearing on the opposite side from the motor shaft. Extend the band around the motor shaft.
Now carefully rotate the bearing. The band should tend to align itself onto the bearing and motor shaft.
Repeat for the right motor shaft.
Hurray! The chassis of the SpurtBot is done, and it is time to build the circuit!
Add the Relay
Note: If you used a diffeent DPDT relay than the one listed in step 1, you will have to connect it according to the pin diagram in the datasheet for your relay, referring to the circuit diagram in the Intro.
Important: The relay must be placed with one set of pins on one side of the central groove, and one set of pins on the other side. This prevents the relay contacts from shorting out.
You want the relay positioned a bit right of center on the breadboard. There should be five free rows of breadboard contacts to the right of the relay, as shown in the picture below.
Wire the Relay
These wires will cross connect the contacts of the relay.
Pin 1 of the relay is a the top-left. Pin 2 is to its right, and the pin numbers increment as you count along the top and then wrap around the bottom pins.
Start by inserting one end of one wire at pin 4 of the relay. Connect the other side of the same wire to pin 9 of the relay, as shown in the picture below.
Next, connect the second wire to pin 2 of the relay. Connect the other side of the same wire to pin 7 of the relay. As shown in the picture below, the two wires now cross over the top of the relay.
Connect the + Voltage Wires
Prepare a piece of red wire, about 1 ½ inches long. Strip about ¼ inch of insulation from each side of the wire.
Insert one side of the wire at the edge of the breadboard closest to the front motor, and in-line with pin 8 of the relay. Insert the other side of this wire in the bottom-right hole of the breadboard.
Your breadboard should now look like the first picture below.
Prepare a second piece of red wire, about 3 inches long. Strip about ¼ inch of insulation from each side of the wire.
Insert one side of the wire just above the other red wire at the bottom-right of the breadboard. Since each row of five contacts on breadboard are connected internally, these two wires are now electrically connected. Cool, huh?
Now insert the other side of the wire just below the center groove of the breadboard, leaving two empty holes to the left, as shown in the second picture below.
Connect the - Voltage Wires
Start by connecting the black wire from the battery holder. Insert this wire along the top edge of the breadboard, in-line with pin 1 of the relay, as shown in the first picture below.
Prepare a black or grey wire about 1 inch long and strip ¼ inch of insulation from each side. Insert one side of this wire in-line with the ground connection from the battery. Insert the other side of this wire two spaces to the right of the first, leaving one open hole between them. This connects the ground connection to pin 3 of the relay, as shown in the second picture below.
We are now done with jumper wires. All that is left is inserting components and connecting the motors. Let’s go!
Insert the Diode
Important: The black stripe on the diode MUST be at the bottom of the relay, closest to pin 10!
Insert the Transistors
Take the first transistor and spread the pins out a bit. Holding the transistor with the flat side facing the rear of the SpurtBot, insert the left-most pin into the bottom edge of the breadboard, three holes from the left edge of the breadboard. This will connect it in-line with the longer red jumper wire inserted in a previous step. There should be two empty holes to the left of the left transistor pin.
The center pin of the transistor should also be inserted in the bottom edge of the breadboard, leaving two empty holes between it and the left pin.
The right pin of the transistor should also be inserted in the bottom edge of the breadboard, leaving one empty hole between it and the center pin.
See the first picture below for comparison.
Now take the second transistor and spread out the pins a bit. This transistor will also be inserted with the flat edge towards the rear of the Spurtbot, just like the first one.
Insert the left most pin of the second transistor just above the left most pin of the first transistor, so that they are in the same connected row of holes on the breadboard.
The center pin of the second transistor should be inserted two spaces to the right of the left pin, leaving one open hole between them.
The right most pin of the second transistor should be inserted in the hole just to the right of the center pin of the same transistor. This connects the center pin of the first transistor with the right most pin of the second transistor.
See the second picture below for comparison.
Together, these two transistors for a Darlington array.
Insert the Photocell
Insert the other pin of the photocell just above the center pin of the second transistor (the one more towards the front of the SpurtBot).
Pinch the two leads of the photocell slightly, being very careful not to let them touch each other. Then take a piece of 3/16 inch shrink tubing about ¾ inch to 7/8 inch long, and place it over the photocell.
This will prevent stray light from interfering with the operation of the photocell.
Note: If you find the SpurtBot is not sensitive enough to light during testing, even after adjusting the potentiometer, you can trim the length of the shrink tubing so that the photocell is closer to the opening. You want to keep the photocell lower than the top edge of the tubing. Don't cut it now, wait until testing.
Insert the Potentiometer
You will insert the potentiometer with the center pin towards the right side of the SpurtBot.
The center pin should be inserted just below the central groove of the breadboard, in the same row of holes as the pin of the photocell and center pin of the top-most transistor.
The right pin of the potentiometer should be inserted in the same row of holes as the long red wire and the left pins of the two transistors.
Note that the left pin of the potentiometer will sit in the central groove of the breadboard. It is not connected to anything.
For now, adjust the potentiometer so that its indicator is at the top. This is the center position. The potentiometer will be adjusted later if needed for the ambient light conditions.
Insert the Motor Wires
In this step, keep in mind that the right motor is the one at the rear of the SpurtBot. It has its shaft facing right, but its wires on are the left side of the SpurtBot.
Also, there will be several connections that mention the relay pins, so below is that picture again for your reference.
Let’s connect the right motor first (meaning the motor that runs the right wheel). Take the ‘-’ connection, which should be a black or grey wire, and insert it in the upper edge of the breadboard, two holes to the right of the black wire from the battery holder. This leaves one empty hole between them. Due to the short jumper wire we inserted earlier, this motor connection is now electrically connected to ground. Refer to the first picture below.
Then, take the ‘+’ red wire from the right motor, and insert it just above the wire connected to pin 4 of the relay. Refer to the second picture below.
Now let’s connect the left motor. Take the ‘-’ connection, which should be a black or grey wire, and insert it just below the wire connected to pin 7 of the relay. Refer to the third picture below.
Lastly, take the ‘+’ connection from the left motor, which should be a red wire, and connect it in the upper edge of the breadboard, in the same row of holes as the ‘+’ connection from the right motor. This connect the ‘+’ terminals of both motors together, and also to pin 4 of the relay. Refer to the forth picture below
Test Your Shadow Runner!
1) Bring your SpurtBot where there is plenty of light, and power it up. The left wheel should start moving forward immediately. The right may not spin until you adjust the potentiometer for the ambient light conditions. Adjust it if needed. If you can get both wheels running forward in the light you did good. Skip the table below and move on to the next test. Otherwise, check the table below for likely causes and solutions.
Condition | Likely Cause | Solution |
Both wheels run forward | You did everything right | Enjoy! |
No wheels turn | Missing connection | Check power and ground connections first, then all other connections. |
Left wheel doesn’t turn | Missing connection | Check motor connections for left wheel, then other circuit connections. |
Right wheel doesn’t turn | Needs more light |
Adjust potentiometer or bring to a brighter spot in the room. If adjusting the potentiometer doesn't work, you can trim the length of the shrink tubing over the photocell, as described in Step 17. |
Right wheel turns backwards | Reversed motor wires | Try swapping the ‘+’ and ‘-’ wires of the motor. |
Left wheel turns backwards, while the right wheel is moving. | Reversed motor wires | Try swapping the ‘+’ and ‘-’ wires of the motor. |
2) Now cover the photocell with your hand. The right wheel should stop and the left wheel should reverse.
Condition | Cause | Solution |
Right wheel stops and the left wheel reverses. | You did everything right | Enjoy! |
Left wheel stops and the right wheel reverses | You did it backwards, so your bot will spin the opposite direction in shadow, but will work just fine. | Enjoy! |
Both wheels turn forward, even in shadow. | Photocell circuit is too sensitive. | Adjust the potentiometer |
One wheel stops and the other wheel reverses in shadow, but the bot does not return to forward running state when not in shadow. | The photocell circuit needs adjusting, or there is not enough ambient light |
Adjust the potentiometer or find a brighter spot in the room. You can also try cutting the shrink tubing a little shorter. |
3) Everything working? Go play with your new robot! Otherwise, re-check your steps and try again!