Intro: LED Light With PIR Motion Sensor, Soft On/off and 2yr Battery Life
A friend needed a light for a basement storage room with no mains electricity available.
- assume 1 minute of ON time per day,
- works from cheap and common batteries,
- long battery life (1 year+),
- possibly hands-free operation.
I decided to use a widely available hobby PIR sensor board as the switch and design around that, aiming for 2 years of battery service.
Step 1: Power Budgeting, Nanopower Constant-current Source With Fade In/out
- A PIR board (such as the https://www.adafruit.com/product/189) runs off 5V-12V. 4xAA batteries (6V) were chosen over a 9V block because of the far greater capacity. This gives us up to 2000mAh of charge capacity.
- The PIR board consumes some 65uA when in standby. There are 2*365*24 = 17500 hours in two years, so the total standby consumption would be around 1100mAh. This is great, because the other half of the total battery capacity remains for LED consumption.
- Assuming 1 minute of LED light a day over two years yields 2*365/60 = 12 hours of light. Given we can use up almost 1000mAh during these 12 hours, the LED current should be set around 100mA.
- The 3V3 logic output of the PIR board cannot drive 100mA. Besides, I really wanted a soft-on soft-off effect.
- The constant-current source at far right turns base voltage into LED current, via the resistor below the emitter.
- The R-C filter between the PIR board and the transistors will act as a voltage smoother to allow for the fade-in/out. Its time constant R*C should thus be around 1 second.
- A single transistor would require some 0.5mA of base current to drive 100mA. This would command the RC filter resistor to be several hundred ohms at most, to avoid a huge voltage drop. Reciprocally the capacitor would have to be huge, in the mF range. For this reason, a darlington (2 transistors) was chosen. The base current of the first transistor is now so small that we can use a 10k resistor, to which 100-220uF is a good match for the fade-in time constant. Transistors are 2N2222A because I have them on stock and they are strong enough to drive the 100mA load while dropping 1V or so.
- When the control voltage is ON, the first base will approach 3.3V, the second base will hang 0.6V lower, and the second emitter 0.6V lower still, which is some 2 volts above ground. A 22 ohm emitter resistor sets the current at cca 100mA.
- All elements are now at less than 200mW worst case, except for the LED, which drops around 3V at 100mA, which means 0.3W of thermal power. Let's take a 1W LED just to be safe and to keep its efficiency high.
No, it does not need an Arduino. :)
Step 2: Electrical
The design is so straight-forward that no guesswork remained in the element selection. After a quick breadboard test, I soldered it all together.
Play with the two trimmers on the PIR to set the desired delay time and ON time.
Step 3: Mechanical
A plastic mains breakout box gets to house the design.
The PIR board, the solderwork and the LED are attached with screws. A drop of clear nail polish is added at the thread of each of the four hex nuts to lock them down.
To mount it on the wall, the large empty box part is screwed against the wall through its back wall.
The battery pack is floated above a chunk of PE foam which keeps it from rattling around.
The cover with the PIR and LED is pressed over until a satisfying click is heard.
Step 4: Sleep Current and Full Load Current
Images say it all. We are within specs!
Step 5: Soft-on Demo
This is how the turning on looks like.
Beside the "cool factor", the soft-on has a useful purpose. Since the LED is a bit too bright to look at directly, the soft fade-in gives one a grace period to direct eyes away before it's on "full burn".
Same effect visible when it turns off.