My Blög

Fancy LEDs with Electric Imp

2013-02-13

For no particular reason I felt a sudden urge for an Internet-connected RGB LED strip that can produce various light patterns. Just for fun really. But who knows what awesome uses it might have.

I decided to base this on addressable LED strips that are available. The great things about them is that each LED (or groups of LEDs for some models) is individually addressable so you can set the colour and intensity as you whish, wherever on the strip. They all make use of a driver cirquit called WS2810, which operates on 5V and regulates an RGB LED. You communicate with the strip over SPI for which there is plenty of support from various controllers like Arduino, Raspberry pi and Electric Imp - which is my chosen controller. The Electric Imp makes is super easy to get the strip on the Internet as it packs wifi connectivity and two easy to use SPI ports in a very small package.

Connections

The Imp has two SPI interfaces, I chose the one on pins 2, 5 and 7. To make it running I connected pin 5 on the imp to the strips clock wire and pin 7 to the data wire, and then 5V power and ground to both the imp and the strip. Pin 2 is not used as the strip doesn’t return any data. That’s all really. No need for a connection diagram.

Demo!

Code

Example code for the imp is on github, where else and is very much WIP so don’t rely too much on it. But please help making it better.

A running example webapp that should work if you have deployed the code to your imp is here on github pages - very neat way to deploy and run simple web apps.

Plans for the future:

  • Proper code, now it’s hideous and lacks architecture
  • A fancy web app for designing your light show
  • A must-have app for your phone
  • Awareness of Goethe’s colour theory. Or maybe not.

Per Ejeklint in disguise

Writings by Per Ejeklint, living and working in Stockholm, Sweden. Follow me on Twitter!