DIY Outdoor Landscape Lighting

8,256

61

7

Introduction: DIY Outdoor Landscape Lighting

About: Mechanical Engineer/Computer Scientist/Computer Engineer who loves to create practical solutions.

    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

    Step 1: 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.

    Step 2: 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.

      Step 3: 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.

      Step 4: 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

      Step 5: Controller Assembly

      The photos are labeled with all the connections needed to operate the controller.

      Step 6: 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.

      Step 7: 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.

      First Time Author Contest

      Participated in the
      First Time Author Contest

      Be the First to Share

        Recommendations

        • Summer Fun: Student Design Challenge

          Summer Fun: Student Design Challenge
        • DIY Summer Camp Contest

          DIY Summer Camp Contest
        • First Time Author Contest

          First Time Author Contest

        7 Comments

        0
        danielcbright
        danielcbright

        1 year ago

        Great post! I'm thinking about doing this as I have a lot of the parts just lying around. I'm curious how you determine the maximum number of lights that can be run from the power supply? I have 6 12v LED lights, would I need to have a single 12v yellow wire for each of them?

        0
        JasonUMD77
        JasonUMD77

        Reply 1 year ago

        You just need 1 12 volt wire which can power all the lights in parallel. You may be confusing Volts and Watts. Take a look at Ohm's Law formulas! The resistance in this case is the length of the run of wire.

        0
        stevemail
        stevemail

        Question 1 year ago on Introduction

        I like this project and appreciate your posting, including the detailed shopping list and links.
        My question is whether it is necessary to check the internet on an ongoing basis to get sunrise/sunset times. My assumption is that, for any given location, the sunset/sunrise times follow the same cycle each year, and those times could be essentially "hard coded" into the software. I currently do this manually and only t adjust every 2-3 weeks, so it might only be necessary to have a table of weekly or biweekly times. Adding internet access makes this a more complicated project.
        Also, I was wondering if you considered or experimented with a light sensor rather than use sunset times, and if so, why you did not go that route.

        0
        JasonUMD77
        JasonUMD77

        Reply 1 year ago

        All valid questions. I personally don't know enough about the consistency of sunrise/sunset times year-to-year such that it occurred to me to go that route. Also, my intention was to create some code that would be easy for anyone to adopt and entering lat/long seemed to fulfill that need. Adding internet access for me really wasn't an issue. I just set my Pi up in a "headless" fashion, entering my wifi information after extracting the Raspbian image. I have thought about using a light sensor. When I started the project I had not yet worked with I/O pins, or the Pi in this fashion really at all. So it was more a reason of approaching what I was interested in and could manage.

        0
        onehourcleaner
        onehourcleaner

        1 year ago

        Awesome project and result!! Can't wait to update mine with some of your ideas. Voted and congrats on your first instructable!!

        0
        seamster
        seamster

        1 year ago

        Nice, great results! Thank you for linking to the earlier project for reference, too.

        0
        JasonUMD77
        JasonUMD77

        Reply 1 year ago

        Can't take credit for other's discoveries!