I recently purchased a new shed with a polycarb roof. At night, when I enter the shed, I'd like a light that comes on (but not during the day!).

I'm trying to find a way for the light to switch on, when 2 conditions are satisfied.

  1. it is dark outside
  2. the shed door is open

I have resistors, 2N3904 NPN transistors, potentiometers and A3144 hall-effect sensors.

I've already constructed a darkness sensor (see picture). I now want to integrate a hall-effect sensor to keep the light off, when the shed door is closed. I have no Arduino or digital controllers. I would like to stick to the components I have, if possible.

schematic of darkness sensor

  • 4
    \$\begingroup\$ A simple switch on the door would surely be better. Then no current will be getting drawn by the circuit when the door is shut. \$\endgroup\$
    – HandyHowie
    Commented Mar 16, 2020 at 15:13
  • 2
    \$\begingroup\$ I would like to stick to the components I have please list them all. \$\endgroup\$
    – Andy aka
    Commented Mar 16, 2020 at 15:19
  • \$\begingroup\$ Where is your magnet? (i assume on your door, while the hall sensor stays in place) Do you want the lights on while the door is open or switch on-off every time you open the door? What is your power supply and lamp? (e.g. 12V PSU, and LED strip or whatever.. acceptable voltage drop and current can be important) \$\endgroup\$
    – Nyos
    Commented Mar 16, 2020 at 18:57

1 Answer 1


Assuming your magnet is pulling down the hall sensor's output pin, the simplest solution is to put the A3144 in parallel with your photoresistor. Connect pin1 to VCC, pin2 to GND, and pin3 to the upper end of the photoresistor.

This way when there is sunlight, the transistor's base will be pulled down (through the series resistor) to the GND. When the magnet is close to the sensor (door closed), the hall effect sensor pulls this down. Without light or magnet, your potentiometer pulls up the base and the light switches on.

You need to check the appropriate voltages, safe current (A3144 tolerates up to 28V and 25mA), etc. when your other components are known. (probably okay)


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