# Confusing dark sensor circuit diagram

I recently bought a set of four "light-control sensor switch" from ebay (link). Circuit diagram below.

I put the circuit together (it was a DIY kit) and connected a protected LED at the output. The circuit doesn't work. I admit that I did not look at the diagram before buying these. I have built similar working circuits on my own but the base of Q1 was always connected BETWEEN R1 and the LDR (with a much lower R1 at that).

Can anyone see how this circuit can be activated by light/dark in any circumstance? Please explain it to me if you do.

Thanks.

simulate this circuit – Schematic created using CircuitLab

• In the dark LDR1 has a very high resistance (Megohm) so the base current of Q1 is too small to conduct leaving its collector high. Q2 can then draw current through R2 to turn on. Mar 9, 2017 at 16:19
• What battery voltage are you using? Mar 9, 2017 at 16:21
• The battery voltage is rated at anywhere between 3 and 9V. I have been using 5V. Mar 9, 2017 at 16:53
• This circuit is not suitable for a 9 V battery supply. You end up with about 8 mA through R2. That means a continuous 8 mA when the LED is OFF. Even at 3 V the off state current is one of the worst design points for the circuit. Mar 10, 2017 at 4:04

This is a crappy circuit. Run away.

It seems the intent is that when there is lots of light, LDR1 goes down in resistance, which turns on Q1, which turns off Q2. When it's dark, Q1 doesn't turn on enough to pull down the base of Q2, which then is able to turn on the LED.

However, there are some problems here:

1. The circuit is highly dependent on the gain of Q1. Transistor gain can vary widely across parts, even from the same batch. If you happen to get one with high gain, Q1 might never be off enough to allow Q2 to come on.

2. There is nothing limiting the current thru the LED. There should be a resistor in series with the collector of Q2.

3. It would be useful to have some hysteresis. This circuit will fade on and off at the threshold light level.

See https://electronics.stackexchange.com/a/53681/4512 for a circuit that actually does what you want.

• Would a reasonably high-valued resistor (> 120K) from the base of Q1 to ground fix the first problem? Mar 9, 2017 at 16:56
• @Olin Lathrop: RE 2.: I did use a resistor with the LED at the output -- that's why I said "protected". Mar 9, 2017 at 16:56
• @Simon: That would help. R1 would then need to be adjusted for the response at the desired light level. Mar 9, 2017 at 17:17

While it's been pointed out that the circuit is 'crappy' which I'm sure is a technical term, there is no reason the circuit won't work in your application. It has some restrictions though, that they should have told you.

1. For a start you DON'T need a series resistor if you use a White LED.
LED's have different voltage (Vf) based on the junctions used:

Your circuit is clearly designed (I use that term somewhat loosely) to use White LEDs. If you use LEDs (RED, Orange, Yellow) then the Vf is lower and you would need a series resistor to limit the current with a supply of 3 V.
Unfortunately if you used a series resistor with a White 3.2 V LED, you'd just reduce the brightness (current flow) to an LED already just on the edge of working (which I'm sure is what the designers intended.

The Vf for a White LED would look much like this:

Notice here that at a battery voltage of 3 V you likely get under 20 mA of LED current, so it's not going to be very bright.

One alteration you could make is to use a 3 cell battery (4.5 V), and include a small resistor in series. For example 75 Ohms would limit the current to around 20 mA.

1. You have to shield the LDR from 'seeing' any of the light from the LED.
While the circuit is not ideal the devices they chose (S9012) do have quite limited Hfe (around 40).
You show BC547's in your schematic, which are a completely different proposition to the S9013. These have significantly higher Hfe (into the hundreds depending on which variant you have). The datasheets for both are S9013 and BC547 so you can compare for yourself.

There appears to be no part number for the CDS photoresistor, so here is a generic datasheet.
From this we can assume that the light resistance is less than 10k Ohms and the dark resistance over 1 M Ohms.
Now Q1 needs to have about 2.3 mA flowing to cutoff Q2, so for the S9013 this would translate (Hfe about 40) to about 60 uA of base current.
If the photoresistor is at low R then the base current would be only approximately 20 uA.
This clearly won't work, so I'm going to assume that the suppliers of the product replaced the S9013 with the BC547.
Base current required for the BC547 (Hfe minimum of 110) is about 20 uA. So this will work providing the photoresistor does get down to 10k Ohms. Not a great design, but at least is should work at room temperature.

If the photoresistor has a dark R of more than 1M Ohm, then the base current is so small that the BC547 cannot turn on to any extent, so the LED would be on.
I noted before that you could increase the battery voltage to 4.5 V, and even here the ratios of base current would allow the circuit to work.

So, do I think it would/should work.... I do. You should be able to take a torch and illuminate the photoresistor and the LED should turn off.
Will the ratio of light/dark conditions work for your application, that I don't know.
If it does not work for your application (light/dark ratio) you might reduce the 120k Ohm resistor to about 50 - 80 k Ohms to adjust the light sensitivity level.

If you are wanting to build your own solution, there are better architectures than using transistors. Transistors tend to be expensive and there are much more effective modern solutions, here's mine:

The 74VHC1G135 is a surface mount device, but provided you are not daunted by that, the circuit has good hysteresis, low off state current (< 50 uA), and costs less than a two transistor version.

• The OP mentioned in a comment that the battery voltage can be as high as 9 V. So no, you really do need a resistor in series with the LED. Mar 10, 2017 at 0:01
• The board he has clearly has 3 V printed on it.....so I'd suggest.....9V seems unlikely. This circuit has considerable off state current because of the configuration, and at 9 V it will draw over 8 mA continuously. The circuit is totally unsuitable for much over the 3 V on the PCB. Running a single LED with a Vf of 3.2 V from 9 V would be asinine. Mar 10, 2017 at 1:11