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.

The solution I've come up with is the following, but somehow it is not working properly.

enter image description here

I use a 12V battery, in conjunction with a 12V relay switch, a 12V 4.5W LED lamp (in the picture it is shown as a single LED) and a photocell.

According to the specs, the resistance of the photocell should be 10K Ohms during the day and around 600K Ohms at night. Below are the datasheets

Relay: https://www.ghielectronics.com/downloads/man/20084141716341001RelayX1.pdf

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

Is the circuit ok? What am I doing wrong? Thank you

  • \$\begingroup\$ What is the problem? \$\endgroup\$ Aug 10, 2015 at 17:58
  • \$\begingroup\$ If the photocell resistance only drops to 10K in light, it can't possibly control a relay that requires 30 mA. \$\endgroup\$ Aug 10, 2015 at 17:59
  • \$\begingroup\$ What Peter said. A quick scan of your docs show that the photoresistor is limiting current to the relay's coil - this means that the battery will never supply enough current for the switch to close. Do you have an arduino of pic micro lying around? I think that would be the most straightforward way to proceed. Sample the voltage across a divider circuit, and choose some hysteresis bounds to control a BJT. \$\endgroup\$
    – RYS
    Aug 10, 2015 at 18:02
  • \$\begingroup\$ What a silly mistake, I am an amateur sorry. Yes I have an Arduino however I was hoping to avoid using it and build a stand alone unit to replicate for the other garden lights (they're quite far apart, using wires would be unpractical and wireless communication seems too hard for a beginner as myself). \$\endgroup\$
    – mickkk
    Aug 10, 2015 at 18:05
  • \$\begingroup\$ @RYS do you have any hints or suggestion on how I can fix this? Thank you \$\endgroup\$
    – mickkk
    Aug 10, 2015 at 18:38

1 Answer 1


I an embedded solution might be easiest for you, but you can try something like this: enter image description here

Where the transistor is something like a 2N3904, and the diode could be an IN4007. The pot on R2 should be maybe 10k-20k range, the resistor at the base of the transistor should be around 1k, and depending on the resistance of your particular relay, you may also need a small series resistance between emitter and ground to make sure you don't give the transistor too much 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.