I am a beginner in electronics,

my project is the following: I am trying to build a simple circuit to switch on and off my garden lights according to the brightness level. More to the point, I'd like the lights to turn on when it's dark and off in the morning.

After much thought and some help I came up with this solution which works fine in extreme situations (very very dark and very very bright)

enter image description here

The problems are the following:

1)According to the NPN 2N3904 datasheet, the max current through the collector should be 100mA am I right? However the load of 32 Ohms needs at least 300mA to work properly (375 should be better). Should I change transistor? If yes, what kind should I use?

2)More importantly, using this schematics in LTSpice I noticed that the transistor starts to drive full current (375mA) as soon as the photoresistor hits the 1K Ohms which is obviously too low in order to light up the lights when the sun sets, how can I tune this parameter? Should I change photoresistor as well? Here below is the LTSpice simulation of the current through the load as R changes

enter image description here

In case you need them, here are the datasheets

Photocell (Photoresistor) https://learn.adafruit.com/downloads/pdf/photocells.pdf

NPN 2N3904 https://www.sparkfun.com/datasheets/Components/2N3904.pdf

Thank you

  • 1
    \$\begingroup\$ Take a look at pcbheaven.com/circuitpages/Light_Dark_Activated_Relay It might give you some other ideas on how to proceed. \$\endgroup\$ Aug 12, 2015 at 19:51
  • \$\begingroup\$ The link has been very useful in conjunction with the answer. I understood I had to change something. I used a relay switch to control the load instead of only the transistor. Now it's worked fine so far. \$\endgroup\$
    – mickkk
    Aug 15, 2015 at 17:36
  • \$\begingroup\$ pleased it helped \$\endgroup\$ Aug 15, 2015 at 17:56

1 Answer 1


A 2n2222 would provide a higher collector current - one example at http://www.fairchildsemi.com/datasheets/PN/PN2222A.pdf

But, in order to give you a sharp transition you'll either need more stages or to switch to FET.

Perusing the datasheet, it looked like you probably want it to be all the way on for an R of about 2 kOhm and all the way off for an R of about 20 kOhm. In order for it to be off at 2 kOhm, you'd need about 50 kOhm instead of 1 kOhm in the upper resistor. However, when it is on (say at 20 kOhm), the 50 kOhm will limit your base current to about 200 microA. Assuming a beta of 100, that only gives you about 20 mA of load current.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.