Introduction: PIR Cabinet Light
Passive infrared (PIR) sensors are great for large cabinets since they don't require wiring up switches to detect that the door opened. I had a few of the HC-SR501 modules for Arduino projects, but then realised that they can be used standalone as well, since it supplies a logic level (at +3.3V) when it detects motion. The output of the sensor has an internal 1kOhm resistor, so it can't be used to drive any significant light source, but it can switch on a transistor to light a fair number of ultrabright white LED's.
Step 1: Implementation
In this implementation, the power source is a small USB powerbank (2600mA). The quiescent current of the sensor is specified as 50microamps, and the 6 LEDs draw 20mA each. So if the light is on 5 minutes per day, I would expect it to consume 0.05mA*24h=1.2mAh for the sensor and 120mA*(5/60)h=10mAh for the lights. So the sensor only adds ~10% to the total consumption, and a single charge should last about half a year. Using a USB powerbank as power supply means that the voltage is precisely regulated at 5.0V, giving a predictable current to the LEDs, something hard to achieve with batteries.
The schematic is shown in the figure. The very common 2N3904 NPN transistor has a maximum current rating of 200mA, so 6 LEDs of 20mA each is well below that. The white ultrabright LED's drop 3.0 V at 20mA, so each require a 100Ohm series resistor to limit the current to 20mA each. The 1kOhm resistor between the PIR sensor and the base of the transistor could be left out since the module already has an internal 1kOhm resistor. In fact the base-emitter current of (3.3V-0.6V)/2kOhm~1.3mA is a bit on the low side to sink 120 mA through the collector.
I used the empty box of a 1st aid kit from Poundland to fit everything together. It has about the right size and it's soft enough to easily pinch the holes for the LEDs and the PIR sensor. The components are soldered onto a 5x7cm prototype board. The soldering is unusual since the LEDs come out on the opposite side of the other components: this helps to keep the LED leads minimal and fit more sturdily in the holes of the box. To connect to the power I reused a USB cable that was damaged on the micro-usb side. Cutting off the broken micro-USB connector, I soldered the power leads directly to the PCB. An alternative would be to solder a female micro-USB connector to the board and use a regular micro-USB cable.
To attach the box to the ceiling of the cabinet, I used magnets. Six tiny neodymium magnets (6mm diameter, 1mm thick) taped to the box and six taped to the ceiling of the cabinet keep it there tightly and allow for very simple attaching/detaching.
When attached to the ceiling of the cabinet, it lights it up sufficiently. The PIR sensor allows to tune the threshold and the on-time. I found medium threshold and 1 minute on-time to work well.
After I started prototyping it, I saw this type of light also for sale in several shops, but I haven't bought one to confront it yet.
We have a be nice policy.
Please be positive and constructive.