Introduction: Simple Light Following Robot

Picture of 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

Picture of 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

Picture of Mount Motor Wheels

Mount wheels on motor axles

Step 3: Solder Protective Diodes to Motors

Picture of 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

Picture of 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

Picture of 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.

Step 7:

Picture of

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

Picture of 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

Picture of 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

Picture of 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

Picture of 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

Picture of 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

Picture of 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

Picture of 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

Picture of 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

Picture of 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

Picture of 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

Picture of 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

Picture of 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!

Comments

EllaH18 (author)2017-04-09

This may sound like an amateur question, but how can I tell which pin is the drain pin on the transistor?

fqantonio (author)2015-09-30

How fast they should switch, the diodes?

SarmanS (author)2015-08-11

hi i am gathering a team of people with very specific talents with goal to make miniature swarm robots . my design till now is almost 50 similar to what you have accomplished in this instructible . if you want to join . contect me . or if you know someone else who can . provide info.

will be happy to state you as co author in resurch paper about this work if you join .

sarman(dot)shah(at)gmail.com

live long and prosper.

iamtojo (author)2015-04-25

Would this work with a single potentiometer to adjust the sensitivity if it was the last thing in the circuit before the battery ground? Or in your experience was it important to be able to adjust the potentiometers individually?

instructable neha (author)2015-02-28

adwivedi11 (author)2015-01-16

potiometer is 3 way switch or something else??? please tell me!

schel (author)2014-01-28

Hi Great Instructable! I swear I checked all the comments first before I ask this, I'm sure someone has before I, Is there any way to reverse this ciruit? I want the robot to STOP when the Photos' receive light. In other words, if the 'bot is in the dark...it should THEN move until it finds light or turns to face it, then stop. as if it wants to charge it's solar cells ya' know? since the motors are "triggered" only in light it would be running for the dark. Much Thanks!!

QuantumRich (author)schel2014-11-16

You could swap out the NMOS with a PMOS transistor. That way, the motors will run until light turns off (instead of on) the transistors.

Mr.What (author)schel2014-07-28

Missed the earlier notification. If you swap the motor leads you can get a bot that runs away from a light, but stands still in the dark. You would "push" it around with a flashlight, instead of having it follow one. You will find that such a pusher is a little harder to control than a follower.

CRASH MA5TER (author)2014-07-28

To make*

Mr.What (author)CRASH MA5TER2014-07-28

Depends on how many spare parts you have around. Shipping will be an issue if you don't stock things. I can do it for about $5. $1 ea for motors. $0.10 each for transistors. $0.25 each for potentiometers. About $0.20 each for CdS cells, these are mostly only available as surplus. Cheap in bulk... bags of 100 or so. $0.25 for battery connector, $1 for battery. I have resistors, tape, wire, little tubes laying around. Solder. Hot glue.

CRASH MA5TER (author)2014-07-28

About how much is it toke one

dasharhasevak (author)2013-08-20

Hey, this is a fantastic project. I loved the way you explained all the details of the project......

Mr.What (author)2013-03-04

Any small(ish)-signal n-channel mosfet will do. 200mA peak should be sufficient. I used several (whatever we had around the lab). 2N7000 will do http://www.goldmine-elec-products.com/prodinfo.asp?number=A20384
vn2222, for more power... bs170, for MASSIVE power (20A?) these are cheap (around $0.50 ea) http://www.digikey.com/product-detail/en/NTD5867NL-1G/NTD5867NL-1GOS-ND/2401422

srao10 (author)2013-03-03

which N-Channel MOSFET???

killbox (author)2012-05-24

I believe that is cut up "screendoor/storm window Spline" being used for the wheels. but anything that grips well will work.

Mr.What (author)killbox2012-05-24

killbox: you ringer. you know it is screen holder... I got it from you! You could punch a hole in almost any rubber, and I bet there are grommets around that will work.

About This Instructable

73,008views

125favorites

License:

Bio: Degrees in EE, specializing in Digital Signal Processing. Working as a software engineer for 20+ years.
More by Mr.What:Roasted Basil PestoArduino IR Sensor TimerBasic tank-drive robot control over Bluetooth using mbed with the Freescale K64F
Add instructable to: