Build a Light-Tracking Robot Critter

 Difficulty Time Required Average (6-10 days) Prerequisites Some familiarity with electronic circuits and using breadboards will be very helpful, though not required, for this project. Using a soldering iron is also helpful but a work-around is offered in the Procedure. Material Availability This project requires certain parts from an electronics store or online retailer. See the Materials and Equipment list for details. Cost Average ($40 -$80) Safety If you use a soldering iron for this project remember that soldering irons get extremely hot and can cause burns if they touch your skin. They can also become a fire hazard if left unattended. Science Buddies recommends using lead-free solder, especially in homes with pets or small children.

Abstract

Have you ever seen moths buzzing around bright lights at night? What about animals that always crawl into dark places, under rocks or furniture? This type of behavior is called phototaxis — movement toward (or away from) a light source. In this project you will build your own biologically inspired robot critter that mimics this behavior. Basing your design on the popular and simple BristleBot robot, you will make a robot with two light sensors for "eyes" and two motors that help it steer left or right — so it can head toward (or away from) the light.

Objective

Build a robot bug from toothbrushes, two motors, and two light sensors that can steer left or right toward a light source.

Credits

Ben Finio, Ph.D., Science Buddies

Thanks to Howard Eglowstein of Science Buddies for help designing the circuit for this project.

• SparkFun is a registered trademark of SparkFun Electronics.

MLA Style

Science Buddies Staff. "Build a Light-Tracking Robot Critter" Science Buddies. Science Buddies, 21 Apr. 2014. Web. 31 July 2014 <http://www.sciencebuddies.org/science-fair-projects/project_ideas/Robotics_p012.shtml>

APA Style

Science Buddies Staff. (2014, April 21). Build a Light-Tracking Robot Critter. Retrieved July 31, 2014 from http://www.sciencebuddies.org/science-fair-projects/project_ideas/Robotics_p012.shtml

Share your story with Science Buddies!

Last edit date: 2014-04-21

Introduction

Have you ever seen insects outside at night fluttering around a bright light? How about crawling insects that seek out dark spaces under rocks or, even worse, under furniture? This type of behavior is called phototaxis — motion in response to light. The moths buzzing around a light source exhibit positive phototaxis, or movement toward a light source, whereas the insects hiding in darkness exhibit negative phototaxis. In this engineering project, you will build your own robot critter — a variation of the popular BristleBot robot — that mimics this behavior by following (or running from) a light source.

Robots that mimic the behavior of animals (or sometimes even plants) in nature are called biologically inspired robots, or bio-inspired robots for short. Bio-inspired robots come in many different types, ranging from tiny robotic bugs to large robotic dogs, even robotic sea turtles and robotic snakes. In many cases, engineers build these robots because animals have evolved to be good at something that it is difficult for man-made machines to do. For example, monkeys and other primates (including humans!) are excellent at grasping many different objects of all shapes and sizes with their hands, but this is a very difficult problem for machines that has stumped researchers to this day (if you want to give it a shot, you can check out our Science Buddies project Grasping with Straws: Make a Robot Hand Using Drinking Straws). Can you think of other examples where animals are good at something that machines cannot do?

To start off your career as a bio-inspired roboticist, we recommend building something a bit simpler than a flying, walking or swimming animal. The original BristleBot design includes a basic electric circuit consisting of a single battery and a single vibration motor (the same kind of motor that makes cell phones and video game controllers vibrate). When placed on the head of a toothbrush with slanted bristles, the vibrating motor propels the toothbrush forward — creating a little, bug-like robot that buzzes along a tabletop. However, with only one motor, the little robot has no way to steer. The robot in this project uses two motors, and changing their relative speed lets the robot steer left or right. Real-life robots use this technique to move — like the Kilobot robot from Harvard University. In the case of your BristleBot, two light sensors and a slightly more complicated circuit will control the speed of the motors, enabling it to steer toward a light source (or away from it, if you reverse a couple of wires). Here is a video introduction to the robot you will build in this project:

This video provides a basic introduction to the behavior of the light-following BristleBot.

A basic understanding of electric circuits, working with breadboards, and circuit diagrams will be very helpful, but not required, for this project. You should also be familiar with voltage, resistance, and current, along with their respective units of volts, Ohms, and amps. You can refer to the Science Buddies Electronics Primer for an introduction to building circuits with breadboards.

A circuit diagram is a picture that uses symbols to represent a real-life circuit. You must be careful because a circuit diagram does not look exactly like the circuit in real life, and individual components might not look exactly like the symbols that are used to represent them. Table 1 below gives a short description of the circuit components used in this project, along with their symbols and pictures of the real thing. We do not have enough space in this project to give a full introduction to each element (you can find more information on the devices shown in Table 1 if you look in books and on websites), but if you want to learn more about them, feel free to do more background research.

 Component Description Symbol Picture Resistor Resists the flow of electrical current Photoresistor Resistor that depends on light Switch Just like a light switch, turns your robot on or off Motor Vibrates and causes the robot to move Battery Provides electrical power MOSFET Uses the light detected by the photoresistor to change the speed of the motor
Table 1: A list of all the circuit components used in this project with their electronic circuit symbols and pictures of the real thing. Notice how the symbol does not look anything like the physical object. Notes: (1) MOSFET stands for "Metal Oxide Semiconductor Field-Effect Transistor," and the labels G, D, and S stand for "gate," "drain," and "source," respectively. Understanding exactly what all those things mean is more than you need to complete this project — but of course, you can look them up if you are curious! (2) The pictures in this table are not to scale. (resistor picture from Wikimedia Commons user Anvandare Chrizz, 2005. Other component pictures from SparkFun Electronics, 2012)

The circuit diagram for one motor with its speed controlled by a photoresistor and MOSFET is shown in Figure 1 below. Your robot for this project will use two identical copies of this circuit. The circuit starts out with a battery that supplies a voltage, $V_{battery}$ . When the switch is closed, the voltage $V_1$ will always be equal to $V_{batt}$ . Next there are two resistors with values $R_1$ and $R_2$ . $R_1$ is a photoresistor, so its resistance value depends on light (more light means less resistance, and vice versa), and $R_2$ is a regular resistor. These resistors form a voltage divider. A voltage divider with two resistors determines the voltage $V_2$ . Using Ohm's Law (a commonly used equation that defines the relationship between resistance, voltage, and current), you can derive the equation for a voltage divider (we won't do the derivation here — but if you are interested, you can look up more information on voltage dividers and Ohm's Law):

Equation 1:
 $V_1$ [Please enable JavaScript to view equation] is the input voltage (equal to the battery voltage when the switch is closed). $V_2$ [Please enable JavaScript to view equation] is the voltage in between the resistors. $R_1$ [Please enable JavaScript to view equation] is the resistance of the photoresistor (changes with light). $R_2$ [Please enable JavaScript to view equation] is the resistance of the other resistor (does not change).

You can see from Equation 1 above that as $R_1$ changes, $V_2$ will also change. $V_2$ is the voltage that lets the MOSFET act like a "control knob" for the motor, the same as a volume control knob on a radio. If $V_2$ is very small, the motor will not spin at all. As $V_2$ increases, more electrical current will flow through the motor, making it spin faster. The net effect is that the more light shines on the photoresistor, the faster the motor will spin. This process is summarized in Figure 2 below.

Technical Note
• The motor's speed cannot increase forever — it is limited by the battery voltage. If you have taken calculus, can you take the limits of Equation 1 as $R_1$ approaches zero or $R_1$ approaches infinity? What happens?
• The voltage $V_2$ in our circuit acts as an input to the "gate" of the MOSFET (the terminal labeled "G" in Figure 1). Roughly speaking, this voltage determines how much current flows from the "drain" to the "source" (labeled "D" and "S" in Figure 1, respectively). Because of the way the circuit is wired, this is the same current that flows through the motor. This enables $V_2$ to control the motor speed. However, the MOSFET's behavior is nonlinear, meaning the current flowing from the drain to the source is not simply proportional to $V_2.$ In general, no current will flow at all until $V_2$ exceeds a certain threshold voltage. As $V_2$ continues to increase, eventually the MOSFET will saturate and no additional current will flow, even if you keep increasing $V_2.$ If you increase $V_2$ too much, you can even destroy the MOSFET! The exact behavior (and at what voltages these things occur) will depend on the specific type of MOSFET — information you can get from the product's data sheet.
 Figure 1. Circuit diagram for a motor whose speed is controlled by a photoresistor and a MOSFET, with power supplied by a battery. The variables $V_{batt}$ [Please enable JavaScript to view equation] , $V_1$ [Please enable JavaScript to view equation] , and $V_2$ [Please enable JavaScript to view equation] label voltages at different points on the circuit. $R_1$ [Please enable JavaScript to view equation] and $R_2$ [Please enable JavaScript to view equation] are the values of the two resistors.
 Figure 2. A summary of how the circuit uses light to control the speed of a motor. The net effect of the circuit is that as more light shines on the photoresistor, the motor spins faster.

At this point, we hope you have an introductory understanding of the circuit that will be used to control your robot and are ready to start building! If you want to do additional background research on any of the topics mentioned above, we have provided a number of helpful links in the Bibliography section.

Terms and Concepts

• Phototaxis
• Positive phototaxis
• Negative phototaxis
• Bio-inspired robot
• Electronics concepts
• Circuit
• Circuit diagram
• Voltage (volts)
• Resistance (Ohms)
• Current (amps)
• Ohm's Law
• Voltage divider
• Circuit components
• Resistor
• Photoresistor
• Switch
• Vibration motor
• Battery
• MOSFET
• Nonlinear
• Threshold voltage
• Saturate

Questions

• What are some different types of bio-inspired robots?
• Can you find specific examples of other robots that use phototaxis?
• Why do engineers and researchers want to build bio-inspired robots? What can they be used for?
• Can you make a list of actions that animals are good at, but that machines have trouble with or cannot do at all?
• What is a transistor and how does it work?
• How can you use a transistor to control the speed of a motor?

Bibliography

Here are two additional project references — one for the original BristleBot and one for another light-following robot from Instructables.com:

If you need additional help understanding some of the circuit topics mentioned above, these resources may be helpful:

Here are the data sheets for some of the parts used in this project:

Materials and Equipment

Most of the electronics components here are available from online retailer SparkFun Electronics®. However, you may be able to find them at an electronics store such as RadioShack®, or on Amazon.com. Because price depends on where you live and shipping costs, we cannot guarantee what the cheapest option will be.

Materials

• Toothbrushes with slanted bristles (2). These must be identical. (They are easy to find at a supermarket or drugstore.)
• AAA batteries (2), available from SparkFun or a hardware store
• Double AAA battery holder, available from RadioShack
• Note: Unfortunately, shipping a single battery holder from RadioShack can be expensive (more than the cost of the part itself), so we recommend picking this item up at a store if possible. SparkFun stocks a AAA battery holder, but it includes a cover and built-in power switch, which makes it too large for this project.
• If you do not want to purchase a battery holder, you can use electrical tape to tape two batteries together and attach wires to their terminals - but this will be more difficult to do.
• Mini self-adhesive breadboard, available from SparkFun. Note: These breadboards are available in five different colors on SparkFun's website — so pick a color you like!
• 3-volt vibration motors (2), available from SparkFun
• GL5528 photoresistors (2), available from SparkFun
• RFP30N06LE N-channel MOSFETs (2), available from SparkFun. Note: MOSFETs can be particularly sensitive to electrostatic discharge. Be careful when handling them (see additional details in Procedure).
• Jumper wire kit, available from SparkFun or RadioShack.
• ¼ watt 4.7 kΩ resistors (2)
• 5-packs of 4.7 kΩ resistors are available from RadioShack. This is the cheaper option if you only need resistors for this project.
• A kit of 500 resistors (of varying values) is available from SparkFun. This is a much more economical option if you plan on doing other electronics projects in the future.
• Mini power switch, available from SparkFun. This makes it easier to turn your robot on and off without having to disconnect wires.
• Optional: arts and crafts materials (construction paper, pipe cleaners, googly eyes etc.) to decorate your robot.

Tools

Note: If you do not already have these tools, they may be a worthwhile investment if you plan on doing additional electronics projects in the future. If you want to save money, this project can be done without them, but the robot will be much more difficult to assemble.

• Required: Scissors or wire cutters (to cut off toothbrush heads)
• Required: Small flashlight to guide your robot
• Recommended: Wire strippers, to trim the leads of different components (battery holder, motors, resistors, etc.) — otherwise you might have a bunch of unnecessarily long wires dangling off your robot.
• Recommended: Mini needle-nose pliers and/or tweezers for handling tiny circuit components
• Recommended: A soldering iron (several types that vary in price and quality are available from SparkFun, RadioShack, or hardware or general merchandise stores) or silver conductive epoxy, available online at Amazon.com.
• Without either a soldering iron or conductive epoxy, you will have to twist wires together to make some connections in the circuit — this can be difficult to do.
• Safety note: Science Buddies recommends using lead-free solder, especially in homes with pets or small children.

Disclaimer: Science Buddies occasionally provides information (such as part numbers, supplier names, and supplier weblinks) to assist our users in locating specialty items for individual projects. The information is provided solely as a convenience to our users. We do our best to make sure that part numbers and descriptions are accurate when first listed. However, since part numbers do change as items are obsoleted or improved, please send us an email if you run across any parts that are no longer available. We also do our best to make sure that any listed supplier provides prompt, courteous service. Science Buddies does participate in affiliate programs with Amazon.com, Carolina Biological, and AquaPhoenix Education. Proceeds from the affiliate programs help support Science Buddies, a 501( c ) 3 public charity. If you have any comments (positive or negative) related to purchases you've made for science fair projects from recommendations on our site, please let us know. Write to us at scibuddy@sciencebuddies.org.

Experimental Procedure

Experimental Procedure
Note Before Beginning: This science fair project requires you to hook up one or more devices in an electrical circuit. Basic help can be found in the Electronics Primer. However, if you do not have experience in putting together electrical circuits you may find it helpful to have someone who can answer questions and help you troubleshoot if your project is not working. A science teacher or parent may be a good resource. If you need to find another mentor, try asking a local electrician, electrical engineer, or person whose hobbies involve building things like model airplanes, trains, or cars. You may also need to work your way up to this project by starting with an electronics project that has a lower level of difficulty.

Circuit Diagram

In the Introduction you can see a circuit diagram for a single motor with its speed controlled by a photoresistor and MOSFET. Remember that this project involves two sets of these components — but the circuit shares a single battery pack and power switch. So, the complete circuit diagram looks like the one in Figure 3 below:

 Figure 3. The complete circuit diagram for the robot you will build in this project. The circuit consists of two identical halves — each with a photoresistor (labeled $R_1$ [Please enable JavaScript to view equation] and $R_2$ [Please enable JavaScript to view equation] ), MOSFET ( $Q_1$ [Please enable JavaScript to view equation] and $Q_2$ [Please enable JavaScript to view equation] ), fixed resistor ( $R_3$ [Please enable JavaScript to view equation] and $R_4$ [Please enable JavaScript to view equation] ), and vibration motor ( $M_1$ [Please enable JavaScript to view equation] and $M_2$ [Please enable JavaScript to view equation] ). Both halves of the circuit share a single battery pack and an on/off switch.

If you have previous experience with circuit diagrams and working with breadboards, you may be able to go ahead and build your circuit based on the diagram in Figure 3 above. If not, do not worry — the next section will provide step-by-step directions with pictures and labeled diagrams to help you build the circuit.

Wiring the Circuit

1. Gather all the components.
You need to make the circuit in one place (preferably a clean tabletop — some of the parts are small and easy to lose). Figure 4 below shows all of the parts with labels.
1. Cut off the toothbrush heads using scissors or a pair of wire cutters. If you have trouble cutting all the way through the neck of the toothbrush, you can just cut into the surface and snap off the head of the toothbrush with your hands.
2. The motors and breadboard have an adhesive backing that comes with a cover— do not remove these covers yet. Note: If you are re-using breadboards and/or motors from a previous project and they no longer have a sticky backing, use a new piece of double-sided tape as a substitute..
 Figure 4. All of the components needed to build one robot for this project. Note: You will need more wires from your jumper wire kit (not pictured).
Figure 5 below shows a blank breadboard and the schematic we will use to represent this breadboard. The breadboard is divided into 10 columns (A through J) and 17 rows, labeled in the diagram on the right-hand side of Figure 5. Note: the actual breadboard used in this project (on the left in Figure 5) did not have any letters or numbers printed on it. Some breadboards might come with printed labels that use a different convention from the one in Figure 5. To build your circuit properly, it is important that you follow the diagrams exactly. If your breadboard has a different lettering/numbering scheme printed on it, you can just ignore it.
 Figure 5. Left: a picture of an empty breadboard. Right: the schematic used to represent the breadboard, with ten columns labeled A through J and 17 rows. Columns A through E and F through J are electrically connected each row, but separate rows are not connected. Note: the breadboard has been rotated to "landscape" orientation for these figures, so the typical orientation of columns and rows appears switched.
1. Insert the MOSFETs.
Important: MOSFETs can be damaged by the discharge of static electricity. Avoid touching the pins of the MOSFETs directly, and only handle them by the plastic packaging. Try to avoid actions that can cause buildup of static electricity, like walking across a carpet. If possible, touch a nearby large metal object to discharge yourself before handling the MOSFETs.

The MOSFETs each have three pins — the gate (G), drain (D), and source (S). Figure 6 below shows one MOSFET with these three pins labeled.

 Figure 6. Picture of a MOSFET with the three pins labeled. Facing the MOSFET from the front (the side printed with numbers and letters), the gate (G), drain (D), and source (S) go from left to right, respectively.

Put the two MOSFETs into the board in column F — one in rows 1-3 ( $Q_1$ in Figure 3 above) and one in rows 15-17 ( $Q_2$ in Figure 3), with the pins oriented as shown in Figure 7 below. Important: Notice how the two sides of the circuit are not mirror images of each other. The "gate" faces to the left for both MOSFETs. This is very important to keep track of, as other parts of the circuit are also not symmetrical, such as the positive and negative wires from the battery pack.

 Figure 7. The two MOSFETs inserted into column F of the circuit board.
1. Insert the power switch.
Put the power switch into rows 6-8 of column B (the direction does not matter — the switch will work the same in both directions). Use jumper wires to connect holes E8 to F8, and E10 to F10. This will enable you to access your positive and ground battery terminals from any holes in rows 8 or 10, respectively. This step is shown in Figure 8 below.
 Figure 8. The power switch inserted into rows 6-8 of column B, and two jumper wires connecting holes E8-F8 and E10-F10. The power switch will cover up five rows on the breadboard (because of the plastic casing), but it only has three pins — make sure you position it correctly. Important: jumper wire kits are usually color-coded by length, but the colors can vary from kit to kit. So, the wires in your kit that match the length between columns E and F might not necessarily be the same colors as the ones in this figure — but that is OK.
1. Connect the "source" (S) pin of both MOSFETs to ground.
Use two jumper wires of appropriate length to connect the "S" pins on both MOSFETs (rows 3 and 17) to row 10 (which will eventually go to the negative terminal of your battery pack). This step is shown in Figure 9 below.
 Figure 9. Use two jumper wires to connect the "S" pin of each MOSFET (rows 3 and 17) to ground (row 10).
1. Insert the 4.7K resistors ( $R_3$ and $R_4$ in Figure 3 above).
1. If you are using a multi-pack of resistors, make sure you select the 4.7 kΩ (four point seven kilo-ohm) resistors. Do not get them mixed up with something that looks similar, like 4.7 Ω (four point seven ohm) or 47 kΩ (forty seven kilo-ohm).
2. First, use your wire cutters to trim the leads of the resistors, then bend them down at 90-degree angles so they can be inserted into the breadboard (if you do not have wire cutters or pliers available, scissors will work — but this may damage the scissor blades, so don't use a good pair). This step is shown in Figure 10 below. Look ahead to the left side of Figure 11 to get an idea of how short you should trim the resistor leads. Note that one resistor has to stretch between rows 1 and 10, while the other only has to stretch between rows 10 and 15—so their leads will not be the same length.
 Figure 10. Use wire cutters to trim the leads of your resistors to an appropriate length, then bend them 90 degrees so they will fit into the breadboard.
3. Next, use the resistors to connect the "gate" pin (G) of each MOSFET (rows 1 and 15) to ground (row 10). As labeled in Figure 3 above, $R_3$ is connected to $Q_1$ , and $R_4$ is connected to $Q_2$ . It does not matter in which direction you insert the resistors — they will work in both directions. This step is shown in Figure 11 below.
 Figure 11. Use the 4.7K resistors to connect the "gate" (G) pin of each MOSFET (rows 1 and 15) to ground (row 10).
1. Insert the photoresistors ( $R_1$ and $R_2$ in Figure 3 above).
Use the two photoresistors to connect the "gate" (G) pins of each MOSFET (rows 1 and 15) to the positive battery voltage (row 8). As shown in Figure 3, $R_1$ is connected to $Q_1$ , and $R_2$ is connected to $Q_2$ . Do not trim the leads of the photoresistors — these are the robot's "eyes," and you need to be able to adjust the direction they are pointing. Adjust them so they are pointing forward and slightly up. This step is shown in Figure 12 below.
 Figure 12. Use the photoresistors to connect the "gate" (G) pin of each MOSFET to the positive voltage supply (row 8).
1. Attach the motors ( $M_1$ and $M_2$ in Figure 3 above).
1. The wire leads on the motors are too flexible to push directly into the breadboard. So, before you can attach the motors, you will need to attach the leads to short pieces of jumper wire. If you have one available, the best option is to use a soldering iron. You can also use silver conductive epoxy. A jumper wire soldered to the motor lead is shown in the center image of Figure 13.
2. Without soldering or epoxy, you will have to do your best to tightly twist the motor lead onto a short jumper wire, then bend the jumper wire to hold the motor lead in place. This can be easier if you gently scrape off some of the insulation from the motor lead to expose more of the metal wire. You can do this with wire strippers if you have them available, or ask an adult to use a sharp hobby knife (but be careful not to actually cut the metal wire). Be careful if you use this approach—loose connections can cause problems when you test your robot. The right image in Figure 13 shows motor leads twisted onto two jumper wires.
 Figure 13. Because the motor lead (left) is too soft to push directly into the breadboard, you must attach it to a stiffer jumper wire first by either soldering it (center) or twisting them together (right).
3. Physically attach the motors to the breadboard using their adhesive backing (remove the paper cover first). Exact placement is up to you, but you must symmetrically mount one motor on the left and one motor on the right. We recommend attaching them to the sides of the breadboard to save breadboard space, as shown in Figure 14 below.
4. Connect both positive (red) motor leads to the positive battery voltage (row 8). You will need to connect the negative (blue) lead for each motor to the "drain" (D) pin of the MOSFET on the opposite side of the robot. Important: depending on where you mount the motors, the negative (blue) lead might not be long enough to reach the drain pin of the opposite MOSFET. If this is the case, you can still connect the negative motor lead to an empty row on the breadboard, and use an extra jumper wire to connect it to the MOSFET, as shown in Figure 14 below.
 Figure 14. Use the sticky backing on the motors to attach them to the sides of the breadboard. Attach the positive (red) leads to row 8. The blue leads probably will not be long enough to connect directly to the "drain" (D) pins on each MOSFET — so in this example, we have first connected the motor's negative (blue) leads to rows 1 and 17 (in column A), then used an additional jumper wire to connect them to rows 16 and 2, respectively. We have labeled the motors $M_1$ [Please enable JavaScript to view equation] and $M_2$ [Please enable JavaScript to view equation] and the MOSFETs $Q_1$ [Please enable JavaScript to view equation] and $Q_2$ [Please enable JavaScript to view equation] (corresponding to Figure 3 above) — remember that $M_1$ [Please enable JavaScript to view equation] and $Q_1$ [Please enable JavaScript to view equation] are not physically on the same side of the robot (the same goes for $M_2$ [Please enable JavaScript to view equation] and $Q_2$ [Please enable JavaScript to view equation] ), even though it may appear that way in the circuit diagram in Figure 3. Always remember that in general, a circuit diagram is just a representation—it does not have to correspond exactly to how the physical circuit components are placed in the real world.
1. Attach the battery pack.
1. Important: starting with this step, if at any point you notice that your robot feels unusually hot, immediately disconnect the batteries. This means you probably have a short circuit—two exposed wires bumping together that should not be touching. You will have to careful check your breadboard for short circuits before reconnecting the batteries. See the Help tab for more information.
2. If the leads on the battery holder are too long, you may need to trim them using your wire strippers. If the ends are not stiff enough to push directly into the breadboard, you may need to solder them to short jumper wires, as you did with the motor leads in step 8a. Remember that if you do not have a soldering iron or conductive epoxy available, you will have to do your best to twist the wires together. If you did not purchase a battery holder: Use electrical tape to bundle two batteries together, facing in opposite directions. Use one jumper wire and some electrical tape to connect the positive (+) end of one battery to the negative (-) end of the other battery. Now attach jumper wires to the remaining positive and negative terminals with tape to use as leads for your battery pack.
3. Remove the paper cover from the adhesive backing on the underside of the breadboard. Attach the battery holder to the bottom of the breadboard (make sure it is centered — you have to leave room for a toothbrush head on either side), with the leads facing the back of the robot (the side with the power switch). Note: remember that if your breadboard is old and has lost its stickiness, or doesn't have an adhesive backing, you can use a fresh layer of double-sided foam tape.
4. Attach the positive (red) lead of the battery pack to row 7, and attach the negative (black) lead to row 10, both in column A. Figure 15 below shows these steps.
 Figure 15. Attach the battery pack to the bottom of the breadboard using the adhesive backing (peel the protective paper layer off the bottom of your breadboard to expose the adhesive). The battery pack should be centered on the breadboard, leaving enough room for a toothbrush head on each side. The battery pack in the diagram on the right side of the figure is not shown to scale or in the proper location — this is to make it easier to show where the leads go in the wiring diagram. Attach the positive (red) battery pack lead to hole A7, and the negative (black) battery pack lead to hole A10.
Attach your two toothbrush heads to the underside of the breadboard, one on the left of the battery pack and one on the right. Make sure slanted bristles are pointed backward (in the opposite direction the photoresistors are facing). Figure 16 below shows the correct positioning of the toothbrush heads for this step.
 Figure 16. A completed robot with two toothbrush heads attached, slanted bristles pointing in the opposite direction of the photoresistors.
1. Congratulations! You have finished building your robot. Before you test it, double-check one last time to make sure you built the circuit correctly. Figure 17 below shows a top-down view of the completed robot, along with the final breadboard diagram. Check your robot to make sure it matches Figure 17.
 Figure 17. A top-down view of the completed robot and the final breadboard diagram. Make sure your robot matches this figure (remember that your jumper wires might not be exactly the same colors as those shown here — this is OK as long as you make the right connections as detailed in the Procedure above).
1. Optional. Decorate your robot! Make sure the robot can still "see" — that is, that the photoresistors are exposed outside of the decorations you add. Important: If you are using glue, glitter, or other arts and crafts items, be careful not to get them in your circuit. Make sure that your costume is easily removable so you can fix your circuit later if something comes loose, and easily access the on/off switch. Figure 18 below shows two of our "bug costumes" — notice how there are notches cut out for the photoresistors.
 Figure 18. Grasshopper and ladybug robot bug costumes with cut-outs for the photoresistors.
Turn the power switch to "on" (move it from one side to the other) and hold your robot up to a bright light. The motors should start to buzz, and you should be able to feel the robot vibrating. Now, put the robot on a hard, flat surface like a countertop or wooden floor (it will not work on a rug or carpet — the toothbrush bristles will get stuck). Aim your flashlight at the front of the robot — does it start to move? Can you use the flashlight to make the robot steer left and right, as in the video from the Introduction section? If so, well done! You have built your very own light-following robot bug. If it does not work on the first try, do not worry — head over to the Help tab and we will try to figure out what is wrong.

Troubleshooting

For troubleshooting tips, please read our FAQ: Build a Light-Tracking Robot Critter.

Variations

We provided directions to make the robot "follow" light. However, with some simple modifications to the robot, the light source could also "push" the robot to turn away from light instead of toward it. Can you figure out what modifications you need to make to the circuit, or the physical body of the robot, to get these behaviors? For example, what happens if you reverse the direction of the toothbrush heads, or switch the left-right connections of the motors to the MOSFETs? Note: Do not reverse the battery connections in an attempt to make the robot turn the opposite way, as this could damage your circuit components.

• Does motor placement affect the robot's steering and speed? What happens if you put both motors on the top or back of the breadboard, instead of on the sides?
• Can you add two more motors to the circuit, in parallel with the original motors? Does this make the robot faster or affect its steering?
• AAAA batteries are smaller and lighter than AAA batteries, but not as easy to find in stores. However, since they are so much lighter, your robot will be a bit faster — can you find and use AAAA batteries instead? How much faster is the robot?

Share your story with Science Buddies!

Q: My motors do not vibrate at all. What should I do?
A:
1. Disconnect the battery pack when checking for short circuits or wiring mistakes. The MOSFETs are sensitive devices and the batteries can get dangerously hot if shorted out. Pull out either one of the battery wires, then proceed to check your wiring.
2. Make sure you do not have a short circuit. Check to make sure there are not any loose, un-insulated bits of different wires touching each other (the exposed metal parts that are not covered in insulation). Just a single short like this can prevent the entire circuit from working.
3. Make sure all your connections are pushed firmly into the breadboard. Sometimes when you are handling the robot, one of the jumper wires or other components can fall out of the breadboard. Double-check to make sure none of your connections have come loose.
4. Use a bright light. You may need to hold your robot very close to a light source (like a lamp or flashlight) to activate the motors. Make sure you are not using a weak light, or holding the robot too far away.
5. Double-check the breadboard diagram. It is easy to miss a single connection — for example, connecting one end of a resistor to the wrong pin on a MOSFET, or connecting something to positive voltage when it should go to ground. A single incorrect connection can stop the whole circuit from working, so be sure to double-check everything!
6. Make sure you put your batteries into the battery holder properly. The battery holder should have labels for the positive (+) and negative (-) ends of the batteries. Make sure your batteries line up with these labels.
7. Make sure your motors and batteries are working. Disconnect the negative (blue) leads of the motors from the drain (D) pins of the MOSFETs, and connect them directly to the negative terminal of the battery pack (row 10 on the breadboard). Now your motors are skipping the rest of the circuit and are connected directly to the batteries, so they should vibrate regardless of whether the photoresistors detect light. If the motors still do not spin, then your batteries might be dead, or you might have a bad jumper wire connection. If the motors spin when connected directly to the batteries, but not when connected to the MOSFETs, then the problem is somewhere else in your circuit.
Q: My motors vibrate, but I am having trouble getting my robot to steer properly. How can I fix it?
A:
1. Adjust the direction of your photoresistors. Remember that in order for the robot to turn, the photoresistors must detect different amounts of light. This will not happen if they are too close together and facing the same direction. Try to space them at least 1 inch apart, and aim them a little bit to the left and to the right. This will enable them to detect different light values more reliably.
2. Adjust how you aim your flashlight. Make sure you aim your flashlight at the photoresistors, not at the ground in front of the robot. Try holding the flashlight closer to the robot.
3. Try covering one photoresistor with your fingertip. This should completely block that photoresistor from detecting any light. While covering one photoresistor, aim the flashlight directly at the other one. This should cause one motor to vibrate. If this doesn't work, you might have a wiring problem with one half of your circuit.
4. Adjust the position of your motors. Did you attach your motors symmetrically? If not, this could cause the robot to steer in one direction. Make sure your motors are mounted in the same place on the left and right sides of the breadboard.
5. Check how the robot moves when the motors are connected directly to the battery. Disconnect the negative (blue) leads of both motors from the MOSFET drain (D) pins, and connect them both to the negative terminal of the battery pack (row 10). Now both motors are skipping the circuit and should be on "full speed." Put your robot down on a flat surface — does it go straight, or does it curve to one side? If it always curves in the same direction, there could be some permanent steering/turning in your robot that your motors cannot overcome, regardless of what the circuit is doing. Check two things:
1. Make sure your battery pack is centered. The battery pack is heavy, so if it is off-center, it can affect the steering of the robot. Make sure it is centered on the bottom of the breadboard.

The Ask an Expert Forum is intended to be a place where students can go to find answers to science questions that they have been unable to find using other resources. If you have specific questions about your science fair project or science fair, our team of volunteer scientists can help. Our Experts won't do the work for you, but they will make suggestions, offer guidance, and help you troubleshoot.

If you like this project, you might enjoy exploring these related careers:

Robotics Engineer

Have you watched "The Transformers" cartoon series or seen the "Transformers" movies? Both shows are about how good and evil robots fight each other and the humans who get in the middle. Many TV shows and movies show robots and humans interacting with each other. While this is, at present, fantasy, in real life robots play a helpful role. Robots do jobs that can be dangerous for humans. For example, some robots defuse landmines in war-stricken countries; others work in harsh environments like the bottom of the ocean and on the planet Mars. At the heart of every robot is a robotics engineer who thinks about what a robot needs to do and works with several engineering disciplines to design and put together the perfect piece of equipment. Read more

Mechanical Engineer

Mechanical engineers are part of your everyday life, designing the spoon you used to eat your breakfast, your breakfast's packaging, the flip-top cap on your toothpaste tube, the zipper on your jacket, the car, bike, or bus you took to school, the chair you sat in, the door handle you grasped and the hinges it opened on, and the ballpoint pen you used to take your test. Virtually every object that you see around you has passed through the hands of a mechanical engineer. Consequently, their skills are in demand to design millions of different products in almost every type of industry. Read more

Electrical & Electronics Engineer

Just as a potter forms clay, or a steel worker molds molten steel, electrical and electronics engineers gather and shape electricity and use it to make products that transmit power or transmit information. Electrical and electronics engineers may specialize in one of the millions of products that make or use electricity, like cell phones, electric motors, microwaves, medical instruments, airline navigation system, or handheld games. Read more

Robotics Technician

Robots are no longer futuristic machines. Robots are here and now and are used in manufacturing, health care, service industries, and military applications. They perform tasks that are repetitive and hazardous—things that humans don't want to do or are unsafe to do. But robots are still machines, which means they require humans to build, maintain, program, and keep them functioning efficiently. Robotics technicians work with robotics engineers to build and test robots. They are responsible for installing and maintaining robots and keeping them in working order for their employers. If you are interested in working with robots, your future is here and now. Read more

Looking for more science fun?

Try one of our science activities for quick, anytime science explorations. The perfect thing to liven up a rainy day, school vacation, or moment of boredom.