Introduction: Simple Light Detector With Sensitivity Control

Picture of Simple Light Detector With Sensitivity Control

Light detectors are one of the most popular sensor and they are commonly found in many real-world applications. They are widely used by electronic hobbyists and projects because they are practical and intriguing yet surprising easy to construct. This instructable will guide and show you how easy it is to breadboard your own light activated Light Emitting Diode (LED) with minimal tools and materials. The whole project is simple enough for beginners and should take at most 10 minutes to construct. This implementation can be used for an educational demo or applied directly to the practical world.

Step 1: Gather Parts and Tools

Picture of Gather Parts and Tools
The following are the list of materials and tools required for this project. These are widely available and can be easily obtained from sites like All quantities are single unless specified otherwise.

  • Breadboard
  • A few Jumper Wires
  • 9 Volts Battery
  • 9 Volts Battery Clip
  • Light Dependent Resistor (LDR)
  • Light Emitting Diode (LED) with any color of choice
  • TLC3704 Quad Comparator (only one of its four comparators will be used) (Alternatively, you can use the single¬†LM311N Comparator with 8pin)
  • 3362P-103-ND 10K Ohms Variable Resistor
  • 1K Ohms (Brown-Black-Red) Resistor X2
  • 330 Ohms (Orange-Orange-Brown) Resistor
  • Variable Resistor Trimmer Pen (or a small screwdriver)
  • Needle-nose Pliers (not essential but useful for breadboarding)

Step 2: Understand How It Works

Picture of Understand How It Works

The schematic diagram for the circuit is given in the picture above.

Like its name suggests, a comparator compares two given voltages. The pair of 1K ohms resistors create a voltage divider and provide a 4.5 volts reference for the comparator. The variable resistor and LDR both form another pair for a second voltage divider. When light falls on the LDR, its resistance lowers and that voltage divider provides a voltage lower than 4.5 volts. The comparator produces no output (0 volts). When light is absent, the resistance of the LDR and the voltage increases. When the voltage increases over 4.5, the comparator activates its output and supplies 9 volts to power the LED.

An interactive flash animation of how the circuit works can be accessed by clicking here or on the file below.

Step 3: Install Shorter Components

Picture of Install Shorter Components
It is always easier to place the shorter components on the breadboard first before placing the taller ones. Hence we shall being with the shorter components.

1. Insert the TLC3704 Integrated Circuit (IC) Chip between the middle divider of the Breadboard.

Placing the chip between the divider ensures that its pins do not get short-circuited. Place its pins starting from the column labelled 6 until the 12th column on the breadboard. Make sure the half circle (pin 1 indicator) is towards the right side (Picture 1).

TIP: If the chip is brand new, gently bend the chip's two rows of pins inwards slightly to ease insertion into the board.

CAUTION: The pins of an IC are delicate and break off easily without gentle care.

2. Insert the Variable Resistor in the middle of the top row from column 2 to 4.

This variable resistor has 3 pins. We will only be using two. Inserte the center pin into row H and the other two pins into row G (Picture 2).

3. Insert two short Jumper Wires connecting J4 to J6 and G5 to G7.

The needle-nose pliers easily facilitates placement of these small Jumper Wires (Picture 3). Grip them gently by the middle and firmly push them through their designated holes. Placing these wires with bare hands is still possible but requires more time. After places these two short Jumper Wires, your board should look like the one in Picture 4.

4. Insert the remaining 4 longer Jumper Wires connecting J3 and J10 to the Positive Rail, F4 to E4, and A10 to the Negative Rail.

This completes the placement of all Jumper Wires (Picture 5).

Step 4: Install Taller Components

Picture of Install Taller Components
Now that we have laid out all the shorter components, we can proceed to finishing up with our taller components.

1. Bend the two legs of each resistor forming a U shape for easy insertion.

After bending the legs of your resistors, they should look like the ones in Picture 1.

TIP: It is better to use your bare hands to make smoother bends rather than using the pliers to make sharp ones. After repeated sharp bending with the pliers, the pins break off easily.

CAUTION: Never make a bend right at the point where the pin comes out of the component as pins will mostly likely break off after a few more of such bends.

2. Insert a 1K Ohm (Brown-Black-Red) Resistor across H5 and the Positive Rail.

Completing this step should give you Picture 2.

TIP: Resistors are not polarized components. This means that you can connect them any order you like and they would still function.

3. Insert the other 1K Ohm (Brown-Black-Red) Resistor across F5 and the Negative Rail.

Completing this step should give you Picture 3.

4. Insert last 330 Ohm (Orange-Orange-Brown) Resistor across G12 and D17.

Completing this step should give you Picture 4.

TIP: The only purpose this resistor severs is to limit the current powering the LED and protect it from burning out. Thus this resistor is paired in series together with the LED. This pair can be replaced with a 9 Volts Relay to activate a switch or trigger any event.

5. Insert the longer leg of the LED into position A17 and the shorter leg into the Negative Rail.

An LED is a polarized component. The longer leg indicates the positive terminal. Completing this steps gives you Picture 5.

Tip: If it is impossible to indicate your LED's polarity by the pin length (because of previous vicious clipping), look into the transparent casing of the LED. You will notice the two pins entering through the base and what appears to be two flags at the top of these two "flagpoles". The shorter flag corresponds to the positive terminal.

CAUTION: Ensure that your LED terminals are inserted correctly or your LED will not function.

6. Insert the LDR across A4 and the Negative Rail.

Like resistors, LDRs are not polarized. You can insert its pins without regard to polarity. You circuit should look like the one in Picture 6 when you have successfully completed this step.

Step 5: Connect the Power Supply

Picture of Connect the Power Supply
Before we can configure and test the circuit, we need to attach the 9 Volts Battery that will power our light detector.

1. Unwind and attach the Battery Clip to the 9 Volts Battery

If the 9 Volts Battery came with safety cap, remove it first. The Battery Clip should only allow you to snap it to the Battery in one orientation for the correct polarity (Picture 1).

2. Connect the Red Lead to the Positive Rail on the breadboard.

See Picture 2.

3. Connect the Black Lead to the Negative Rail on the breadboard.

This would instantly supply power to your light detector. The LED on your circuit may or may not light up depending on your Variable Resistor but do not worry about that, we will configure the circuit in the next step. Successful completion of this step should produce something close to Picture 3.

Step 6: Configure the Light Detector

Picture of Configure the Light Detector
This step will allow you to setup and adjust the sensitivity of your light detector for different working environments. Repeat this step as often as you need to change the sensitivity of your light detector.

1. Transfer circuit to a desired working environment.

A place with moderate but sufficient light is a good place to start for testing the circuit (Picture 1).

2. Turn the Trimmer of the Variable Resistor all the way clockwise with the Trimmer Pen (or small screwdriver).

At this point, if your LED has not already been lighted, it should light up (Picture 2).

3. Slowly turn the Trimmer counter-clockwise until the LED just turns off.

This is where you get to control the sensitivity of your light detector. For higher sensitivity, adjust trimmer as exact as possible to the point where the LED turns off. To decrease sensitivity, turn a little ways more after the LED has turned off.

CAUTION: Ensure that the LDR is not obstructed from the light source while you perform this step.

4. Remove the Trimmer Pen.

The light detector is now configured for this environment.

5. Cover the LDR with your hand to test the circuit.

The LED should come on as you cover the LDR. Covering the LDR simulates a darker or nighttime environment. The LED should turn on as it detects the absence of light (Picture 3).

Step 7: Take This Project Further

Picture of Take This Project Further

The fully functional light detector turns an LED on when it detects a lower intensity of light. It can be configured to be highly sensitive and is capable of detecting the slight lowering of the sun's intensity as it is partially covered by passing clouds. A direct application of the circuit would be to turn on a night light as your room light goes out or to keep a porch light on during the night. The 330K Ohm Resistor and LED can be replaced with virtually anything to trigger a signal or an event. For example, a 9 Volts Relay would be used to make an absence-of-light activated switch. To make this circuit operate in reverse (the LED turns on when there is light), simply just exchange the positions of the Variable Resistor and the LDR.


MohamedE415 (author)2017-05-09

I don't find TCL3704 ?

dnfh1949 (author)2016-11-23

That should have been "in parallel"!! So that when the reed closes it shunts the +ve pin of the comparator (pin 7) to earth. But does it need a resistor in series with the reed switch to limit any current (I assume the value would be about the same as the dark resistance of the LDR)?

dnfh1949 (author)2016-11-23

I would like to modify the circuit with a proximity reed switch so that the LED does NOT come on (or goes OFF) when a magnet gets near the proximity switch. I think I can just put the reed switch in series with the LDR. Would that work?

ChristopherL62 (author)2016-10-05

I built the circuit, but used a 12v power supply (2 6 volt lithium batteries in series) and a LM311N instead of the TLC3704, which should work the same.

I also used 6 LEDS and a 100ohm resistor in series for the "light".

I wired the LM311N correctly and used all the other specified components.

When I apply power, the output pin of the LM311N produces ~1.5 volts, no matter what the var.resistor is turned to, or with the lights off or on (LDR).

It should produce no voltage or the supply voltage, correct?

I tried another LM311N (I bought 5 of them), but same thing, about 1.5 volts.

I read on another site that pin 4 (Vee) should be grounded, but when I do that, I get no voltage from the output pin of the LM311N, adjusting var.resistor and lights on and off doesn't produce any voltage.

the LDR is a photocell with 16-33k ohm range.

The var. resistor is a 10K.

I tried adding a resistor to the Var. resistor side, but no difference.

I'm missing something, but can't figure it out.

Abhi909 (author)2016-01-31

great project

can i place your project on my website.

i'm working on a website which is related to electrical projects.

i also mention your name, link and other info.

plz reply

RaymartL (author)2015-12-18

and how can i put more than 1 led light .

RaymartL (author)2015-12-18

i have a project.. and this ones suits for it.., but i need to make a prototype., i will build a little house so i want the led to be the light bulb of the house so the wire of the led must be long., is there a way i can make it?. and i want to put the sensor in the side of the led.., and i want to just put the breadboard hidden somewhere inside the prototype house... how will i do that?

Diagram (author)2012-04-05

I have a LM311P comparator that looks just the same as the N version, but it won't turn on even though I followed the same step for the LM311N. Anything else I'm missing, or is the P version incompatible or needs to be adjusted?

Thanks for the ible though, it's great for beginners like me!

WolfKodi (author)Diagram2012-10-27

I have not actually tested it with LM311P but looking at the specs, they are indeed the same. P supports slightly higher switching speeds and lower operating voltages.

ccrown engel (author)WolfKodi2015-11-10

please tell me this projects short discription.

please tell me this prijects factionality

DanielTeixeira (author)2015-05-02

Do you share the code?

armgard (author)2015-04-23

Built this successfully in the light-on->LED on version. Would like to trigger a timer such as in which then sets off an alarm to remind me I turned on my kitchen stove before whatever I cook becomes coal. Do not quite understand how to trigger the timer. Have built that circuit and it stays on timing, doesn't switch to bleeper. Can anybody help, please?

smashhar (author)2015-03-13

Hey admin I'm not able to find the above said quad comparator but can I use LM311P comparator instead.

Shaddorry (author)2015-02-09

Nice but i'd like to try something and here comes my train of questions. Can the LDR be replaced by any sensor? let us say a piezo disc? And can the led be replaced by a "9v Power Off Time Delay Relay Circuit"? If yes, the last thing is like to know is can you use this system in someway on a domestic 220v, 40w light? The purpose of this is making vibration-sensitive tiles to trigger the light to go on and shut back of after a few seconds.

alviony.evelyn (author)2015-01-30

Hi.. my led light is on but the ldr doesn't seems to work, it doesn't detect the sensor but the light just on all the time.. how to solve this problem?

now i have solved the problem of on and off.. but mine was when my hands get closer it will off but when my hands further it will on.. how can i do it the other way round?

itachioo7 (author)2015-01-25

is there any way to make this without the TLC3704 ?

itachioo7 (author)2015-01-25

is there any way to make this without the TLC3704 ?

danial2494 (author)2014-09-08

what is that conclusion?

aayushsoni007 (author)2014-08-24

any way to make it more simple ??

anishshah09 (author)2014-05-18

Hi, I want to purchase a light detector which is capable of detecting lights while the detector is in motion at 120km/hr.

Any comments?

anishshah09 (author)2014-05-18


I am planning to install a light detector on fast moving cars at approximately 120km/hr. The signal from the detector will than be fed into a PLC.

Could you please recommend any pre-made sensors?

seedling2000 (author)2014-03-11

can we use 3296X-103 10K Ohm variable resistor instead of one mentione? if yes, please tell me the way it should be attached on the breadboard because all of its three pins are in a single line.... thnx

vomm (author)2014-02-27

HI There the circuit worked very well for me but the Diode is not completely off during bright light.

The negative output voltage from the comparator is probably giving that small light

vomm (author)2014-02-27

jbates13 (author)2014-01-23

I can not get this thing to work! I followed the instructions no dice,I am using a Radio Shack quadcomparator LM339 could that make a difference! Thank You

ssteet (author)2012-12-20


mouse0079 (author)2012-10-05

hi there, I would like to make this but frist I need to know what all to use for 120V as I would have it come on at sun rise and of at sun set and it would turn on the grow lamps (fluorescent bulbs) in my green house, this way I can take out the timer. any and all info would be nice. Thanks

WolfKodi (author)mouse00792012-10-27

You'll need a relay rated for switching 120 voltages. And you might want to hook the power supply to an adapter instead of using a 9V battery to save the trouble of replacing them when they run out.

mouse0079 (author)WolfKodi2012-10-28

Also I'm lost on this part " simply just exchange the positions of the Variable Resistor and the LDR " <--- in making the circuit operate in reverse . Sorry but this new to me and I would like to get it right the first time so I need to know what pin gose where being the Variable Resistor has 3 and the ldr has 2.

WolfKodi (author)mouse00792012-10-28

We are only using two pins on the Variable Resistor. The center pin is a common terminal and connecting the other terminal to either of the two side pins create the same variable resistor. The only difference is in the direction you rotate the screw to achieve similar resistance. Thus, you should swipe the same two pins we are using for the Variable Resistor with the 2 pins of the LDR. Both devices have no polarity so it does not matter which side you connect them.

mouse0079 (author)WolfKodi2012-10-28

ok, so the out put to the led would go to the relay to make it switch on and off. right?

WolfKodi (author)mouse00792012-10-28

Yup, replace the LED with the relay. You do not need the resistor just before the LED too depending on the input voltage rating of your relay.

althepal12 (author)2012-10-24

Can send full spec for the parts? Especially fro the LDR?

WolfKodi (author)althepal122012-10-27

These parts and pretty standard and generally interchangeable between manufacturers. The picture showing the parts should be a good indicator. As long as the LDR has two pins and has that orangy-red snake-shaped pattern on top, it should be fine.

Owen and Garrett (author)2012-10-23

Hello - This looks like a great circuit. I've built something similar but without the IC Comparator. I am trying to figure out how to use the output signal (LED) voltage to turn on a clock. Most small AA battery operated clocks I have found need exposure to the actual battery voltage to operate properly. So I would like to use the output signal of my circuit to essentially switch the battery voltage on and off to the clock in the presence of light. Is there a way this can be done using transistors?

Yes, you can use transistors but if your clock really needs more direct power, use a relay switch instead.

zarinazats (author)2011-12-29

I have another question, I couldn't find the other part for this project, which is TLC3704 Quad Comparator...where did you find it? I searched everywhere, and unfortunately I couldn't find it, is it possible if there's a replacement for that? or is it okay if I will not include it?? please reply asap

WolfKodi (author)zarinazats2011-12-29

Yes, you can use the single LM311N Comparator with 8 pins.

powerman666 (author)WolfKodi2012-09-20

I did this with a LM311N but for some reason I could only get the LED to light up by using a 2N222 Transistor and reversed the LED. I looked at this schematic to help me figure out how to hook it up.

TobaTobias (author)WolfKodi2012-01-17

Doesn't it have 17 pins?

zarinazats (author)WolfKodi2012-01-01

I have another question, if I will use the LM311N Comparator, should I place it on the 6th to 9th column?? I'm sorry if I ask too much, because I will do this on my Physics project and I'm still in high school so I really don't know how to work these things

WolfKodi (author)zarinazats2012-01-01

Yes, place it on the 6th to 9th column. But you've got to rewire the circuit. Look at the last step. I've added an extra image. Compare both of them for changes. Note the LM311N's Notch location.

muted0irony (author)2012-04-01

Hi, I have absolutely no background in this - but I would like to ask: Would this device be able to detect a change in light over a large surface area - for example window glass? (Change in light meaning - when the window is dirty, it lets in less light; will this device be able to detect relatively minute changes in light?) I do hope you'll reply! Thanks!

WolfKodi (author)muted0irony2012-04-02

I cannot see how this is feasible for your "window-dirt-detection" application. The changes in cloud cover and day light intensity varies too much.

Bednarz (author)2012-03-03

Hi there, sorry to be late to the questions asking party there a reason you went with the 9V battery? I'm a little rusty on my electronics, but I'm pretty sure that the LED only needs a couple volts. Does the comparator need a higher voltage for activation? I'm thinking of building something like this, but was planning to use a couple AA's rather than a 9V.

WolfKodi (author)Bednarz2012-03-03

Nope, you can you at least 2 AA batteries as the minimum supply voltage required by the comparator is 3V. I simply find using a single 9V batteries handier compared to a 2 AA batteries with the bulky holder. If you're using only 2 AA batteries, lose the resistor in series with the LED.

musaib jan (author)2012-02-15

hey buddy.. i really do appreciate your work.. this is going to be my first year project... i could not use TLC3704 but of its unavailing... so em using LM311N... but em really confuse with the last picture you post on ur instructable with LM311N... i will really appreciate you if you explain this to me. ....

Roger Bradfield (author)2012-01-30

hi - what changes would need to be made to make this work with 12v?

About This Instructable




Bio: Just your typical friendly and misunderstood wolf.
More by WolfKodi:Simple Light Detector with Sensitivity Control
Add instructable to: