DIY Outdoor Landscape Lighting
by JasonUMD77 in Circuits > Raspberry Pi
10184 Views, 62 Favorites, 0 Comments
DIY Outdoor Landscape Lighting
I have had issues with landscape lighting companies since I purchased my first townhouse in 2003. The transformers are low powered with non-intuitive push button interfaces and cheap screens where wattage seems to be more precious than platinum. Unless you enter a really high price point, the lights are extremely poor quality with scarce-to-nonexistent replacement parts (spikes). The connectors are frustrating and finicky. I have been playing with Raspberry Pi's for a few years and thought it had to be a good basis for a lighting controller. I really wanted to roll my own solution and this became my Spring 2019 passion project for home improvement.
Supplies
Current Successful Supply List
~Shrink Tubing: https://www.amazon.com/gp/product/B071H5XC7C
~Flood Lights: https://www.amazon.com/gp/product/B07FMMQPZ2
~Wire: https://www.amazon.com/gp/product/B004YKCBI6
~Case: https://www.amazon.com/gp/product/B004YKCBI6
~Case Mounting Panel: https://www.amazon.com/gp/product/B004YKCBI6
~LED Waterproof Strip: https://www.amazon.com/gp/product/B004YKCBI6
~Silicone Wire: https://www.amazon.com/gp/product/B004YKCBI6
~Aluminum Channel (U06B10 Black w/ Milk White Cover): https://www.amazon.com/gp/product/B004YKCBI6
~End Caps (U06 Black): https://www.amazon.com/gp/product/B004YKCBI6
~Landscape Staples: https://www.amazon.com/gp/product/B004YKCBI6
~Power Supply: https://www.amazon.com/gp/product/B004YKCBI6
~Raspberry Pi W: https://www.amazon.com/gp/product/B004YKCBI6
~Relay: https://www.amazon.com/gp/product/B0057OC6D8
Watch List
~Connectors: https://www.amazon.com/SRRB-Replacement-Landscape-...
Added Convenience
~Ryobi Battery Soldering Station: https://www.homedepot.com/p/RYOBI-18-Volt-ONE-Hybr...
~Dremel Butane Torch: https://www.amazon.com/Dremel-2200-01-Versa-Multi-...
Failed Solutions
~Outdoor Wire Nuts: https://www.amazon.com/gp/product/B000BW0YG2
~Wire Connectors: https://www.amazon.com/gp/product/B000BW0YG2
~Flood Lights: https://www.amazon.com/gp/product/B000BW0YG2
Inspiration & Acknowledgement
Preliminary searches led me to two separate online instructions that I felt could be combined and updated to create what I was looking for.
~Colin Miles, aka onehourcleaner on Instructables, inspired me with this post. He explained the power supply wiring perfectly so I'm not going to rewrite his work, rather I'll add some updates.
~Matyscabreras on YouTube created a great video on DIY LED lights.
Methodology
Based on the inspirational posts my goals were as follows:
~Utilize a PC power supply which will power both the lights and a Raspberry Pi.
~Write custom Python code which would control turning the lights on and off.
~Utilize a web service to determine sunrise/sunset times as a basis for controlling the lights.
~Construct my own lights so that replacements can be easily produced.
~Publish solution for others to utilize/improve/enjoy.
Sunrise/Sunset Web Service
As mentioned in "Step 11: Improvements In-progress & Wrapping Up" of one of the inspirational posts, Colin mentions using Weather Underground by obtaining an API key. Unfortunately, WU's API has reached end of service. I did find another service called Sunrise Sunset that utilizes a simple REST API. You can form the appropriate URL incorporating your latitude and longitude coordinates in decimal degrees. When called, the API will return JSON with the sunrise and sunset at that location in UTC time.
An example URL and response is as follows:
URL
https://api.sunrise-sunset.org/json?lat=36.7201600...
Response
{ "results": { "sunrise":"6:31:48 AM", "sunset":"5:32:25 PM", "solar_noon":"12:02:07 PM", "day_length":"11:00:37", "civil_twilight_begin":"6:05:35 AM", "civil_twilight_end":"5:58:39 PM", "nautical_twilight_begin":"5:35:23 AM", "nautical_twilight_end":"6:28:50 PM", "astronomical_twilight_begin":"5:05:23 AM", "astronomical_twilight_end":"6:58:50 PM" }, "status":"OK" }
When writing my Python code, I struggled a great deal in dealing with and converting between timezones. I believe my code is working as I intend. A good test will be when the clocks change for daylight savings time. In hindsight, a future improvement may be to set my Raspberry Pi to operate in UTC and perform no conversions at all. If I decide to do that, I will update these instructions.
Python Code
I added my Python code to the "OutdoorLighting" repository of my GitHub. I absolutely welcome input on my Python code. The README.md is as follows:
Python scripts used to automatically turn outdoor lighting on/off from a Raspberry Pi. Utilizes the Sunrise Sunset REST API to return times in JSON (https://sunrise-sunset.org/). Uses the following packges: python 3 pip3 python-requests python-dateutil Using the following cron to run this script at 1 am everyday and on system reboot (crontab -e): 0 1 * * * /home/pi/OutdoorLighting/OutdoorLighting.py @reboot /home/pi/OutdoorLighting/OutdoorLighting.py
Controller Assembly
The photos are labeled with all the connections needed to operate the controller.
Light Construction
After some trial and error, this is the light design I settle on which I'm pleased with. The photos are labeled with specific instructions.
Conclusion
This project was slightly challenging, sporadically frustrating, and very rewarding. I wasted some money during my personal R&D, but not much. I spent more than I needed to on the ATX power supply in order to offer future expand-ability. The plan is to run lighting completely around the house. The lights themselves turned out very modern and attractive. Some may prefer a tiered light and I'm sure a plug-and-play solution can be sourced on Amazon.