This LDR circuit diagram shows how you can make a light detector. An LDR or “Light Dependent Resistor” is a resistor where the resistance decreases with the strength of the light.
Here is the schematic for the circuit:
Light Dependent Resistors
Light Dependent Resistors (LDR) are also called photoresistors. They are made of high resistance semiconductor material. When light hits the device, the photons give electrons energy. This makes them jump into the conductive band and thereby conduct electricity.
Check out Wikipedia for the physics stuff ;)
How The LDR Circuit Diagram Works
The LDR circuit diagram works like this:
When it’s dark, the LDR has high resistance. This makes the voltage at the base of the transistor too low to turn the transistor ON.
Therefore, no current will go from the collector to the emitter of the transistor. All the current will instead pass through the LDR and the potentiometer.

When it’s light, the LDR has low resistance. This makes the voltage at the base of the transistor higher. High enough to turn the transistor ON.
Because the transistor is turned on, current flows through the transistor. It flows from the positive battery terminal, through R1, the LED, and the transistor down to the negative battery terminal.
This makes the LED light up.
The Components Used In The Light Detector Circuit
The resistor R1 controls the amount of current going through the LED. It’s simple to calculate. I have written an article on how to calculate the resistor value for an LED.
If you are using an LED with 2V voltage drop, you will have a 7V voltage drop over the resistor when the transistor is ON. By using Ohm’s law we can find the current:
And 18 mA is usually a good current value for common LEDs.
What if you want to power the circuit with something other than a 9V battery? Then you need to change the resistor value to get the right amount of current flowing through the LED.
The variable resistor R2 is used to change the trigger point for the LED. That is, how much light that is needed for the LED to turn ON and OFF.
You can probably get away with a 10k potentiometer. It depends on the resistance of your LDR. But with a 100k potentiometer you will have room for a wider range of LDR values.
Making The LED Turn ON When it’s Dark
You can also make the LED turn ON when it is dark instead of when it is light. To do this, replace the NPN transistor with a PNP transistor like this:

Build It Yourself
Now it’s time for you to build this circuit. It’s very important to build stuff, not just read about it. So get yourself the components you need and build it!
Get the required components from an online electronics shop.
Post your comments or questions below =)
Brian says
Hi,
Really cool, thanks a million.
I am thinking of making a flashing light for my bike, and maybe this could turn them on automatically, but would have to function in reverse… Any ideas on how to make the led light up when it gets dark!?
Thanks again Oyvind
admin says
Hey Brian! Thanks for your comment. I added a circuit with the reverse function at the end of the article =)
Cheers!
Oyvind
Tom says
Simple, fun and effective way of explaining how stuff works. I think the video, even though its simple, still adds great value to the post as it triggers my maker-soul and crave to build something similar my self after watching it.
As a side note to improve the posts even further: I think additional value could be added by relating the experiment to something what you actually can use it to? How is this particular function useful in our everyday life? E.g relate it to product that turn on the light in the evening when its getting dark outside (would have you to reverse the design, causing the led to be lit when the the LDR is covered).
Just my $0.02
Keep up the good work!
/Tom
admin says
Thanks for your comment Tom!
I updated the article with a circuit with the reverse function at the end =)
Cheers!
Oyvind
Chupo_cro says
Why didn’t you just swap LDR&R2 instead of using PNP in the place of NPN transistor?
Shainy says
HI! Why you will swap the LDR & R2 when you will use NPN transistor?
chupo_cro says
Well, if you want to use NPN transistor as in the 1st shematics but you want the LED to turn ON when it is dark (as in the 2nd schematics), you could just exchange the LDR and R2. When it is dark, the LDR’s resistance would be large compared to the R2 so the NPN transistor would be ON.
Zarak says
Dude! the exact same thing you said about swapping the LDR with R2 would end up turning the led ON in dark; I’ve seen the exact thing in another video and i’ve been confused about it since days, how is it possible? Could you elaborate how more resistance in the ldr would result in increasing the current flow into the transistor? I’d really appreciate your reply :)
admin says
That’s true. The LDR and the potentiometer make up a voltage divider:
https://www.build-electronic-circuits.com/voltage-divider/
If the LDR is at the bottom, it means that the higher resistance it gets, the higher will the voltage drop across it be.
The voltage across the LDR is the same as the voltage from base to emitter of the transistor.
And the transistor turns on (and lets current flow) when the voltage is around 0.7V.
Ricardo says
Is there a way to combine both circuits?
Maybe like that:
With light > Red led ON – Green led OFF
Without light> Green led ON – Red led OFF
Piyush says
You can use two transistors to accomplish it
Asurya says
How to use on 230 volts can u telle
[email protected]
julie says
I have 12v led lamp and I’m planning to use 12v adaptor to make dark sensor led lamp. Can you help me find the materials that I need? Also the diagram? Thank you
admin says
You could replace the LED and resistor with a relay that you connect your lamp through.
Abhishek Sharma says
dear sir please help me
I am in big trouble.
i have to make project for my student. I want get 24V DC from LDR to my PLC. Please sir give me or provideme the circuit diagram to how to get 24V DC to my PLC from LDR
Please Sir Help me……Please……Please Sir
anwar says
i want to know the output waveform.but im getting noise when i use the same circuit as above.distortion are more than the actual output.can you tell me how to overcome this
Innocent Maforimbo says
thanx buddie.I like this one
Eddie says
Hi. Thanks for this. Wanna find out if this is also possible for a bulb.
admin says
Hi, yes it is! If your bulb is 9V and works with around 100mA you can just replace the diode and resistor with the bulb.
If you need more current, then you can replace the transistor with a transistor that has higher Collector-Emitter current rating.
Or you can use a 9V relay instead of the LED+resistor and connect your bulb through there.
Many options =)
Oyvind
Bhushan says
Why is relay when 9 v bulb there To glow
Garry Smith says
Good one, Oyvind :-)
samir says
thank you.can i know about what is the stuff in mobile phones screen display lighiting.
admin says
The actual lighting in the screens are LEDs: https://www.build-electronic-circuits.com/what-is-an-led/
Oyvind
You Know who i am.. says
Making The LED Turn ON When it’s Dark.. how this process works..? Pls, explain
MARIUS says
Hi there ,
I am interested if You have an idea how to make a simple device ho can worn me when voltage battery (from a RC submarine ) drops below a desire value by making very LOUD SOUNDS . Being in the watter all the time You can’t see the Submarine !!! and the sounds can be heard .Is A VERY IMPORTANT DEVICE because if You can’t bring on surface the model is a DISASTER .
THANK YOU
MARIUS
admin says
You can use a voltage divider with a transistor. Then have the transistor turn on a relay that it connected to some circuit for making the loud noise. The efficiency might not be the best though. Start by reading up on voltage divider: https://www.build-electronic-circuits.com/voltage-divider
Then learn how the transistor works: https://www.build-electronic-circuits.com/how-transistors-work/
Good luck!
Oyvind
pavithra says
how can we use a voltage divider with a transistor?
admin says
What do you want to do?
Patricien Tsangya says
I’m very interesting with this topic I also have a quick question i want to make a motion sensor for alarm,and I need your assistance of ideals.
Thanks for the wonderful work
admin says
Hey Patricien! Then you should look into PIR sensors ;)
Oyvind
Nayan says
Nice article, great info.. You really make it very easy to understand..
admin says
Thanks Nayan =)
Oyvind
prakhar says
why do we need ‘R2’ in the adove circuit. Pls explain the work done by it.
admin says
The variable resistor R2 is used to change the trigger point for the LED. That is, how much light that is needed for the LED to turn ON and OFF.
Cheers!
Oyvind
Ron Burke says
Great information!
It would be helpful to have more specifics about the components used. Jameco has many different photocells (assume that’s same as LDR) and potentiometers. I am currently too ignorant to make an informed choice.
Thanks!
admin says
Hey Ron, finally you made it through! ;)
The potentiometer used is a linear 100k potentiometer. Any linear 100k potentiometer would work.
The photocell/photoresistor/LDR I just found laying around, so i am not sure which exact one it is. But I had a look at the ones at Jameco, and it looks like all of them will work.
Cheers!
Oyvind
ramn says
I’m using a dark detector ckt , I want to glow the led when it is slightly dark but in my experiment model the led is glowing when it is complety dark .I have used two transistors & two 1.2 k ohms & one 10 kilo ohms pls reply fast pls reply
admin says
Hey
If you have built the circuit according to the schematics, you will have a potentiometer that you can adjust to make it glow when it is slightly dark.
But you mention two transistors, so I don’t know which circuit you are using….
Cheers!
Oyvind
shivangi says
sir plz answer me..for fire alaram using thermistor and with out use of any IC …
Joe says
Use an opamp and you can set the sensetivity to what ever ambient light level you want it to turn on at.
Amal Thettayil says
what would happen if you took the transistor out?
shivangi says
can you send me the circuit of firealram using bc 548 and themistor…i tired but cant succes plzz send me suggetion or circuit on my email id..thank you sir ..
admin says
For finding schematics, I recommend this page: https://www.build-electronic-circuits.com/free-electronic-circuits/
Cheers!
Oyvind
juan says
haha wow man you get alot of the same questions haha. Not sure why some of them dont understand. Guys im very new to electronics. That is the simplest diagram that you will get on this topic. Try making that and if you succeed play around with the same one just diffrent parts like one that uses noise or all that.
arjun says
Hi
Can you please give a short idea how using the NPN transistor made the LED light up, when the LDR had high resistance?
Thanks.
admin says
Hi
The LED lights up when the LDR has low resistance.
If you look at just the LDR and the R2, they make up a voltage divider (https://www.build-electronic-circuits.com/voltage-divider/).
So the less resistance the LDR has, the higher the voltage drop over R2 will be.
Oyvind
Smithe877 says
Rattling nice pattern and good subject matter, hardly anything else we need D. ddaekbeffecaaddd
mahidul says
heyyy m really very thankful that I got my answe here . actually I was confused n really banging my head on the wall that how to make my led glow when it is dark.. actually iny circuit it was glowing when it was coming in wid contact of light.. now I got to knw the fact of npn and pnp transistors. …
thanks a lottt
admin says
Great to hear! =)
Oyvind
David says
Which gives the best battery life, LED on all the time or using this circuit to switch on the LED only when dark?
Thanks.
admin says
Hey David,
It will use less power if you use the circuit to only have it on when it’s dark.
Oyvind
Hayden says
Hey!
Nice video. I’m just wondering, how exactly does changing the potentiometer values change the trigger point of the led? The potentiometer is connected to the power source and photo resistor so how would it change when the transistor is on?
Thanks!
admin says
Hey!
The transistor turns on when the voltage on the base is around 1.6 volt.
The values of the potentiometer and the photoresistor determines the voltage at the base. Read about the voltage divider here, and you might see how it works: https://www.build-electronic-circuits.com/voltage-divider/
Cheers!
Oyvind
Son Pham says
Thanks and it is very easy to understand.
Aisha says
Great site. Your explanations are very clear and presented in a very concise manner that is not dry or boring. Thanks!
Alister Dsouza says
nice ckt. simple but cool.it works perfectly fine
Alister Dsouza says
just a suggest. the dark ckt dosnt drive the relay ,it needs to be followed by a current amplifier{using bc547} to drive the relay,since the current is less for bc557.
rohan says
hello sir ! your circuit is great . I have a question …..
can I replace LED and resistor with a motor to make light follower robot.
admin says
You have to make sure the transistor can provide enough power for your motor (you’ll find this info in the datasheet of your transistor)
Cheers!
Oyvind
Daljit says
Hello sir
Can we use this LDR SENSOR with 15 watt AC(220) voltage led bulb? if yes then pls give the details
Somesh Mahanty says
Hello Oyvind! I have followed your circuit and it is working nicely. Thank you for such a simple but interesting project. Also I would like to know if it is possible to replace the led with a 12v led strip i.e. if it is possible to get an out put of 12v or at least 9v from this circuit. If so how should I proceed?
Thanks,
Somesh
admin says
Hi, yes you can replace the LED+resistor with whatever you want. You just have to make sure that you have a battery that gives you enough voltage and that the transistor can handle the amount of current that goes through your LED-strip.
Cheers!
Oyvind
Somesh Mahanty says
Hi Oyvind! First of all I am a newbie at this! What I have figured is that the BC557 transistor is a low current (max 100ma) low voltage (max 65V) transistor, and the max output from your circuit is about 9V and 5mA.
Now I can still power up a LED strip of 400mA but with very low brightness due to the low current output. I was thinking what if I replace the BC557 with a BC807 which is a high current (max 1A) low voltage (max 45V) transistor, would it be possible? If so what else do we need to change in the circuit?
Thank again for the project.
Best
Somesh
admin says
Hi Somesh,
I am really happy to see that you did the research and found a transistor that handles more current.
If your LED strip has a current limiting resistor inside itself (it probably has), then you can just replace the led+resistor with your led strip and use a 12V source instead of 9v source, and you should be good to go.
Oyvind
Somesh Mahanty says
Hi! Do you mean that I should replace the BC557 with the BC807 and then use the 12V power source or that just the 12V would be sufficient without the BC807? Please clarify.
Thanks a million for your support.
Best,
Somesh
admin says
Yes that is right Somesh.
You need to use the transistor that can handle the 400mA of your led strip.
Cheers!
Oyvind
Somesh Mahanty says
Hi! Oyvind! First thank you for taking the time to help me with this project. Also keep up the good work. I will work with the BC807 transistor and get back to you with the conclusions.
Have a great day!
Cheers!!!
vhin zeta says
thnx for the great info sir, I’m a newbie, What ratings of resistor should I use to apply your circuit using a 220volts, I want to apply in my house, thanks so much
admin says
Hi,
You need to calculate how much power the resistor will dissipate, then get a resistor that can handle more than this. I don’t have any posts on calculating that at the momentm but I’m sure Google can help you out.
That said, I don’t recommend messing with the 220V if you don’t know what you are doing. You can hurt yourself and you can potentially craete a fire hazard if you choose wrong components.
Oyvind
vhin zeta says
Sir Oyvind, Ive searched on how to compute the power a resistor will dissipate and I’ve come up on using a 20w resistor, will it work? or do I need to add more components so that I can use the circuit uisng 220v? tnx in advance.. I’m really a newbie, :)
admin says
That’s impossible for me to say since I have no idea what you are trying to achieve… =)
Oyvind
john says
ican help you with that
Omale francis says
Just contact me so we can talk08098704583
A.Murugan says
Hi Oyvind,
Thanks a Million for sharing about electronic circuits.
Thanks
Murugan
John Ten says
Hi! Thank you for the very simple yet clear info. I’m just wondering because from what i read from other books about the flow of electrons in a circuit, the flow would be from negative to positive. Is that correct sir? Thanks in advance.
admin says
Hi,
I wrote about it here: https://www.build-electronic-circuits.com/current-voltage-resistance/
Cheers!
Oyvind
Mandel says
Hi I want to connect ldr circuit direct to electricity bit here it is 9v give me a best circuit
Pervaiz Abbasi says
My son is 10 year old and interested in electronic
Suggest me how he can learn and make things and circuits
Starting from zero
I would be thankful
jean says
Hello ,
How are you? I have a good question. The question is that I never see a dependent current or dependent voltage source in any schematic for TV, radio , or computer why teaching them in college course. Please help me understand what they use them for in electronic industry, thank you for your answer and God bless you.
admin says
Hi Jean,
Thanks fo your question. I don’t remember exactly, but I think these are used to model the behaviour of for example a transistor. So it’s not a real component, it’s a tool for doing calculations.
Cheers!
Oyvind
Somesh Mahanty says
Hello Oyvind! Once again thank you for this project! After working with it for quite some time now I am able to light entire LED strips with dark sensors and also I have designed a circuit with three BC547 transistors which when added to a LED 5050 strip powered by 12v supply changes color according to the light! If you’ld like I can share the circuit with you!
Cheers!
Somesh
admin says
Cool =)
Yes, I would love to see it.
Oyvind
jos jack says
hi,
I am a new learner i want make motion led circuit to use home current how to make it please suggest me.
Museeb Ghumman says
Sir,I wan to use an alarm of 3v and 600mAh instead of LED in darkness sensor.
Please help me and reply me as early as possible.
Thanks.
Anurag says
What difference does it make when we reverse the position of ldr with r2.?
admin says
I challenge you to do your own calculations on that. Check out the voltage divider: https://www.build-electronic-circuits.com/ldr-circuit-diagram
Cheers!
Oyvind
akshay says
got use of it
Ireul says
Hi Oyvind,
Really happy to find this tutorial. Great website and tutorials, it has been very helpful to me.
I am trying to build a sound installation based on a DIY 808 bassdrum from Erich Archer (http://www.ericarcher.net/wp-content/uploads/2014/07/tr-808-bass-drum-diy-project.pdf)
I want to trigger the bass with a LDR. The idea would be that if you hold your hand in front of the LDR the bass is triggered. I have no idea where on the scheme/circuit I would have to install your LDR circuit and what kind of values for resistor etc. I will need to trigger the whole. And if this is even possible.
The 808bass circuit has to be triggered with a logic signal. So tie ACCENT to +12V (+15V) and connect the logic signal to trigger. The trigger pulse has to be short (like 5ms).
This is the schematic I built: http://nathanaelreuling.nl/bodil/Kick808-2.jpg
I would be very greatful if you could help me on this.
Cheers,
I.
Shane says
Can I use the BC547 to make the circuit sense dark instead of light, or will I have to replace the transistor?
Ishan Fernando says
I want to use this circuit on a input voltage of 6v and the led at 5v. What do i need to change ?
john says
thank you! it worked fine for me
Shannon says
Do I need additional circuitry to add a photocell (LDR) to a 6V DC battery powered strobe light, or can I just tie in. If I need circuitry, can I use the photocell and circuitry from a 110V AC night light?
Luis says
I have 2 questions. The first one is with the set up you have for the light turning on when its dark. Would you still have a power draw with the led off. My project is that i live on a sailboat and my anchor light is at the top of the mast. I want to try and save power and have the light turn on at the right time of im away from the boat. My second question is could i just hook the photocell to a relay when the sun is shining the photocell tells the relay to tuen the light off but when the sun sets the photocell loses power and lets the relay turn the bulb on. Im working with 12v. Its been awile since i have messed around with this stuff so im very rusty
Lucky Graham says
how do i get a good multimeter that measure parameters like; voltage, current, resistance, frequency, signals, wave, and other measurable parameters as may be required in electrical/ electronics engineering profession?
I also books that can guide/ teach me how to build and design different circuits
admin says
Hi,
here are some book recommendations: https://www.build-electronic-circuits.com/electronics-books/
I have never used a multimeter that can do all those things. I use a simple multimeter for simple measurements like voltage, current, resistance, etc. And an oscilloscope for more advanced measurements like frequency, etc.
Cheers!
Oyvind
Lucky Graham says
Ok! but how do i get this books? i want to place an order so i can get them. If so then which adress?
admin says
Hey, you can purchase my ebook here: https://www.build-electronic-circuits.com/products/ebook-2nd-edition/
It’s an ebook, so no address needed. You’ll be able to download it right away.
Best,
Oyvind
Azad says
i just want tom know how to connect the potentiometer if it has
3 pins?
admin says
Hi Azad,
All potentiometers have 3 pins. And you can see how to connect it in the circuit diagram in this article.
Cheers!
Oyvind
Paul Benn says
Really like the site. I’m trying to build a circuit where the LED brightness is dependant on the light level over the LDR. so instead of just being 100% on or 100% off, it varies based on the amount of light over the LDR. How do you alter the circuit to make this possible??
admin says
Hi Paul,
Thanks:)
The LED brightness is actually dependant on the light level with this circuit. When I demonstrate in the video, I use my finger to make it really bright or really dark on the LDR, that’s why the LED is 100% on or off. But if you gradually change the light-level detected by the LDR, you will see the LED gradually getting more and more bright.
Cheers!
Oyvind
Grant Felsing says
I need this type of circuit for a bug zapper that I want to turn on after dark. Using a solar rechargeable battery/cells for power. Is there a problem here? It looks to me that during the day, when the photoresister is conducting, that the battery is draining through it and the resister. It’s not powering the LED but it’s still using battery power that I’m trying to replace during the day. Am I reading this right? This circuit seems to choose the path for the electric current either through the LED or through the LDR depending on ambient light but the drain on the battery is there in both cases.
Thank you!
Grant
admin says
Hey Grant,
Yes there will be some current in the circuit all the time. The amount of current will depend on your LDR and potentiometer values. Without having done the proper calculations, I think the amount of current when the transistor is off will be very low. Maybe 1mA or less. But I think you should do some measurements of your own to be sure.
Best Regards,
Oyvind
aravind says
Can plz give a LDR circuit diagram that will make the out put to rotate a Simple toy motor
admin says
Hey,
Just replace the LED and resistor with the motor. Just make sure your motor can handle the battery voltage you use.
Cheers!
Oyvind
Roddy says
Good day sir, it’s my first time getting to know yr site.im very much interested in building the sound amplifier module for speakers for my pc.i Have a few concern regarding the the cct. I need yr expertise advise.looking at the pcb layout.im a bit confuse how the input is connected as there is A 1 and B1 that connected to the potentiometer. Then A 2n B2. Connected to the ic. Please assist me in explaining how do I connect the input positive n negative wiring.n also the negative supply voltage.connection.as I can’t seem to open tHe the attachment file.as I want to see the
Layout.iall the ground connected together etc.please I may be asking u silly question as I’m just finding my way in this field.thnk you
admin says
Hi Roddy,
I’m not sure which circuit you are trying to build. But here is one amplifier circuit with circuit diagram that shows you how to connect everything. Maybe it can help: https://www.build-electronic-circuits.com/amplifier-circuit-diagram
Cheers!
Oyvind
Tony Smith says
Hi,
I’ve been looking at your ‘dark sensor’ circuit and wondered if it would work with a lower voltage battery….such as 1.5v ? What would you suggest for this.
I think I’m going to need your e-book !!
admin says
Hey Tony,
1.5V will be enough to turn in the transistor, but it’s too low to turn on the LED.
Best Regards,
Oyvind
Tariq Mahmood says
i like this circuit and i try bt136 triac whith on and of light automatically in evening and of in morning in series of lamp
Raymart Lopez says
hello admin, can i ask a favor? can you make a circuit design for the reverse one using proteus? it is for my project., and what is the code for this… please… thanks….
Harsh says
Can I use a 100 k resistor instead of potentiometer?
niola says
Hi Oyvind, your site has been really helpful to me. thanks alot. You are doing a great job.
admin says
Thanks Niola =)
Oyvind
Anand says
Can i use this to turn on when dark, with the same components for the reverse process ? Is it possible with swapping any?
admin says
Hey Anand,
At the end of the article I show how to do that.
Best,
Oyvind
Genthon Taduran says
can you give me a circuit of 4 leds, controlled by ldr. no led will light if there’s bright light, and 2 leds will light if the light is dim, and all the 4 leds will light, if its totally dark. help me in my project please.
Shalin says
Isnt there any logic gates involved like NE555?
admin says
In this circuit, no.
Cheers!
Oyvind
smurf says
is it possible that instead of led, id use a dc motor? and how? tnx a lot.
admin says
Hey,
Yes that’s possible. But then you need a transistor that can handle the amount of current your motor needs.
Check the max current of you motor, and make sure the max collector current of your transistor is more than this. Maybe the TIP120 transistor can work for you…
Cheers!
Oyvind
johns says
will battery get consumed up on leaving it in dark?
admin says
Hey, yes there will be some current going through the circuit even when it’s dark.
Best,
Oyvind
Manas.N says
Dear sir, I am 8th grade student, I am making project of Automatic Railway gate for opening and closing by using LDR and with 9V battery. Kindly give me circuit diagram please. Its very urgent
admin says
Hey,
Sorry I don’t have that.
Oyvind
Toms says
hey! Transistors are of types,codes printed on their bodie and also different voltages, but no specific type is mentioned above to be used,pliz.
admin says
Hey,
Any general purpose transistor should work. For the npn type you can use for example bc546 or 2n3904
simutenda abby says
Hi, i have been trying to make an electric generator using an alternator but, the problem is that an alternator is said to generate 300Volts and 600 Volts, how can i reduce it to generate 220-230 volts. The question is how can i make it & what methods can i use. Thank for all your working. Am always ready to make something that can make someone smile.
Wayne Parry says
Thanks for the information. In my case I would like the LDR to activate a 12V solenoid when light is detected, instead of the LED Pleasecould you tell me what changes would have to be made to the components of this circuit diagram.
Many thanks
Wayne
admin says
Hey,
You can replace the R1 and the LED with your solenoid.
Best,
Oyvind
DURGA SAI says
sir
can we use operational amplifier in the place of transistor.If we use what will happen?
V G Abraham says
I’m running a solar system charging a 3.7 volt lithium which power 3.to 4 leds in parallel. Can you suggest a suitable day night circuit for this without reducing the intensity of the leds since the system is low power.
Karen says
Please for the dark detecting circuit, can I replace the BC557 with BC558?
Please, its really urgent.
admin says
Yes that should work.
Oyvind
areeb usama says
hlw , em confused why we use potentiometer in dark sensor , plz explain the working of this potentiometer plz
admin says
The potentiometer is there to adjust when the light should go on/of (how much light is needed).
areeb usama says
thanks
areeb usama says
this site is very helping can you plx tell me the working of potentiometer in dark sensor project
fred says
if i use a 12v battery and 12v led what materials do i need to build this proj?
abhishek says
hello
i have a doubt(maybe silly).
how will the current pass through the ldr when it is dark though tbe ldr has very high resistance when it is dark.
admin says
It won’t. Or at least very little. And that’s why the transistor does not turn on.
Oyvind
Tony says
Can you please explain how a schmatic drawing is installed on a breadboard .
As a beginner at 55 years old this is not clear to me . THank you.
admin says
Hey Tony,
Maybe this breadboard article will make it more clear: https://www.build-electronic-circuits.com/breadboard
Best,
Oyvind
Tony says
Oyvind
Thanks for the breadboard article it is very helpfully
Can you also explain how you plot out step by step off a schmatic drawing to the breadboard .
I don’t understand how the schmatic components start and finish on the b-board .
admin says
Hi Tony,
I’m not able to do that in a comment. But I’ll write it down as a suggestion for a future article. But I would advice you to try to connect a very simple circuit such as an LED and a resistor on a breadboard to get the feeling for it.
Best,
Oyvind
Rishabh says
i am making a smoke detector using your circuit which activates when light goes off the only prob is that i want to put buzzer insted of an led so what changes should i make with resiatance 1 and power suply
admin says
Hey,
If your bizzer works with 9V, just replace the LED+resistor on the right side with your buzzer. It has to be an active buzzer though (that doesn not need an external oscillator).
Best,
Oyvind
Rishabh says
thanks for your support
Brian says
If you could do the terminations before inserting them in the breadsheet board it would be much much easier
george says
sir how if the 100k resistor out.what will happen?
admin says
You should try it and see for yourself ;)
Jugal Rathod says
Can we make a LDR circuit to turn ON the street light automatically of 700 volts ??
admin says
Yes, with modifications that is possible. Instead of the LED+resistor, you can insert a relay that is rated for the voltage and current you need, and connect the street light through that.
But, I wouldn’t try it out in real life as it’s very dangerous.
prisca says
hey! i would like to get that book,**getting started with electronics**, how can i get it?
admin says
Hi,
You can buy it here: https://www.build-electronic-circuits.com/products/ebook-2nd-edition/
Best,
Oyvind
Sujay Mandi says
sir, how the pnp transistor work? And at last of the article please explain the circuit how it works?
Nityananda Hazarika says
I have used 470 ohm as current limiting resistor and 2K ohm for the base. Now when I apply 5V, the circuit works fine. But if 9V is given, LED keeps ON irrespective of lights. Even if we remove the base connection wire, the transistor still conducts and LED remain ON. Can’t figure out why it is?
admin says
Sounds like you have the pins mixed up… Or maybe you are using a pnp instead of an npn?
Gabriel says
please and please I need to no how to differentiate a pnp and npn transistor with a multimeter..Please send it to my email
Uthpala says
Hey. I recently bought some 12v led strip and set in mu room roof. Now I like to make a circuit to turn them when the dark. I want to make them brighter when the dark is getting high. I think you can understand me. When the darkness is getting high the led strip will be light up slowly. Can you help me to make a circuit for that. The led strip is 12v and 6A . Can you please draw me a circuit. .
Gabriel says
please I have a small solar panel that produces 9v, so I try to use it to charge my phone. Each time I plug the phone, I firstly connect a multimeter to no if it reduces. So when i plugged the phone to that solar source, it came back to 4v which would not charge my phone but spoil the battery. So please what components can i add to amplify both the current and the voltage. I have tried a transistor, instead it to it back to 2.3v…….thanks
Kratika says
Hey i want to make a mini project for my submission so can U please help me in deciding what should i make????
Related to electronics & communication
shah salman says
am doing a mini speed breaker ( roller mechanism)… i have got a 12 v generator dynamo and nokia phone battery 3.6 v and a ldr sensor and four LED … how to design a ldr circuit for this and what type of transistor to use … the generator will be connected to the battery and the electrical energy saved there … then at night or in darkness the ldr will make the LED lights up … can you plz send me a circuit for this …thank you in advance
Ambar says
Thanx a lot sir for all the vidios…..
Ambar says
sir you are the best……..
Ambar says
Sir tell me one thing that when you are used the dark condition in LDR ckt
the resistance become high and voltage become low as u said in vidio.
But sir i have a doubt when resistance become high than current become low.
And in this condition the transistor is operated.
Because u said in your previous vidio that when the small base current flow from base to Emitter the transistor will operate.
admin says
Hi, if you are talking about the first circuit in this article, you are right: In the dark, the resistance is high, the current is low, and the transistor does not turn on.
Ambar says
And when the Transistor is operated than the collector to Emitter current flow….
Then Led will glow….
I am confused….
Manish says
Sir how to we make street light lDR
admin says
Exchange the LED+resistor with a relay that can control the street light.
Best,
Oyvind
Ramz says
I don’t have a Resistor and transistor, is that fine ?
admin says
Not really… This circuit requires all the parts. But you can always have some fun with LDR and an LED anyway.
Thomas Jubb says
Hello, I have had fun creating the first LDR circuit, thank you for your explanations and teaching.
I have tried creating the second LDR circuit and my LED wont turn on and cant tell what is wrong with my circuit. Do you have any trouble shooting tips?
admin says
Hi,
First of all, check that you’re able to turn the LED on and off by turning the potentiometer all the way to one side, the all the way to the other side.
If not, there’s an error on how your circuit is connected. Maybe you misplaced the transistor legs. Note that this is a PNP transistor and not NPN as in the first example.
Best,
Oyvind
Tushabe Benard says
How can i use this automatic light detector with 100W electronic bulb?
Divya says
Thank u sir i tried the second one and it worked…..
it was like oh!!
I shined before my classmates..
thank u once again…
admin says
That’s great to hear =)
Best,
Oyvind
James says
Thank you very much for this article sir!
Shrijith.P says
I see that the collector and emitter terminals are interchanged in case of pnp and npn circuits. Is it that the collector should always be conected to the load? Can you please tell me why these are interchanged?
And great going sir. You break down the most difficult topics into very simple stuff so that we can understand easily.Keep it up sir.
admin says
Hi,
There’s no rule saying that you have to connect the load like this. But in the way I’ve connected the load, it’s much easier to calculate voltages to find the correct resistor values.
Best,
Oyvind
Newbie Dan says
Great article!
I have been searching the net for a way to build a 12vdc circuit with an LDR to operate a fan when the lights go out. If the source is 12vdc and the load is 12vdc it seems no resistor would be required other than on the base of a transistor, is that correct? I have only found diagrams for circuits using 9vdc or less and operating an LED. I will admit I am a novice when it comes to building circuits so any help you could provide would be great.
admin says
Hey,
To operate the fan, you could in theory just replace the LED+resistor on the right side with your fan. But – the transistor here, BC547, it can only handle about 100mA (I think) and fans usually requires much more. So you would need a transistor that can handle more current. For example the PN2222
Best,
Oyvind
Newbie Dan says
Thanks Oyvind, for the reply and assistance!
Blue says
In regards to the video of the ldr circuit, isn’t it the case that the ldr resistance is high when finger is placed on it to eliminate light which then implies that the led turns on (when its dark)? As oppose to what was illustrated in the video which makes the ldr useless if you think about it.
admin says
There’s a circuit at the end of this article that shows how to turn the LED on when it’s dark.
neha says
Hey cool post!
I am trying to build something similar, hope you would help me.
I have a series LED circuit (14leds) and I wish to ON them when the LDR is in dark.
How can i modify the your given circuit according to my requirement?
Please help
admin says
Hi, see the last circuit in this article.
Best,
Oyvind
Neomar Infante says
Hi.. I am from Venezuela. Nice to meet you! I have a device which works like that but it use 220 volts, can you tell me what kind of LDR I have to use? Thanks!
admin says
Hi, That depends on how your circuit looks. If you already have the device, the easiest would be to just find a replacement part for it.
Best,
Oyvind
sankalp says
hey!!!! admin
we tried the circuit (glow light when bright &off when dark) and it was working perfectly ,but the reverse one did not worked even after we followed ur circuit diagram plz reply asap we are working on this since one week
admin says
Are you sure you used a PNP transistor (not NPN) and placed the legs correctly?
Best,
Oyvind
louie says
Can i ask what is the value of LDR used?
admin says
I think it was one that is around 10k for light and 1M for dark.
Best,
Oyvind
Gourab says
Can u plz tell me where a buzzer if I want it to go off when the led is on? And also what value of variable resistor should I buy?
admin says
Just replace the LED and resistor with the buzzer. No need for a resistor as long as the buzzer can handle 9V.
Gourab says
tried and is working :) but for the dark sensor the led is always on :( and also can i give both light and dark indicator in the same circuit?
admin says
Then you might need a higher resistance than 100k for the dark-sensor.
Not sure what you mean about using both light and dark. If you want the buzzer/LED to be on both in light and dark, just connect it directly to the battery ;)
Aster says
I want to use 3 leds instead of buzzer and use a 10ohm resistor with those……is it possible ?any changes required? Also where should i place the emf ?
admin says
Hi,
There’s no buzzer in this circuit. But you can place three LEDs in parallel instead of just the one. Just reduce the value of R1 to around 100 ohms to get some more current running through the LEDs.
Victor says
Hi Oyvind,
Why is the cariable resistor connected after and not before current feeds into the transistor base?
Many thanks for the great posts,
Victor
admin says
Hi Victor,
It works as a voltage divider with the LDR: https://www.build-electronic-circuits.com/voltage-divider
Best,
Oyvind
Arya says
I build a ldr circuit as shown above but…. The ldr plays does not play an role in the circuit.
Even if light is not provided,the bulb glows
admin says
Try turning your potentiometer all the way to each side. If you’re not able to turn the LED on and off with the potentiometer, you need a larger resistance value for your potentiometer.
Best,
Oyvind
shivu says
Hai sir, iam just confused becuouse when dark its high resistance and light ,low Resistance current flow its k but I think this is automatic light on and off day and night is it OK but here dark when its high resistance no current flow ist k lights will not on but we want day and night on and off plz clarify sir but I don’t know u understand or not clarify sir
admin says
Hi Shivu,
Sorry but I don’t understand your question. Please rephrase.
Best,
Oyvind
shivu says
Sir day time high resistance but led is off and no current flow clctr to emmittet but in your video high resistance is dark how its sir
admin says
Daytime is light. Light gives low resistance. Dark high resistance.
Raghav Maheshwari says
thanks buddy
it was the exact content that i was in need of
keep it up!!!
admin says
Glad to hear!
RoksaS says
i want to use MOSFET instead of BJT… will it work?
my source is 12v , 30+Aamps
admin says
Yeah, should work. just adjust the resistor for the LED to a bit higher value to take into account the increased supply voltage.
Best,
Oyvind
Katastrophy says
What is the photoresistor dark resistance for the one used in the experiment ?
If I want to use the circuit to cut the power to a motor instead of the led when there is no light reaching the ldr, how should I modify it?
admin says
I think it was 1M in dark.
To use motor instead of LED, replace LED+resistor with motor. Make sure the transistor you use can handle the amount of current your motor needs.
Best,
Oyvind
Katastrophy says
How do I also incorporate an LED which will shine on the LDR, so when I cover the LED, the motor would stop working? Also do I have to use a MOSFET in this case?
admin says
You have to do something to make sure the light in the room doesn’t hit your LDR, only the LED.
You can use MOSFET if you want yes, but it’s not a requirement.
Katastrophy says
Thanks! Also, where do I place the LED in the circuit?
admin says
If you want it to be ON all the time you place it with a resistor between plus and minus of the battery. If you’re unsure about this, check this article: https://www.build-electronic-circuits.com/current-limiting-resistor/
Best,
Oyvind
Katastrophy says
If you don’t mind could you check out the link and tell me if you were referring to circuit type 1 or type 2 by going to the link given below:
https://drive.google.com/file/d/0BxVjGxwGrKvXdkVDSXBIUzNXT3ZpR3ZidFBYa1lYTEpacVNn/view
Really appreciate the help!
admin says
Hey Katastrophy,
It’s type 2.
Best,
Oyvind
Katastrophy says
Last Question Oyvind…So lets say I want the motor to work while there is no light shining on the LDR and then to stop working when the light strikes the LDR, then should I just switch the positions of the LDR and 100k potentiometer?
Thank you so much for the help! You have been of great help!
admin says
Great =)
You’ll find how to do that under “Making The LED Turn ON When it’s Dark” in this article ;)
Best,
Oyvind
Natski says
Hello sir,
Please help, I want to create a detector or sensor that operates in 12 volts and that use on some of these devices (Thyristor, SCR, SCS or UJT)
May I ask for your suggestion?
naveen says
can i add both buzzer and led
admin says
Yes
Patch says
Hi Øyvind
Thanks for the very informative articles on your site. I have a basic question on this article: why use a transistor at all? If we build the circuit without the transistor, and without R2, and we place the LDR in series with R1 and the LED, how would this not achieve the same outcome?
Thanks in advance
admin says
LDRs often have a resistance of 1k to 10k or more in light. So, the current to the LED would be too small for it to light up.
Best,
Oyvind
Patch says
Thanks, that makes sense
nora says
hi! may i know if the circuit can be connected with GSM module? For example if the LED turns on it will connected to the GSM module. Is it possible? Thanks a lot! :)
admin says
Sure! Everything is possible =) But exactly how to do it depends on your GSM module.
Best,
Oyvind
monisha s.m says
it really good project and i’m trying for more calliber circuits.. thank you
cherrylyn borgoños says
can i replace the LED withb a speaker
admin says
Hi,
There’s no sound signal to drive the speaker in this circuit.
Oyvind
Rohibullah says
hello sir
what is the important of this project and what is the daily uses of this project
Molly says
Sir i m newbie. How to connect a preset resistor in the circuit
click here says
How can the circuit can run 110v power supply? thank
Clayton Benignus says
Three Questions:
1) Can I use a 9 volt AC adapter plugged into a 220 Volt Outlet here?
2) I don’t really want a Variable Resistor here. What’s a good value that won’t fry anything in this circuit? Will 10 KilloOhms work?
3) Though the 2N4401 has previously been mentioned as an acceptable substitute for the BC557, will the changes implied by 1) and 2) change this?
admin says
1) Yes, as long as the output is DC
2) That depends on your LDR. You can try different values from 1k and up to see what works.
3) No
Best,
Oyvind
John says
Hi,
I am looking to design this:
1- Minimum DC voltage required 8V
2- Maximum DC voltage 18V
3- Operation temperature -40F to 120F
4- Dry contact sensor (Digital output)
5- At least 30 seconds safety time delay or adjustable time delay
I know that for the delay I can add a RC circuit to it. I am not sure how to do it. Can you please help me wit that?
Ahmed Adel says
HI..
please How can I use LDR to sense Red Color?
admin says
It cant’t… You need a color sensor.
Roshan Joyce says
Hi,
I want to make the circuit for a school project which turns the LED ON when there is no light.
But is it possible to modify the diagram to:
1) use an NPN transistor (PN2222) instead of the PNP (BC557)
2) use 10k potentiometer instead of 100k
Many thanks in advance.
MARELLA KATHRINA P. ZALAMEDA says
HI PLEASE ANSWERTHIS.
HOW DID YOU COME UP WITH THE RESISTANCE VALUE YOU USED FOR THIS CIRCUIT?
admin says
It depends on the LDR you are using. But test it and see =)
Panagiotis says
Hi Øyvind Nydal Dahl! And thanks for the article. I have modified your circuit (night detector circuit) and I want some help, cause I’m a beginner. I’ve modified the following parts:
1) Power Source at 5V.
2) My led is 1W and it has forward voltage 3.2-3.4V and forward current at 300mA.
3) I’ve replaced the resistor with one at 6.8 Ohms.
My question is this: When I turn on the circuit, the transistor gets hot too much (and after few seconds it breaks) and the LDR doesn’t work. My led stays on all the time (full light). I’ve read on forums that I have to replace the transistor maybe. Can you help me and tell me what to do?
Thank you so much!
admin says
Hi,
Yes, the transistor I used only takes about 100 mA. Here’s a list of some transistors and the current they handle: http://images2015.cnblogs.com/blog/268182/201509/268182-20150922115048194-602221881.png
sam says
Interesting site.Looking to power a Garmin Edge 1000 gps unit during a long (18-hour-non-stop) bicycle ride – any advice as to features / capacity I should be looking for?Thanks
adithya says
heyyyyyy
are u crackkkkkk
Rishabh says
Hi bro…
I want to make Lesar security system for my farm . For that I want that this LDR work just reverse….
What will be the circuit now
Plz help
chris says
Hi,
I would like to use an LED and a 10k pot to vary the resistance of the LDR. How might I do that?
Thanks,
Chris
Smithd893 says
I will immediately grab your rss feed as I can not find your email subscription link or enewsletter service. Do you have any? Kindly let me know so that I could subscribe. Thanks.
Midway says
Can I usw transistor 547
admin says
Yes you can.
Lenah says
Hi,
I made an Ldr smoke detector for my project but but it works in reverse as in when there is light the buzzer goes on and when it is dark it is off, what could be the problem?
admin says
Hi, the first circuit works like that yes. The second one works in the opposite way.
Best,
Oyvind
Archisman says
Can you clarify me that arrow just bellow R2?.Otherwise it is very simple diagram.
Archisman says
Please tell me what that arrow means in the 2nd circuit diagram bellow the R2. Pls reply fast pls pls.
admin says
It’s a potentiometer, not a standard resistor. The arrow is the middle pin/wiper.
Walter Kunz says
If you have not done so you should explain that current only flows from positive to negative with circuit designers and engineers. In real life it flows from negative to positive. I discovered 70 years ago, when I was sixteen,that the symbol showing the direction of current flow through a diode is reversed.
Naveen says
Very nice. It’s very easy to understand your demonstrations with theoretical concept. I loved it alot. I just wanna design a new LDR circuit. So just working upon it! So let’s see how the stuff will make out! Thanks for your videos and very helpful website. Thanks to the team!
Marco says
Hi, I have made the circuit with the LDR and the PNP transistor where the LED turns on when it is dark. I have a couple question, just to make sure:
1) Does the voltage (potential difference) across the LRD become close to zero when the LDR is exposed to light and the transistor is turned off (no current passing through the LED)? The LDR resistance is not exactly zero when there is light but the voltage drop is so small and much less than 0.7C that can the transistor cannot be turned on.
2) When it is dark, the current passing through the LDR and the resistor R2 is extremely small because the LDR has a very large resistance. Nonetheless, that small current produces a voltage drop across the LDR of about 0.7V which turn the transistor on and consequently the LED on too.
Thank you!
Øyvind
admin says
Hi,
Great! it seems like you have understood it correctly.
Best,
Oyvind
Kushagra Pani Tiwari says
hii,
actually i have made this circuit but i am facing one difficulty. the difficulty is this ..
The distance between my leds and ldr is much nearly 5-6 cm because of which when a laser beam strikes the ldr the led turns onn but asa lazer beam is switched off led also switches off .. i want that when ldr is triggered once and led is turned on then untill an unless we remove the battery led continues to light .
plss sugest me some ways .
thank you.
Aadil says
How to make ldr ckt. O/P is one when light is off? Please reply fast
Frank Patterson says
Oyvind, Thank you for all the great info.
If I add a second photoresistor in parallel will either one trigger the LED?
Thanks, Frank
admin says
Hey Frank,
Yes, that should work.
Best,
Oyvind
doctor squish says
Good day! Would you mind if I share your blog with my facebook group?
There’s a lot of people that I think would really enjoy
your content. Please let me know. Thanks
admin says
Sure! Feel free to share it!
Stephen says
Can you explain why changing the position of LDR and resistor 2 reverses the function of LDR?
Talha says
Sir I Wanted To Ask That Is LDR A Open Switch, And Gate, Or Gate Or Off Switch.
I Would Be Very Thankful To You.
Thanks!
Roja Malagi says
Can we use more than one Led’s??
admin says
Yes, but make sure you choose a resistor size that sets the correct current for the amount of LEDs you want to use.
Pavan says
What if we dont use a resistor??
admin says
Then you’ll most likely break you LED.
Shinanki says
nice work bro. thanks alot.
Stanley says
Thanks for this. I have been surfing the internet for circuit that run on two LDR working alongside one another. Each LDR trap their own light, if one of the LDR is having higher impedance, pinA becomes high and pinB; low, otherwise pinB becomes high and pinA; low. But if they happen to be in the same impedance, pinA and pinB becomes low
Kalana Praveen says
I need to know what is the resistance of the r1 and r2 that need to be applied in circuit. And also i need to know whether r2 is a varible resistor. Can’t we use a normal resistor for r2
Jon Paul says
I used a buzzer. It worked, but the transistor got very hot??
admin says
Sounds like you are running too much current through the transistor. Try adding a resistor in series with the buzzer.
u bee says
what the r1 360 indicate
N.Gayathri says
I want some important questions for this matter
zaz says
There is something in this circuit I do get: Why do we want the wiper of R2 grounded, instead of connecting the base of the transistor to R2’s wiper and not between LDR and R2 ?
I mean, it is basically equally functional, is it not ? R2 still serves the function of setting a resistance “floor” in LDR+R2.
Sorry if this is dumb, I think I understand how the circuit works as described, I’m just unsure as to why it’s made like this and not as I thought.
Thanks !
admin says
You’re absolutely right. You only need the wiper plus one of the sides. No need to connect it like I did. Often the third pin is connected like this, just to not leave it hanging. But no need to.
Best,
Oyvind
charles watts says
What is the resistance of your ldr ( they come in a variety of values)?
admin says
I think I used a light-dependent resistor (photoresistor) with around 5 to 10 kΩ resistance in light and 200 kΩ or more in dark.
Best,
Oyvind
Dev says
I still don’t understand, why is the potentiometer there? Why won’t the circuit work without the potentiometer? Please, Please someone explain
admin says
It needs to be a resistor there. It makes up a voltage divide with the LDR. With a potentiometer, you have can adjust the resistance and thereby adjust the light-sensitivity.
ACP says
Hey not be very judgy but your grammer needs work.
but some of the points you mentioned are not correct and you interchanged some things which is not correct. the led glows only when no light falls on the ldr not when there is light. please correct this as there might be someone else who needs this document but will just blindly copy instead of going through.
just a concern.
Chango says
What would be the effect if R1 is not used?
admin says
Then you don’t control the current to the LED anymore and your LED will burn up pretty soon.
Colin Mitchell says
Never use a 10 turn pot. You don’t know where the wiper is and you don’t know which way the wiper is going when you turn it clockwise.
Colin Mitchell
TALKING ELECTRONICS.com
Joe says
“Making The LED Turn ON When it’s Dark”
Thank you,
I needed this to “turn off” a blinking led circuit during the daytime.
Mathias Paul says
Thank you so much. It worked for me.
Janu says
Hi! You explained that when it’s dark, the LDR has high resistance, making the voltage at the base of the transistor too low to turn the transistor ON. How exactly does high resistance make the voltage low? Not sure if I’m missing something, but it just didn’t make sense to me. Let me know!
admin says
The LDR and R2 make up a voltage divider. The higher resistance the upper resistor has, the lower the output voltage:
https://www.build-electronic-circuits.com/voltage-divider/
james says
This does not make sense. An ohm meter will tell you all you need to know about a 10 turn pot. Having said that, there is no good reason to use a 10 turn pot here.
Alex says
Hi, I’m making a solar alarm where you use a potentiometer and this LDR circuit to set the relative time at which it will go off, just wondering what potentiometer to use and where to put it.
Bhushan says
Why we use relay.. When there are 9 v bulb there… In place of resistor and led
al imran says
Thank you for the explanation. Very simple and you’ve made it easy understand.
carlos the jackal says
T here’s no thing as “Photons”. Light is RADIO your eyes are RADIO RECIEVERS like little satellite dishes!
Gerry McErlean says
An LDR typically has a resistance of 100 Ohms when brightly illuminated. Since the LDR is the only resistance between +12V and the base of the transistor, a current of (12 / 100 =) 0.12A (120mA) will flow into the base.
Bye, bye transistor.
Adam says
Is it possible to make the LED flash on and off with light intensity
admin says
Yes, but you need a more complex circuit.
Ibiteye Michael says
Hi pls am confused and the circuit……..my question is can i use pnp transistor for that circuit
admin says
Yes, but the function will be opposite. Learn more here: https://www.build-electronic-circuits.com/pnp-transistor/
Md. Rabiul Islam says
It’s very interesting.