PoempelFox Blog

[..] [RSS Feed]
 

Sat, 26. Dec 2020


chain of RGB lights Created: 26.12.2020 23:42
I haven't blogged anything here for a long time, and I probably won't resume to do so - if I post anything at all, I'll likely do it over on Mastodon nowadays: @PoempelFox@social.tchncs.de. However, I've just finished reprogramming my christmas lights, and am a bit in the mood to blog about it, even though this really was in no way a spectacular project.

When I was younger, chains of lights used for christmas decoration used small colored light bulbs. Then a few years ago, LEDs started taking over, and they took over fast. Mostly, this was a change for the better: No more changing the broken bulbs every year, and much much less power usage. However, there was one big downside to the LED chains of lights in my opinion: The colors. There were a lot fewer of them than with the old classic bulb lights. No matter what or where you buy, LED christmas lights practically always have at most 4 colors: red, green, blue, and orange. The ones with the classical light bulbs usually featured more than that, almost always including e.g. pink and aqua. For this reason, I missed the old lights.

Now there is of course a solution to this problem: chains of RGB lights, where every single LED can take any color, are available. However, these then need a controller to control them, and these controllers usually focus on lots of blinking and blinking patterns and frequently changing colors and more blinking. In other words, they suck. I want my lights to be colorful, not give people with epilepsy seizures. So I decided to build my own.

Luckily, this was a pretty trivial project. The bill of materials that I used when I built this in 2018 was:
  • String of WS2811 RGB LEDs. These are available in a 'christmasy look', i.e. with green instead of colorful cables and inside a case instead of the naked LEDs soldered to a circuit board. I used two strings of 50 LEDs, this one, and chained them together for 100 LEDs in total.
  • Large 5V power supply capable of driving the LEDs. I used a 5 volt / 10 Ampere supply, specifically this one.
  • An AVR microcontroller to control the LEDs. I used a random Arduino Nano clone off Amazon, this one.

Assembling is just powering the strips and the arduino, and connecting the 'data' pin from the WS2811 strips to one of the pins of the microcontroller - I used the one labeled D9, which is PB1 in AVR speak.
You need to be careful when programming the microcontroller through its USB port though: You must not try to power the LED stripe from the USB port, that cannot work. Conversely, you should make sure to not send power into the USB port, your USB port might not like that. For this, I put a simple switch between the power pin of the microcontroller board, and the power coming from the power supply for the LED strip. That switch needs to be off before plugging the microcontroller-board into USB.
The software/firmware is trivial - there is plenty of info and example code for talking to WS2811 strips. The most work was getting the colors to look good.

My firmware has two modes for the LEDs, which it alternates: In mode 2, it generates a wonderful rainbow color gradient. In mode 1, it just selects a totally random color for each LED. In both modes, it will slowly move the colors along the chain over the course of 21 seconds, so for example if LED #2 is red, then 21 seconds later LED #1 will be red instead, and LED #2 will have a new color. At the end of the chain, a new color will be selected (depending on the mode), and slowly fade in. The moving of colors is so slow that you really cannot see it unless you stare at the LEDs for an extended period of time (which I would not recommend - they really are quite bright), yet over time the chain of lights will look different.

Here are two pictures of the christmas lights in action. Note that the camera is unable to cope with the lighting conditions - the lights look a lot more colorful in reality.


And finally, here is a [gitlab project on gitlab.cs.fau.de with the sourcecode].
no comments yet
write a new comment:
name or nickname
eMail adress (optional)
Your comment:
calculate: (2 times 10) plus 3
 

EOPage - generated with blosxom