Auto-generated version

Build a Light Following Robot

Circuit description

This is the circuit diagram for the light sensitive motor driver. The light sensor for the right motor is on the left, and the light sensor for the left motor is on the right. The sensors are cross-wired to the opposite motor's transistor gate.

The light dependant resistor (LDR or CdS since the sensor is made of Cadnium Sulfide) will have a resistance of around 10K ohms in dark shade to around 100 ohms when pointed at a lamp. These resistances can vary depending on the size of the CdS cell. Large cells will often have lower resistances when placed near a lamp.

The CdS cell forms a voltage divider with the potentiometer. This potentiometer can be of a smaller value with a large CdS cell, and a larger value for small CdS cells.

When light hits the sensor, its resistance goes down, raising the voltage at the transistor gate. When this voltage passes the trigger voltage, Vgs(th), it creates a conduction path from the transistor drain to the source. For some of our more sensitive N-Channel MOSFET transistors, this voltage is around 1 volt. A typical threshold voltage is around 2 to 3 volts.

The sensitivity of the light detector can be controlled by the potentiometer.

Parts and Tools

  1. Two small DC motors, with fairly long shafts.
  2. Three popsicle sticks
  3. Two potentiometers, around 10K
  4. Two (matched) CdS cells
  5. Insulated wire
  6. Two N-Channel MOSFETs
  7. Two diodes, preferably fast switching type
  8. Tube or shrink-tubing to use for wheels
  9. [optional] 1/2 ping pong ball, or metal thumb-tack, to use for rear skid.

  10. Hot glue, and hot glue gun
  11. Solder, soldering iron
  12. Multimeter (to select CdS cells)
    Not necessary if CdS cells were pre-selected.


  1. Select matching CdS cells
  2. 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.

  3. Mount Wheels on motor axles
  4. 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.
  5. 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.
  6. Locate the drain pin on two transistors, and bend it away from the other two pins.
  7. 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.
  8. Arrange the potentiometers as they will be mounted on the robot. One on the left, one on the right, facing forward.
  9. Photo is shown after mounting to frame, but solder the transistors to the pots like this, with the wires attached before mounting. It is much easier to do this soldering before mounting on the frame.
  10. 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.
  11. 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.
  12. In 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.
  13. 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.
  14. 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.
  15. Flip the motor assembly over, and glue another craft stick to the other sides of the motors for added strength.
  16. 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.
  17. 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.
  18. 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.
  19. 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.
  20. When aligned, wait for the glue to harden.
  21. Hold the robot tail down on the table.
  22. 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.
  23. Repeat for the other potentiometer assembly
  24. 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.
  25. Repeat for the other NON-stripe motor-diode lead to the corresponding bent transistor drain pin.
  26. 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.
  27. 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.
  28. Solder the positive battery terminal wire (red) to a diode lead toward the striped side of the diode.
  29. Take the remaining source wires that were soldered to the transistors, and solder them together with the minus (black) lead on the battery connector.
  30. Plug in battery and test.
  31. Adjust pointing direction of sensors, and sensitivity.

Aaron Birenboim
Last modified: Thu Apr 5 08:00:07 MDT 2012