Programmable LED Light Strip

I’m sure you know what LED strips are, if you don’t, here’s an example:

Hardware

LED strips come in different sizes, lengths, colors and qualities. Many come with a remote controller which allows you to set a costume color. What I was looking for, though, was a way to control them through a command line.

After some searching I came across Blinkstick: Smart LED controllers with integrated USB firmware, which is exactly what I wanted.

There’s couple of products available, but I’ve grabbed the simplest BlinkStick Flex Board (scroll down). This does not include LED stripe, it’s just a controller. I’ve got a nice personal message with it:

As for LED stripe, I found it on eBay, there’s a lot to choose from. To get a low quality but cheap LEDs, search something like: 5V WS2812B individual Addressable 5050 RGB. I’ve bought one of the shortest options (1M) with just 30 LEDs, it cost about 3 EUR.

This option will require some basic soldering. If that’s not something you’d like to do, just buy a Flex Board with a strip already attached.

If you do soldering yourself, it’s really easy, especially if your LED strip have cables attached, like mine had:

Just cut connectors off and solder a cable to the controller. Done.

BlinkStick connects to the computer through a Micro USB cable, which is not included. It’s very likely you have such cable at home, but there might be some compatibility issues, and LEDs will not work. I’ve got the best results with the cable from my Samsung Galaxy S7, which can also be ordered from eBay for a couple of euros.

Software

BlinkStick offers APIs for lots of languages, see API implementations. To get a command line access you can simply install Python package. On Arch Linux:

sudo pacman -S pip2 # For me Python 2 works better, I've got some errors with Python 3
sudo pip2 install blinkstick

Check Permission problems in Linux and Mac OS X and add required udev rule.

Use blinkstick --help for help.

Practical implications

I’ve created a light script for Blinkstick, see it on GitLab. It mostly has to do with saving and loading of selected colors and allowing me to turn all LEDs on or off. It also runs as a daemon, which has two main tasks:

  • Turn LEDs off automatically when a full screen application is running.
  • Turn LEDs off after some time of inactivity.

I’ve also created a genmon indicator, which allows me to turn all LEDs on or off manually, through Xfce4 panel:

Finally I’ve modified my Skype and Mail genmon scripts, to blink a particular LED when there’s a new Mail, or when there’s a new Skype message. I’ve also made a bit more complex script, which changed LEDs based on a wallpaper, but I found it not so appealing in the end.

BlinkStick offers lots of possibilities, so if you like examples presented in this article, you should definitely give it a try.