Automatic Night-detecting Cabinet Light




About: Hello, I'm a week-end DIYer, I like doing little art/craft works when I have some spare time and exchanging ideas with others!!!



I'm sure there are some places around your home that are not well lit, so when you're looking for something in there you always have to hold a light torch in your mouth while digging inside. If you don't have one, lucky you, because I had one right in my room. Maybe some of you remember this Ikea hack I made some time ago: ( ). This little cabinet is fantastic for storing things, but it had a problem: It sits in a corner of my room which is brightly lit during the day, but it's sadly dark at night, because my lamp is too far from it. So I decided to give this story an end and build an automatic light, which only lights up when I open the cabinet's door and only if it's night.

I'm going to show you how to build your own dark detecting sensor without using any complex ICs or Arduinos: just two transistors, a couple of resistors and a few cents worth of other components. I'm not an expert in electronics, so please forgive me if I made any mistakes in explanations.

Step 1: The Parts List

For this build you will need the following parts:

- 1x 9V battery with a battery clip;

- a normally closed button/microswitch;

- 1x 470 ohms trimmer potentiometer: actually this value will change depending on how dark a place you want to illuminate (read on for explanation);

- 1x photoresistor;

- 1x 100 ohms resistor;

- 1x 220 ohms resistor;

- 1x 1Kohm resistor;

- 2x BC547 transistors;

- 4x bright white LEDs;

- 1x double screw terminal (optional);

- a 3x4,5 cm piece of perfboard or copper board;

- some thin electric wire;

Total cost: awesomely cheap!!!!

Step 2: ​Schematics and Circuit Explanation

The above picture shows the schematic used in this project. Working principle is quite simple: P1 is the photoresistor. It is a variable resistor that changes its value according to the amount of light hitting it. The more light shines on it, the higher its resistance value will be. This means that during the day its resistance will be highest and no current will be allowed to pass through it, whilst at night it will be lowest. When night comes, it gets darker and darker and P1's resistance will get lower and lower, until enough current will be let through, to overtake resistance provided by R1+R4, and trigger T1's base. Current taken by T1's base will be amplified, taken by T2's base, amplified again and sent to the LEDs: "and there was light"!!! R4 is a trimpot that allowes you to set a threshold: the higher its value, the darker it needs to be to trigger the LEDs, and that's why the value you'll be using could be higher or lower than 470 Ohms, so choose it according to the darkness of the place you want to light. I think that a good compromise could be 2KOhms or even 5Kohms, but you'll have to experiment!

Step 3: ​Let's Build It, Shall We?

Here comes the fun part: time to heat up your soldering iron! This build is quite simple, so the image above should be clear enough. it should be easy to assemble this circuit both on a perfboard and on a PCB. I suggest you start by soldering the lowest components, like the resistors.

In order to reduce power consuming, I chose to use a normally closed button to interrupt the circuit: I mounted it on a bracket, so that when the door is closed it presses the button and circuit is open (switched off). You can use a microswitch if you have one. I also decided to divide LEDs in two pairs because I had to illuminate two spots: two LEDs are mounted directly on the board, two others are connected through screw terminal X1 to reach the second spot.

So, there you have it: your own DIY automatic cabinet light!

I hope you enjoyed this tutorial and my explanations. If something is not clear or you have any questions, please don't hesitate to ask and I'll try my best to help you!

Thanks for reading



    • Arduino Contest 2019

      Arduino Contest 2019
    • Tape Contest

      Tape Contest
    • Trash to Treasure

      Trash to Treasure

    2 Discussions