I’ve seen numerous projects that use LED light strips for Christmas (and other holiday) lighting but very few document the process and provide the details and solutions that were involved in overcoming the various hurdles involved. I’ve been wanting to do this for several years now and finally decided it’s time to stop talking and start doing. After brain storming ideas with several family members and friends who have also expressed an interest in this type of project, here’s what I’ve decided to do…
First off… Pay strict attention to text in RED. It’s important information and you’ll be glad you did. It may even save you from having to replace damaged or broken parts, limbs, or housing. It has come to my attention that it’s much easier to learn from someone else’s mistakes, than it is to repeat them myself.
WARNING: Take on this project at your own risk. I cannot be held responsible for any problems or issues that arise from following, or not following the ideas, suggestions and warnings declared, implied, or neglected in this article. I am simply sharing what I did. There are numerous warnings marked in RED but I haven’t caught everything. Please read these carefully, use common sense and proceed at your own risk. By reading further, you agree that you will be responsible for your own actions.
Here are my (primary) goals of the project:
- Awesome Multi-Holiday lighting for year round festivities.
- Easy to program and re-program the lights for any occasion.
- Low budget. Use what I can find laying around if possible, order what I must.
- Document the process so we can collaborate and share ideas and solutions.
- Individually addressable LED strips so that I can create memorizing patterns and seizure inducing effects.
I started by ordering two 1 meter lengths of WS2821B – 60 pixels/m RGB 5050 LED strips. For more on the types of strips and why I chose what I did, see: About LED Strips. To be able to control the LED’s in the light strip, I needed a micro controller. There are a many different types of micro controllers that can be used but since I’m on a budget, the less expensive the better. I’ve built previous project with both the Raspberry pi, and the Arduino so those were logical choices. The Pi typically runs Linux which is a preemptive operating system which makes it difficult (not impossible) to control devices like this that require special timing. It is also a little more resource hungry, so the Arduino seemed to be the better choice. Since I already had an Arduino Uno lying around, I didn’t need to order that.
Now that I have my lights, and my micro controller, it’s time to get started. Tweaking4All.com has a great article on getting started on controlling a simple LED strip with an Arduio so I won’t get into that here. Suffice it to say that with that article, a strip of lights, and an Arduino Uno, I was up and running in about 20 minutes. Since I’m a programmer by profession, creating simple patterns to upload to the Arduino were easy. I’ll post more information on the actual programming for the patterns on the Programming the LED lighting page. To start, I used the Adafruit NeoPixel library as described in the Tweaking4All article, and their sample program to test the lights and make sure everything was working as expected. Here’s what I ended up with:
I found that an old telephone connection cord (4 wire) is sufficient for powering the Arduino, and has two extra wires for data. Convieniently, it also has the same wire colors as the LED strip I ordered so it’s easy to trace. I’m using Red for +5vdc, Black for ground, and Green for Data. The Yellow wire above, you’ll noticed is currently unused. I may need that for later… In the photo above, the Arduino is also connected to my computer for programming via the USB cable. Be careful with this however. See the “Cautions” section below for more info. Note that I did use the resister desribed in the above mentioned article. It’s soldered in-line on the data lead and covered in shrinkwrap. (see image above)
Powering the Aurdino and LED strip(s)
The Arduino runs on 5vdc and also has a 5vdc output. While this may seem convenient, do not try to power your LED strip from the Arduino! If you’re running more than 10 LED lights, I suggest powering the strip separate from the Arduino.
You can permanently damage your Arduino and possibly your LED strip. Since both the Arduino, and the LED strip is purchased bot run on 5 volts, I decided to use an old computer power supply. It provided a multiple, well regulated 5v outputs. As you read on, you’ll see why I needed multiple 5v outputs.
Keep in mind that you’ll need to jumper two pins on the power supply to get it to think it’s connected to a computer before it will power up. There is a good photo of that in this article on Imgur here.
Once that was all connected up, I ran the sample program that came with the NeoPixel program and everything came right up. Sweet! After playing around with a few patterns and creating a couple of my own, it was time to increase the scale.
Time to Scale it up
Time to scale it up a bit. So I ordered 30 meters ( 6 sets of 5 Meter lengths). As it turns out, there is a reason you can only find the strips in a maximum of 5 meters. This seemed a little silly to me… but then I figured you why they do this. Keep reading….
5 Meters test. Just to keep my sanity, I decided to hook up each set incrementally and solve any problems I encountered along the way. It was a good idea because I realized quickly I was going to have power issues. The first 5 M strip when flawless. I just used the same setup from the article. When I loaded up the test program I set the # of LED’s to 300, reloaded it. It ran great.
10 Meters test. Time to add the second set. I connected the 2nd 5 meter set to the first, updated my LED count in the program to 600 and re-loaded the program. Here’s where I ran into my 1st technical issue and this is where I found out why they’re sold in 5 Meter lengths. After connecting the second strip, My second strip of LED’s were somewhat dimmer than the first set, and the colors near the end of each strip were fading.
Due to the natural resistance of the wire in the strip, and the power drain of the previous LED’s in the strip, power at the end of the strip tends to drop a bit. By the end of the 2nd strip it was well below 4 volts. To solve that, I simply ran power at each end of every strip. For the richest most brilliant colors, you’ll need to provide 5vdc power to the strip every 5 meters. I found that if I inject power every 5 meters, things work out great, If I try to go longer than that, the LED’s near the end of the strips tend to be more dim and the colors get washed out.. So.. when designing my layout, I need to have 5vdc power available every 5 meters (approx. 16.4 feet). So this is what I’ve got so far.
Note that I have power fed into the Arduino AND both ends of each LED strips independently. This solved my fading problem.
Now for some important notes:
- Most LED strips have small arrows etched on the strip to indicate the direction of data flow. This wiring shows the data flow as blue arrows. Make sure you have your strips lined up correctly.
- DO NOT plug your Arduino into your computer through the USB connector while the power in the above circuit is turned OFF. Make sure you turn the power to the Arduino and LED strips on first BEFORE you plug in the USB cable. Otherwise your Arduino will draw power from the USB cable, and try to power the LED strips. The USB cable circuits on most computers can’t handle this and you may damage your computers USB port, the Arduino, and LED strips.
With this setup, the Arduino had no problem running 10 meters (two 5 Meter strips) of 60px per meter LED strips. That’s a grand total of 600 pixels (1800 real LED’s @ 3 per pixel). With a single IO pin on the Arduino, I could successfully write programs that could address and control each of the 600 pixels and I have to say it looked impressive. Well
15 Meter test.
When I first hooked up the third 5 meter strip, and set my LED count to 900, what I ended up with was less than impressive. Even though I had applied power at the end of each strip. The Arduino program failed to light the LED’s up. A few of the LED’s came on but with unexpected colors and intensities. This one was a bit of a head scratcher and took me a little while to figure out. What I figured out is that a single I/O port on the Arduino was only capable of addressing 650 individual LED’s in the set. I don’t know if it’s a restriction of the address space in the WS2812 chip, or something in the software library I was using but I couldn’t go above 650 LED’s on a single I/O port. If I set the LED count in the software, to 650 it worked great. The first 650 LED’s would light. If I set the count to 651 (one more), then none of the LED’s would light. Probably something related to the address space and the # bits it takes to address each chip in the sequence.. If someone wants to dig into a more in-depth explanation that would be great. I’m just too lazy at the moment to dig into it…
My solution is to allocate a second I/O port on the Arduino to manage the next two 2 Meter strips. With a total of 8 I/O ports on the Arduino, I should be able to control all 6 sets. More on that later…