Support for Science Buddies provided by:
 Science Projects Project Guides Ask An Expert Blog Science Careers Teachers Parents Students

# Build a Speedy Light-Tracking Robot (BlueBot Project #2)

Recommended Project Supplies
Get the right supplies — selected and tested to work with this project.
 Difficulty Time Required Short (2-5 days) Prerequisites You will need to know how to use a breadboard to do this project. See the Science Buddies reference How to Use a Breadboard if you have not used a breadboard before. Material Availability A kit is available from our partner Home Science Tools. Cost High ($100 -$150) Safety Short circuits can get very hot and present a burn hazard. Be careful to follow the directions in the Procedure in order to avoid short circuits when building your robot.

## Abstract

Have you ever seen a cat chase a laser pointer or a flashlight beam? What if you could make a robot do that? In this project, you will build a robot that can automatically drive toward a bright light source. The robot uses a simple electronic circuit to track light, so there is no computer programming required! You can also do three other robotics projects using the same kit of parts, so this is a great way to get started with robotics before moving on to more advanced projects.

## Objective

Build a light-tracking robot and make adjustments to improve the robot's performance.

## Credits

Ben Finio, PhD, Science Buddies

Thanks to Howard Eglowstein, Science Buddies, for help with circuit design.

General citation information is provided here. Be sure to check the formatting, including capitalization, for the method you are using and update your citation, as needed.

### MLA Style

Science Buddies Staff. "Build a Speedy Light-Tracking Robot (BlueBot Project #2)." Science Buddies, 21 Sep. 2018, https://www.sciencebuddies.org/science-fair-projects/project-ideas/Robotics_p022/robotics/light-following-robot. Accessed 20 May 2019.

### APA Style

Science Buddies Staff. (2018, September 21). Build a Speedy Light-Tracking Robot (BlueBot Project #2). Retrieved from https://www.sciencebuddies.org/science-fair-projects/project-ideas/Robotics_p022/robotics/light-following-robot

Last edit date: 2018-09-21

## Introduction

Have you ever wanted to build your very own robot, but did not know where to start? In this project, you will build a fun, relatively simple robot, with no computer programming required. The robot in this project uses light sensors, which are electronic components that can detect light; they will help the robot follow a flashlight beam—just like a cat uses its eyes to track a laser pointer. Figure 1 and the video show what the robot looks like and how it works.

Figure 1. The light-following robot that you will build in this project.

A demonstration of the light-following robot.

Can you figure out how you would steer the robot, based on watching the video? Figure 2 shows a diagram of how the robot reacts to a flashlight. A flashlight can be used to "guide" the robot by steering it forward, left, or right.

Figure 2. A diagram showing how the robot reacts to light.

How exactly does this work? The robot uses a special electronic circuit to control the speed of two motors through the use of two light sensors. The motors are connected to the robot's wheels, which allow it to drive around. Figure 3 shows a simplified diagram of this process (continue reading for a more detailed description of the circuit). If both light sensors detect the same amount of light, the wheels spin at the same speed, so the robot goes straight. If one light sensor detects more light than the other, one wheel will spin faster, which will make the robot turn.

Figure 3. A simplified diagram of how the robot works. The robot's circuit detects bright light (for example, from a flashlight). The circuit then sends electrical signals to the robot's motors to turn them on. The motors drive the robot's wheels, which make the robot move and steer.

Technical Note

The rest of the Introduction contains more details about the electronic components used in the circuit. The following information is provided as a reference, and you do not need to fully understand it in order to do the project. If are ready to just start building the robot, you can move on to the Procedure.

If you would like to read the rest of the Introduction, it will help if you are familiar with basic electronics terms like voltage, current, and resistance. Science Buddies has many beginner and intermediate level electronics projects, an Electronics Primer, and an Electricity, Magnetism, & Electromagnetism Tutorial that can help you learn more about these topics. You can also refer to the Bibliography for more information.

For a complete technical explanation of how the circuit works, including a circuit diagram, see the Help section.

The circuit you will build in this project uses a variety of electronic components. All of the components are combined on a chassis, or plastic base for the robot, which includes wheels. Some of the components, like batteries and switches, you probably use every day (even if you do not notice it). Others, like diodes and transistors, might be new to you if you have not done an electronics project before. Table 1 has pictures and descriptions of each component you will use in this project. For a more detailed explanation of what each component does in the circuit, see the Help section.

Item namePicture Description
Battery pack
This is the power supply for your robot. Battery packs come in all shapes and sizes. The one in this project holds 4 AA batteries.
A breadboard allows you to quickly and easily connect wires and electronic components in order to build a circuit. The connections are not permanent, so you can easily move things around if you make a mistake.
Switch
You use switches every day to turn lights and appliances on and off. This is a tiny switch that fits on a breadboard, to let you turn your robot on and off.
Jumper wire
Jumper wires are short wires used to make electrical connections on a breadboard. They come with many colors of plastic insulation, which makes it easy to color-code and organize complicated circuits.
DC Motor
Electrical current causes a motor to spin. Two motors drive the robot's wheels. This type of motor runs on direct current (DC) from a battery (as opposed to alternating current [AC] from a wall outlet).
MOSFET
A MOSFET is a special type of transistor, which acts like a control valve to let electrical current flow. As an analogy, think of how a valve can control the flow of water through a garden hose. In this circuit, the MOSFETs control the flow of current through the motors. See the Help section for more detailed information about MOSFETs, including what MOSFET stands for.
Diode
A diode is like a one-way valve for electricity. It only lets current flow in one direction. In this circuit, diodes are used to protect the MOSFETs from voltage spikes that can be caused by abruptly stopping the motors.
Potentiometer
A potentiometer is a type of variable resistor. Resistors resist the flow of electrical current. Turning the knob adjusts its resistance. In this circuit, potentiometers are used to adjust the robot's sensitivity to light levels.
Photoresistor
A photoresistor, also called a "photocell" or "light-dependent resistor (LDR)", is a resistor that is sensitive to light. In darkness, it has a very high resistance. In bright light, it has a very low resistance. In this circuit, two photoresistors are used to detect light and help the robot steer.
Table 1. Pictures and descriptions of each circuit component used in this project.

So, how exactly do you combine all of these different components into a circuit that allows you to steer a robot left and right? There are two main parts to the circuit that can be connected together:

• The potentiometer and photoresistor (which are both a special type of resistor) are combined to make something called a voltage divider (see the Help section for more details about voltage dividers). The photoresistor is used to detect light. When the photoresistor does not detect much light, the voltage divider outputs a low voltage. When the photoresistor is exposed to bright light, the voltage divider outputs a high voltage. The potentiometer is used to adjust the threshold between "bright" and "dim" light (you will learn more about this in the Procedure).
• The MOSFET acts like a valve that controls the motor. When the input of the MOSFET receives a low voltage, the motor is off. When the input of the MOSFET receives a high voltage, the motor turns on.

Can you see how these two things can be connected to control a robot that responds to light? The trick is to connect the output of the voltage divider to the input of the MOSFET. Figure 4 shows a diagram of this process.

Figure 4. A diagram illustrating how the circuit works.

Remember that the robot actually has two copies of this circuit, one on the left and one on the right. A light sensor that detects more light will cause the motor to spin faster. So, when the two sensors detect different light levels, one motor will spin faster than the other, causing the robot to turn.

There are different factors that influence the robot's performance. The potentiometers are used to adjust the sensitivity of the light sensors (meaning, change the voltage they output for a certain amount of light). The photoresistors are on long, flexible leads (kind of like antennas) that let you aim them in different directions. How do you think these factors could affect how the robot performs? In this project, you will build your own robot and find out. Move on to the Materials and Procedure sections to get started building your robot.

Remember that if you would like a complete technical explanation of how the robot works, including a full circuit diagram, see the Help section.

## Terms and Concepts

• General electronics and robotics terms:
• Robot
• Light sensor
• Circuit
• Voltage
• Current
• Resistance
• Chassis
• Circuit components:
• Battery pack
• Barrel jack
• Switch
• Jumper wires
• DC motor
• MOSFET
• Transistor
• Diode
• Potentiometer
• Resistor
• Photoresistor
• Advanced terms (see Help section):
• Voltage divider
• Ohm's law
• Gate
• Drain
• Source
• Threshold voltage
• Saturation
• N-channel MOSFET
• P-channel MOSFET

### Questions

• What is a robot? What different kinds of robots are there, and what do they do?
• How can light sensors be used to steer a robot?
• How do you think adjusting the robot's sensitivity to light will affect its steering?
• How do you think adjusting the aim of the light sensors will affect the robot's steering?
• How does a voltage divider work?
• How does a MOSFET work?
• How does the robot's circuit work?

## Bibliography

These beginner references will be useful if you are just starting out with electronics and robotics:

These references contain specific information about some of the circuit components used in this project:

## News Feed on This Topic

, ,
Note: A computerized matching algorithm suggests the above articles. It's not as smart as you are, and it may occasionally give humorous, ridiculous, or even annoying results! Learn more about the News Feed

## Materials and Equipment

• BlueBot: 4-in-1 Robotics Kit, available from our partner Home Science Tools. You will need the following components from the kit (the kit also contains additional parts for three other projects). See the Background tab for pictures if you are not sure what a part looks like.
• Blue plastic robot chassis (includes wheels, motors, and 4xAA battery holder)
• AA batteries (4)
• Jumper wire kit
• Power switch
• Diodes (2)
• MOSFETs (2)
• Photoresistors (2)
• 10 kΩ potentiometers (2)
• You will also need the following materials, not included in the kit:
• Flashlight
• Double-sided foam tape
• Scissors
• Lab notebook
• Optional: Wire cutters (can be used to shorten the metal leads on some parts of your circuit, making the circuit "neater")
• Optional: Needle-nose pliers or tweezers (will make it easier to handle small circuit components)

## Recommended Project Supplies

Get the right supplies — selected and tested to work with this project.
Project Kit: \$109.95

## Remember Your Display Board Supplies

 Poster Making Kit ArtSkills Trifold with Header Poster Lights

Build a Speedy Light-Tracking Robot (BlueBot Project #2)

## Experimental Procedure

Note: This engineering project is best described by the engineering design process, as opposed to the scientific method. You might want to ask your teacher whether it's acceptable to follow the engineering design process for your project before you begin. You can learn more about the engineering design process in the Science Buddies Engineering Design Process Guide.

1. Follow the instructions in the video to assemble your robot chassis.
1. Your kit comes with printed directions for assembling the chassis, but we recommend watching the video so you fully understand how all the parts fit together.
2. The blue plastic parts come with a thin layer of protective plastic coating. Peel this coating off before assembling your chassis.
3. We also recommend using double-sided foam tape to attach the battery holder to the top of the chassis, as shown in Figure 5. The printed directions recommend putting the battery holder in-between the two chassis plates, but this makes it harder to change the batteries.
4. You will have some extra parts when you are done, including screws, nuts, and blue plastic gears. Put these parts aside for now; you will not need them for this project.

Figure 5. A completed BlueBot chassis with breadboard and battery pack on top.

Figure 5. A completed BlueBot chassis with breadboard and battery pack on top.

1. To build your circuit, you will need to know how to use a breadboard. Watch the video and see the Science Buddies reference How to Use a Breadboard to learn how to use a breadboard.
1. Remember to push all components firmly into the breadboard.
2. All references to orientation (up, down, left, and right) assume you have the breadboard "right-side up," so the writing is facing you.
3. Your jumper wire kit comes with an assortment of colors, and the colors may vary. It does not matter what color jumper wires you use. Your colors do not need to match the colors in the diagrams. In general, you should use the shortest wires possible, to help keep your circuit neat.
4. Insert the batteries last. If you see or smell smoke when you insert the batteries, you have a short circuit somewhere. Immediately remove the batteries and re-check your wiring.
Component Picture Symbol Breadboard holes Note
Power switch
F1, F2, F3 The direction in which it is facing does not matter, but make sure to slide the switch down (toward row 30, away from row 1), this is the "off" position.
Jumper wire
J2 to (+) bus Color does not matter.
Jumper wire
J12 to (-) bus Color does not matter.
Jumper wire
J19 to (-) bus Color does not matter.
Jumper wire
Left side (+) bus to right side (+) bus Color does not matter.
Jumper wire Left side (-) bus to right side (-) bus Color does not matter.
Potentiometer G11, G12, G13 Direction matters; pins should be on the left.
Potentiometer G18, G19, G20 Direction matters; pins should be on the left.
Jumper wire E11 to F11 Color does not matter.
Jumper wire E18 to F18 Color does not matter.
MOSFET C11, C12, C13 Writing should face to the left, large silver tab should face to the right.
Note: the writing on your MOSFET may differ from the picture. This is OK.
MOSFET C18, C19, C20 Writing should face to the left, large silver tab should face to the right.
Note: the writing on your MOSFET may differ from the picture. This is OK.
Jumper wire A13 to (-) bus Color does not matter.
Jumper wire A20 to (-) bus Color does not matter.
Photoresistor A11 to (+) bus Direction does not matter.
Photoresistor A18 to (+) bus Direction does not matter.
Diode A12 to (+) bus Gray band must face to the left.
Diode A19 to (+) bus Gray band must face to the left
Top motor Red lead to (+) bus
When the robot is driving forward, this is the "right" motor.
Bottom motor Red lead to (+) bus
When the robot is driving forward, this is the "left" motor.
Battery holder Red lead to J1
Do not insert batteries until the circuit is complete.
AA battery N/A Insert into battery holder. Make sure (+) signs on batteries line up with (+) signs in battery holder.
Table 2. List of circuit components and locations. A printable PDF version is available.

#### Slideshow with step-by-step instructions viewable online.

Click through the slideshow for step-by-step breadboard diagrams of the circuit.

Figure 6. Your completed circuit should look like this.

### Testing the Robot

You are finally ready to start testing your robot! Remember that now you will need to follow The Engineering Design Process to get your robot working. Follow these steps to learn how to use your robot.

1. Double-check your circuit against the breadboard diagrams in the previous section. Remember that just one misplaced wire can prevent the circuit from working properly.
2. Hold the robot's chassis in one hand so the wheels are off the ground. Turn the robot's power switch "on" by sliding it up, toward row 1 on the breadboard. Check Table 3 to see what you should do next.
Observation What to do
I see or smell smoke. Immediately turn your robot off. You have a short circuit somewhere. Re-check your wiring against the breadboard diagrams in the previous section.
The wheels spin forward. Your robot works! Move on to the next step.
One or both wheels spin backwards. Reverse the red and black wires for that motor if a wheel is spinning backwards.
The wheels do not spin at all. Try holding the robot's light sensors up to a bright light. Turn the potentiometer knobs all the way clockwise. The wheels should start spinning.
The wheels still do not spin. Part of your circuit is connected incorrectly. Re-check your circuit against the wiring diagrams, and see the Help section for more details.
Table 3. What to do the first time you turn on your robot.
1. The potentiometers adjust your robot's sensitivity to ambient light levels (the normal light levels in a room). Your goal is to make sure the robot does not respond to regular ambient light, and that it does follow around a brighter flashlight beam.
1. Turn both potentiometers all the way counterclockwise. This should turn the motors off (for more information on how the circuit works, see the Help section).
2. Slowly turn the potentiometers clockwise, one at a time. This gradually increases the circuit's sensitivity to ambient light. Eventually, the motors should start spinning slowly.
3. Turn the potentiometers slightly counterclockwise again, until the motors just turn off. You have set the motors just below the threshold for detecting ambient light.
4. Now, aim a flashlight directly at your robot's light sensors, or hold the robot very close to a light. This brighter amount of light should activate the sensors and cause the motors to spin.
5. Depending on the lighting in the room, you may need to continue to adjust the potentiometers slightly. For example, an open window on a sunny day or a bright lamp in a corner might cause the robot to move. Your goal is to make sure the robot does not respond to these light sources, and that it only responds to your flashlight. If your potentiometers are adjusted asymmetrically (one is turned farther than the other), this may cause your robot to steer more in one direction.
2. Put the robot on the floor and try guiding it with a flashlight. Make sure you aim the flashlight at the photoresistors and not at the front of the robot or the floor in front of the robot. Can you control whether the robot goes forward, left, or right? It might be rather difficult to steer; go to the next step to find out why.
3. The photoresistors have long, flexible leads that let you adjust their aim. Which way they are facing can have a big impact on how easy the robot is to steer. If they are right next to each other, they will always get hit by the same amount of light, so it will be very hard to steer the robot left or right. If they are too far apart, it will be hard to illuminate them evenly, so it will be hard to make the robot go straight. You can also adjust whether they are aimed forward or up, straight ahead or outward, or even diagonally. Try adjusting the photoresistors to different positions, and see which position makes it the easiest to steer your robot. Figure 7 shows several different positions for the photoresistors.

Figure 7. Different positions and orientations for the photoresistors. Top left: Photoresistors close together, facing forward. Top right: Photoresistors spaced apart, facing forward. Bottom left: Photoresistors spaced apart, facing upward. Bottom right: Photoresistors spaced apart, facing diagonally outward.
1. Continue to make adjustments to the photoresistors and potentiometers until you can easily guide your robot around with a flashlight. Can you navigate the robot through a maze or obstacle course using the flashlight?
2. There are several other robotics projects you can do with your chassis. See the Variations section for some ideas.

### Explore More!

Looking for more robot fun? Explore the World of Robotics with This Suite of Projects!

### Troubleshooting

For troubleshooting tips, please read our FAQ: Build a Speedy Light-Tracking Robot (BlueBot Project #2).

## 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

### 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

### 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

### 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

## Variations

• There are three other projects you can do with your BlueBot kit. Since you have already assembled your chassis, all you need to do is build a new circuit.
• Use the long male-female jumper wires that came with your kit, and mount the light sensors to the front of your robot's chassis, angled down toward the floor. Can you now get the robot to "chase" a flashlight beam aimed at the floor in front of it (kind of like a cat chasing a laser pointer)?
• A "bristlebot" is a small robot that uses vibration motors instead of geared DC motors, and toothbrush heads instead of wheels. You can put the same circuit you used in this project on a bristlebot to build a miniature version of the robot. See the Science Buddies project Build a Light-Tracking Bristlebot for directions.
• The Arduino is a very popular type of microcontroller used in robotics. It lets you write a computer program that can read inputs from sensors and use them to control motors. This gives you more precise "control" over you robot's behavior. Can you build a programmable light-tracking robot by adding an Arduino to your chassis? See our Getting Started with Arduino page to learn more.

### Explore More!

Looking for more robot fun? Explore the World of Robotics with This Suite of Projects!

## Share your story with Science Buddies!

Q: My wheels do not spin at all. What should I do?
A: If your wheels do not spin at all when you turn the robot on and expose it to light, there are several troubleshooting steps you can try:
• Double-check your circuit to make sure that it exactly matches the breadboard diagrams from the Procedure.
• Make sure all of your jumper wires and component leads are pressed firmly into the breadboard. You can read about other common breadboard mistakes in the the Common Mistakes section of the Science Buddies reference How to Use a Breadboard.
• Make sure your batteries are properly inserted into the battery pack, and that the "+" symbols on the batteries line up with the "+" symbols on the battery pack.
• Make sure the power switch for your robot is toggled "on" (the slider should be pushed toward row 1 at the top of the breadboard).
• Turn both potentiometers all the way clockwise, then hold the robot directly up to a bright light source. Do the wheels spin?
• If not, turn both potentiometers all the way counterclockwise (just in case you put them in the breadboard backwards). Hold the robot directly up to a bright light source. Do the wheels spin?
• If you have been using your robot for a long time, or did some of the other BlueBot projects first, your batteries may be dead. Try putting fresh batteries in your robot if none of the other steps work.
• If your robot still does not turn on, follow these steps to see if the problem is with your power switch:
• Remove the power switch from the breadboard, flip it around, and put it back into the same breadboard holes (F1, F2, and F3). If you are confused about which way to rotate the switch, see this video.
• Slide the power switch to the "on" position ("up" towards row 1 of the breadboard) and try testing your robot again. If your robot works after making this change, you can continue with the project, but please contact us at scibuddy@sciencebuddies.org to let us know this happened.
• If your robot still does not work after flipping the power switch around, bypass the power switch entirely. Connect the battery pack's red lead directly to the breadboard's power bus instead of hole J1. This connects the battery pack directly to the rest of the circuit. To turn the robot off again, you will have to temporarily disconnect this wire.
• If your robot still does not work, even after you have tried the previous steps, the problem is elsewhere in your circuit and not with the power switch. If you are having trouble figuring out what is wrong with your robot, you can ask a question in our Ask an Expert: Answers to Your Science Questions forums.
Q: Only one of my robot's wheels is spinning. What is wrong?
A: Your robot's circuit consists of two identical halves that drive the two motors. If only one wheel is spinning, chances are you just have something placed incorrectly on the breadboard in one half of the circuit. Very carefully double-check all of your writing on the side of the motor that is not working. It only takes one misplaced component or jumper wire to prevent the motor from spinning!
Q: My robot is going backwards! What should I do?
A: If your robot is driving away from light instead of toward it, all you need to do is switch the breadboard connections of the red and black leads from each motor. This is shown in Figure 8.

Figure 8. On the top, the motor's red wires are connected to the power bus, and the black wires are connected to the MOSFET's drain pins (holes E12 and E19). If this configuration makes your robot drive backwards, just switch the red and black wires for each motor, to match the image on the bottom. Connect the black wires to the power bus, and the red wires to the MOSFET drains. Do not worry about violating standard color-coding conventions; all this does is reverse the direction in which the motors spin.
Q: I have double-checked everything and my robot still does not work. How can I check if something is broken?
• Try plugging your motor's leads directly into the buses on your breadboard (for each motor, one lead to the power bus, one lead to the ground bus). If the motors turn on, then you know that they are working, and the problem is elsewhere in your circuit. If the motors do not turn on, that does not necessarily mean they are broken. There might be a problem with your power supply (see next point).
• Set your multimeter to measure DC volts. Four fresh AA batteries should provide just over 6 V.
• Turn your power switch on and measure the voltage between the breadboard's buses. If you do not read a voltage, there may a problem with your power switch (see the first question in this FAQ), but you should also double check that your power switch and the red jumper wire from hole J2 to the power bus are in the right place.
• Unplug the red and black battery pack leads and measure the voltage of the battery pack directly. If you get a reading, then you know your battery pack is working, and the problem is with your breadboard connections or the power switch. If you do not get a reading, make sure all the batteries are in the correct orientation in your battery pack, and that none of the metal clips and springs that hold the batteries in place are loose.
• Check the output of the light sensor.
• Measure the voltage between the first MOSFET's gate (row 11 on the left side of the breadboard) and ground. This is the output of the light sensor. The voltage should change when you turn the potentiometer. It should also change when you shine bright light on the photoresistor. If the voltage does not change at all, then your photoresistor and potentiometer may be wired incorrectly. Repeat this for the second half of the circuit (MOSFET gate at row 18).
• If the voltages changes, and goes above roughly 3–4 V with bright light, then your motors should turn on. If you previously checked to make sure your motors work (see above), and they still will not turn on, then the problem is elsewhere in your circuit. You know the individual components are functioning so nothing is "broken." Double and triple-check all your breadboard connections. Remember that just one misplaced wire can prevent the whole circuit from working.
Q: How does the light sensor work?
A: In order to make a light sensor, the photoresistor and potentiometer are combined to make a voltage divider. A voltage divider is a simple circuit made from two resistors, R1 and R2 (Figure 9). It takes an input voltage (Vin) and outputs a different voltage (Vout), according to Equation 1 (which can be derived based on Ohm's law—see the Bibliography):

Equation 1:

• Vin is the input voltage in volts (V).
• Vout is the output voltage in volts (V).
• R1 is the first resistance in ohms (Ω).
• R2 is the second resistance in ohms (Ω).

Figure 9. Circuit diagram for a voltage divider.

In your circuit, the photoresistor will be R1 and the potentiometer will be R2. Remember that the resistance of a photoresistor decreases when it is exposed to bright light. From Equation 1, we can see that when R1 is very large (R1 >> R2), Vout gets very small (Vout << Vin). When R1 is very small (R1 << R2), Vout is roughly equal to Vin (Vout ≅ Vin). This means that the light sensor outputs a high voltage when it detects light, and a low voltage when it does not.

Q: How does a MOSFET work?
A: MOSFET stands for metal-oxide-semiconductor field-effect transistor (so you can see why it is a lot easier just to say "MOSFET"). The three pins of a field-effect transistor are called the gate, drain, and source. Unlike a bipolar transistor, which is controlled by a small current applied to the base pin, a field-effect transistor is controlled by a voltage applied to the gate pin, but the gate does not actually draw any current. A voltage applied to the gate causes current to flow between the drain and source pins.

Figure 10 shows a simplified explanation of how a MOSFET works. A votage is applied to the gate pin in order to control the flow of current between the drain and source pins. When the voltage between the gate and source pins (VGS) is below a certain limit, called the threshold voltage (Vth), no current flows. When VGS exceeds Vth, the MOSFET begins to conduct, allowing current to pass through. This is what allows you to use the gate voltage of a MOSFET to turn a DC motor on and off. For this robot, the MOSFET's gate voltage is controlled by the voltage divider.

Figure 10. Simplified explanation of a MOSFET's operation.

The exact description of how a MOSFET works is more complicated than this. As VGS increases past Vth, the current through the MOSFET will continue to increase. Eventually the MOSFET will reach saturation, where no additional current can flow, even if VGS continues to increase. The MOSFET's behavior will also depend on the type of load to which it is attached. The MOSFET used in this project is an N-channel MOSFET, which requires a positive gate voltage to turn on. A P-channel MOSFET requires a negative gate voltage to turn on. Advanced users can refer to the Bibliography for more information on MOSFETs.

Q: How does the circuit work? What is the circuit diagram?
A: The two questions above explain two key components of the circuit: voltage dividers and MOSFETs. How do you combine these, along with all the other components listed in Table 1, into a single circuit that can control two motors to allow a robot to steer left and right in response to light? Figure 11 shows the complete circuit diagram for the entire robot (refer to the reference "How to Read a Schematic" in the Bibliography if you are not familiar with circuit diagrams). Look closely and you will see that it is actually two copies of the same circuit, one for each motor.

Figure 11. A complete circuit diagram for the light-following rbot.

The circuit diagram might look confusing at first, but if you look closely (refer to the symbols in Table 3 if necessary), you will see that it just consists of things you have already read about. Let us just look at the left-hand side of the circuit (the same explanation applies to the right-hand side):

• The battery pack supplies a voltage Vbatt to the circuit. For this project, you will use four AA batteries, which provide about 6 V.
• The switch controls whether or not the battery pack's positive terminal is connected to the circuit. When the switch is open, V1 is "floating" (not connected to anything), so the circuit has no power. When the switch is closed, V1 is equal to the battery voltage.
• The photoresistor (R1) and potentiometer (R2) form a voltage divider. The input to this voltage divider is V1, and the output is V2.
• The potentiometer can be used to tune the voltage divider's output (can you figure this out by examining how Equation 1 depends on R2?). This allows you to adjust the robot's sensitivity to ambient light levels.
• The output of the voltage divider is connected the input (the gate) of the MOSFET. The source of the MOSFET is connected to ground (0 V). So, for this circuit, VGS = V2. When V2 exceeds the threshold voltage Vth, the MOSFET will turn "on."
• The motor is connected between the positive voltage supply and the MOSFET's drain pin. When the MOSFET is "off", the drain pin's voltage is close to the battery voltage, so no current can flow through the motor. When the MOSFET is "on", the drain pin's voltage drops, allowing current to flow through the motor, into the MOSFET's drain pin, then out of its source pin to ground.
• Finally, each motor has a diode connected across its terminals. Motors can create large voltage spikes when they abruptly come to a stop (this has to do with the relationship between electrical current and magnetic fields, if you want to do more research on the explanation). The diodes help prevent damage to the MOSFET by safely discharging the current generated by the voltage spike.
Q: What are the circuit diagram symbols for the components in this project?
A: Table 4 shows a picture, a breadboard diagram symbol, and a circuit diagram symbol (when applicable) for each component in the project.

Item namePicture Breadboard Diagram Symbol Circuit Diagram Symbol
Battery pack
n/a
Switch
Jumper wire
DC Motor
MOSFET
Diode
Potentiometer
Photoresistor
Table 4. A picture, a breadboard diagram symbol, and a circuit diagram symbol for each of the components used in this project.
Q: How did you make the breadboard diagrams for this project?
A: The breadboard diagrams for this project were created using Inkscape, a free vector graphics program. You can find free scalable vector graphic (SVG) files for many circuit components on Wikimedia Commons. There are other free programs specifically for making breadboard diagrams, such as Fritzing.

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 have purchased a kit for this project from Science Buddies, we are pleased to answer any question not addressed by the FAQ above.

1. What is your Science Buddies kit order number?
2. Please describe how you need help as thoroughly as possible:

Examples

Good Question I'm trying to do Experimental Procedure step #5, "Scrape the insulation from the wire. . ." How do I know when I've scraped enough?
Good Question I'm at Experimental Procedure step #7, "Move the magnet back and forth . . ." and the LED is not lighting up.
Bad Question I don't understand the instructions. Help!
Good Question I am purchasing my materials. Can I substitute a 1N34 diode for the 1N25 diode called for in the material list?
Bad Question Can I use a different part?

## News Feed on This Topic

, ,
Note: A computerized matching algorithm suggests the above articles. It's not as smart as you are, and it may occasionally give humorous, ridiculous, or even annoying results! Learn more about the News Feed

## 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.

Support for Science Buddies provided by: