# Dark sensor with transistor

Why do most of dark sensor circuits in the Internet look like this?

It seems to me that in such circuit, photoresistor doesn't limit base current and it doesn't work. I think that photoresistor should be in base circuit, as in the image below:

• The NPN transistor only needs a small current to be able to make the LED light up, even in the dark, that LDR will conduct enough current for that. So in your (drawn) circuit, the LED will be always on. In some cases, it might light up a little bit brighter when light falls on the LDR. Jul 12, 2021 at 20:03
• In the first circuit, light on the LDR actually draws all the current away from the transistor so it will then turn off. And resistor R2 limites the base current so the base current is limited. I suggest that you get some components and try this yourself! Jul 12, 2021 at 20:04
• If it is just a toy, that kind of schematic is okay. They really should have hysteresis, built in, and this will mean at least one more BJT. It's also nice to have a way to adjust the threshold and that means a potentiometer, as well. Most dark sensors on the internet look like that one probably because it "kind of works" and is easier to explain so there is less work in presenting the idea and it can reach a much wider audience with much shorter attention spans.
– jonk
Jul 12, 2021 at 20:23
• Also, let's not forget that a lot (if not the majority) of places on the internet where you find many circuits don't have rigorous design review – things get copied over and over again, not because the design is great or very clever or illustrates an important concept, but simply because it was there and easy to copy. Jul 12, 2021 at 20:54

It does limit the current.

When there is more current flowing via photoresistor, there is less current available from the 100k resistor R2.

If the photoresistor resistance goes low enough to pull the base voltage below about Vbe threshold of 0.6V, the transistor will be off.

The circuit you propose where the LDR is in series on the transistor base, it never drops the voltage below Vbe threshold and so the transistor never turns off.

• R2 biases Q1 on.
• The LDR "steals" the bias from Q1 when its resistance gets low enough.
• Q1 will need about 0.6 V on its base to turn on. This will occur when

$$\frac {R_{LDR}} {100k} = \frac {0.6}{8.4} = 0.071$$ $$R_{LDR} = 100k \times 0.071 = 7.14\ \mathrm{k\Omega}$$

If RLDR drops below this value the LED will turn off.

In your circuit there will still be some current through the transistor base when it is supposed to be off, turning it on slightly and lighting up the LED dimly.

In their circuit, if R2 is chosen correctly, the transistor's base-emitter voltage (Vbe) will be too low when it's off - lower than about 0.6 volts - and no current will flow through the base, leaving the LED completely off.

Also, your circuit is backwards. Because the LDR has a lower resistance when it's brighter, your circuit lets more current in to the base when it's brighter, instead of when it's darker. In their circuit, when the LDR has a lower resistance, it directs current away from the base.