I made this device for our driveway at the back of the house. There is a motion activated light near the back door but it doesn’t quite cover the driveway section because of a tree that’s on the way. So this presented quite a good opportunity for a side project.
- Must be powered by a battery since no power outlet available.
- Motion activated
- Works only when dark
Motion detection can be achieved using a PIR (Passive Infrared) sensor. For this project I am using a PIR sensor I got from Adafruit. This sensor has a built-in signal processor, which makes using the sensor very simple.
This motion sensor runs on 5-12 V so I decided to use four NiMH rechargeable batteries. These batteries are 1.2 V each. For charging these batteries the easiest and most convenient solution is to use solar power. The solar cell I picked up from the local electronics store is rated at 100 mA at 7.2 V in full sunlight. Since the maximum amperage is lower than 1/10th the battery capacity (2500 mAh) I don’t need to worry about charge control circuitry (Check out this document by TI about battery charging).
So how to detect if it is dark? I am using a photocell for that. The resistance of the photocell increases as the ambient light decreases. By putting the photocell in a voltage divider the change in resistance can be translated into a change in voltage, which is used to control a MOSFET that drives the LEDs.
As with all my projects I first breadboard it to see if theory works as it should. If it works on the breadboard, there is a very good chance the actually circuit will work. As seen below in the schematic the circuit is quite simple. The schottky diode prevents current flow back into the solar cell, and also it has a very low forward voltage drop (~0.15 V) compared to regular diodes (0.7 V).
Once I verified the circuit works on the breadboard the next step is to make a case for it. And that’s why I got my 3D printer. I designed this case to fit the particular fence we have in the backyard so it is not universal.
For the light, I decided to use the front section of an old LED flashlight. This gives a better beam for the light than making my own LED assembly. The photos below show the assembly of the device.
After putting the case together and verifying everything still works the last thing to do is to waterproof it. Completely waterproofing things is very difficult. I used a glue gun to cover all open edges. This should keep most of the water out but time will tell if it will be enough.
And finally here’s a video that shows how this works: