Just recently, our family got a new member. Everyone, who has a baby or little kid of their own, will probably agree with me that the one thing you really don’t wanna do is wake your little angels once they are finally asleep.
But one thing that usually tends to wake them (or almost anyone, I guess) up, is bright ceiling lights that are suddenly turned on.
Since I regularly go to bed later than the rest of my family (after staying up and writing blog posts and stuff) and also tend to get up earlier in the morning (at least during the week because of that "job thing"), I either have to:
- find my may in near pitch black darkness (and regularly hit my shins against the bed frame)
- or risk waking our baby when turning on the lights.
I was not particularly fond of either option, so I decided our bedroom needed a subtle ambient (ideally motion activated) lighting system.
Basically an LED strip stuck to the bottom side of the bed frame connected to an IR motion sensor.
Instead of getting an ready-made one (like that), I decided to build my own one, since I had all the required components readily available:
- PIR Sensor
- TIP120 NPN Transistor
- LED Strip (5V)
- Power supply 5V, 2A (amps depending on the number of LEDs!)
- The LED strip I used had an USB connector so I soldered a USB port. But you could as well connect the wires directly.
- I also used a USB (Type B) connector for power supply but you probably want to use a regular 5V DC jack here (depending on your power supply).
- Bread board, cables
Here’s a Fritzing schematic of the circuit.
And here's how it actually looks like.
As we see, the LED strip’s power is controlled using the TIP120 transistor, which is connected to the output of the PIR motion sensor.
As soon as motion is detected, the sensor’s output goes to high, thus triggering the the transistor and turning on the LED strip.
The most challenging part was probably fine-tuning the PIR motion sensor (you can learn about the nitty gritty details here), but basically there are 3 options one has to consider:
- Retriggering on/off: this is normally a jumper setting and it determines whether you are getting a continuous high signal as long as motion is detected or not. You typically want that behavior instead of frequent on / off cycles.
- Sensitivity: This is determined by one the two trimpots. As the name suggests, it determines how sensitive to motion the PIR is. Since the PIR is sitting under the bed waiting for for "feet to show up" I set this to maximum.
- Timeout: The second trimpot determines how long the PIR keeps its on/off state. I went for a nearly minimum setting there since it is set to retriggering on anyway and I don’t want the lights to stay on for too long once I am in bed and do not need them anymore.
That's what the final result looks like.
Works like a charm and our baby is sleeping ... well, like a baby :-)