Intro: Simple Light Following Robot
Build a simple light following robot with common low cost parts. You will need a soldering iron, hot glue gun, and an ohmmeter if you do not have matched light sensor cells. This robot will follow light from a flashlight. These parts are available at many electronics suppliers, and are common in on-line surplus outlets.
Parts and Tools:
1) Two small DC motors, with fairly long shafts.
2) Three popsicle sticks
4) Two potentiometers, around 10K
5) Two (matched) CdS cells
6) Insulated wire
7) Two N-Channel MOSFETs
8) Two diodes, preferably fast switching type
9) Tube or shrink-tubing to use for wheels
10) [optional] 1/2 ping pong ball, or metal thumb-tack, to use for rear skid.
11) Hot glue, and hot glue gun
12) Solder, soldering iron
13) Multimeter (only needed if you need to select CdS cells)
14) 9v battery plug
15) 9v battery
On-line surplus electronics stores often sell large bags of Cadmium Sulfide (CdS) light sensor cells, which are Light Dependant Resistors (LDRs) for reasonable prices. When using cells from such a grab-bag, you should be careful to select two matched cells with a similar resistance under both low and bright light. The values of these cells can vary significantly. Matching to within 10-20% is sufficient.
This robot is based off of two mirror-image motor driver circuits as shown here. The photocell on the left side drives the motor on the right, and vica-versa.
Step 1: Select Matching CdS Cells
If you are working from a grab-bag of cells, you will want to select two fairly similar photocells. If you purchased matched photocells, you can skip this step.
Measure the resistance of cell in dim, ambient light. Repeat this measurement pointing toward a lamp. The second measurement should be significantly lower.
Repeat this measurement on several cells until you find two which have similar values both under dim light and when pointed toward a lamp.
Step 2: Mount Motor Wheels
Mount wheels on motor axles
Step 3: Solder Protective Diodes to Motors
Motors can generate voltage spikes which can destroy the driving transistors. You should attach some doides to the motors to protect against these spikes. The diodes will also ensure that the motors drive in only one direction.
Place motors on table in a position similar to where they will be in the final robot, with the same side of each motor facing you. Lay the diodes on the motors such that the stripe is towards the inside. Solder the diodes in place.
Step 4: Check Motor Drive Direction
Power up each motor by placing the + lead on a battery on the motor tab toward the stripe on the diode, and the - lead on the other side of the diode. Make sure that one motor spins clockwise, and the other motor spins counter-clockwise. If this is not the case, reverse one of the diodes.
Step 5: Select Transistor Leads
Locate the drain pin on two transistors, and bend it away from the other two pins.
Step 6: Prepare Wires for Soldering
Strip about 3mm from the ends of 4 wires. The wires should be at least 5cm long each. Bend the stripped end of each of these wires into a small hook.
Arrange the potentiometers as they will be mounted on the robot. One on the left, one on the right, facing forward.
Arrange the transistors so that the gate and source pin are aligned with an edge and sweeper pin on each of the potentiometers. It will be desirable for the bent drain pin to point up (or forward) in this arrangement on the constructed robot.
If you potentiometers are dial or trimmer style, that is ok. Just give some thought to arranging the leads such that they will be easiest to attach to motor, transistor, and light sensor leads.
The photo shown here was taken after mounting the potentiometer/sensor assembly to the frame, but I have found that it is easier to do this soldering before mounting to the frame.
Step 8: Solder Transistor to Potentiometer
Hold the source pin of a transistor to the desired pin of the potentiometer, and help hold it in place with the hook of one of the wires. Solder this 3-way connection together.
n a similar manner, solder the gate pin to the corresponding leg of the potentiometer with a wire hook. It is best for the wires to head in opposite direction from these solder joints so that they are not likely to short when the robot bumps into things.
Step 9: Mount Motors to Frame
Place both motors in their desired relative locations on the finished robot, with the tab attached toward the striped end of the diode towards the center.
Put a generous dab of hot glue on each motor, and attach one side of the popsicle stick frame. You will have a few seconds to adjust the alignment before the glue cools. When the parts are aligned, wait for the glue to harden.
Flip the motor assembly over, and glue another craft stick to the other sides of the motors for added strength.
Step 10: Check Motor Drive Direction
Place the wheels of the motor assembly on the table and attach the + end of a battery to the motor tab attached to the striped end of one of the diodes. Attach a lead from the - side of the battery to the other side of the same diode. The motor assembly should try to drive away. Note which direction it drives. Place an X on the stick that the motor tries to drive away from.
Repeat for the second motor, making sure that both motors try to drive the frame in the same direction. Place an X marking the stick which will be the backward facing side of the frame. The pots and sensors will be attached to the other, frontward facing side of the frame.
Step 11: Attach Body to Motor Frame
Place the third craft stick where you will want it on the final robot. This stick usually forms a tail where the battery will be mounted, so most of the stick will extend out from the X side of the motor frame. Mark the desired locations on this stick where the motor frame sticks will cross.
Put a dab of hot glue on each of these lines, then balance the motor frame assembly on the third stick, in the pools of hot glue. You have a few seconds to check the balance and alignment of this stick to the frame before the glue begins to harden.
When aligned, wait for the glue to harden.
Step 12: Mount Sensor Assemblies
Hold the robot tail down on the table.
Place some hot glue on the forward facing side of the motor frame, and mount one of the potentiometer assemblies. Be careful that the placement of the hot glue does not interfere with the motion of the potentiometer adjustments.
Repeat for the other potentiometer assembly
Step 13: Solder Motor Lead to Transistor
Solder the bent drain pin on the transistors to the motor diode lead away from the stripe on it's corresponding motor.
If the two leads cannot reach, or cannot be connected without risk of shorting other leads, use a small length of insulated wire to make the connection.
Repeat for the other NON-stripe motor-diode lead to the corresponding bent transistor drain pin.
Step 14: Attach Light Sensors
Solder the diode leads towards the stripe on the motors together, and solder them to one side of the CdS sensors. If the leads are not long enough to place the sensors where you want, use an uninsulated wire to connect the stripe end of the diode leads together and extend forward to the location where you wish to the one lead from each of the sensors.
Step 15: Attach Other Lead of Light Sensors
Solder the wire to the gate pin of one transistor (center pin on TO-92 package) to the other lead of the sensor on the opposite side. Repeat for both sides. This is a criss-cross connection where each motor/transistor/potentiometer assembly is attached to the sensor on the opposite side
Step 16: Attach Battery Plug Positive
Solder the positive battery terminal wire (red) to a diode lead toward the striped side of the diode.
Step 17: Attach Battery Plug Negative
Take the remaining source wires that were soldered to the transistors, and solder them together with the minus (black) lead on the battery connector.
Step 18: Test
Plug in battery and test.
Shine a light on one sensor, and the opposite motor should spin.
Shade a sensor, and the opposite motor should stop.
Make sure that the potentiomenter is near the center position for this test. These tests will not work is the potentiometer is set at the limit such that there is no resistance between the potentiometer pins in use.
Step 19: Adjust Sensitivity
Adjust pointing direction of sensors, and move the potentiometers such that the motors are stopped with unilluminated, and the expected amount of light will start the motors running.
Sensors can be aligned to point towards the ground and follow a reflected light, given a higher sensitivity adjustment.
If the sensors are pointed up or ahead they can be adjusted to follow direct illumination from a flashlight.
With some work, they can even be adjusted to follow a light line on a dark surface!