Intro: Motion Detection Bed Light
Having small children ever so often you need to get out of bed in the middle of the night. Half-awake in the dark you sometimes fail to see the edge of the bed, ouch! As a result,... bruises the next morning.
So what I wanted was a lighting system that would know when me or my wife step out of bed at night. I know there are alternatives already available, but what’s the fun in that.
Step 1: The Theory
To start with I would need to detect light. No need for the system to activate if there is enough light in the room. For this I would require a photocell. In addition my system should, when it’s dark see when there is movement. No need for the system to go off when I or my wife are sound asleep. For this I would require motion detection sensors, one for me and one for my wife. Because I do not want to wake up when my wife gets out of bed. Also, I would need RGB LED’s so that I can pick a color my self and adjust the brightness. Just enough to navigate me and my wife around the bed but not too much to fully wake. According to specialists light green is the color to use. And just because it is possible I would like to be able to change colors through my iPhone and gather data from the system through the internet.
After carefully puzzling and lots of testing, this should all fit together as shown in the Fritzing diagram.
- 1 x Arduino
(in my case I stared with a Arduino YUN during development and ended up with a Pro Micro)
(in my case I started with the regular plastic breadboard for prototyping)
- 1 x Photocell
- 2 x Yellow LED
- 1 x Green LED
- 6 x 12 LED RGB rings from Adafruit
- 2 Capacitors- 1000uF
- 4 transistors - 220Ω
(used for the LED’s and Photocell)
- 6 transistors - 470Ω
(used for the RGB LED rings)
- A whole bunch of wiring
(don’t forget the electrical heat shrink sleeve)
Step 2: The Code
First of all I am not a programmer, fortunate I do know some very good programmers who helped me straighten out my code. My advice would be when you start with Arduino use the IDE of Arduino.
Step 3: Let’s Polish
Now the only thing left is to make sure that 1) I am able to assemble the lighting system properly to my Bed and 2) the electronics are somewhat shielded. For this I used 3D printed models. I have built these models using the software of AUTODESK 123D. This is free software and works great. Of course you can use any other 3D modeling software you like.
Be aware: you are building 3D models for real and not for a monitor.
Step 4: Pro Micro
First a casing for my Arduino Pro Micro.
Step 5: PIR
Then a mount to make sure I can attach the PIR motion sensors.
Step 6: PCB
A very simple case to shield the Perma-Proto breadboard.
Step 7: Capacitor
Two capacitors boxes to shield the capacitors i soldered in the USB cables.
Step 8: Power
Also for powering the 6 LED ring I use a dual USB power adapter with a combined 4400mA, so 2200mA per USB outlet.
Step 9: RGB LED Ring Mount
Finally the cylinders for the LED rings.
Step 10: WiFi
Finally I use Blynk as an interface to connect my lighting system with the cloud and my iPhone