2013-05-22

Hey, wouldn't it be awesome if I could connect a string of multicolor LEDs to a little computer and control the LEDs over my home network? Yes, as a matter of fact, that would be an excellent thing to do.

Step 1: Aquire LEDs

For this experiment, I purchase two strips of 50 ws2801 Pixel LEDs from a merchant in China and after a few weeks, the LEDs arrived and it was time to get hacking.

Step 2: Hack Some Code

The software for controlling the LEDs needed to have the following features:

  1. a Web UI so that I could control the LEDs with any device connected to my home network.
  2. a simple API that would allow controlling the LEDs with a GET request from any programming language

To meet my needs, I opted to use the Ruby programming language for the server and jQueryUI for the Web Interface. This decision was based on the Ruby language's standard library webrick module which makes it very easy to create a webserver that serves static content, and also makes it trivial to map URLs to specific functions and methods.

The end result is GLMR, the Glrm Light Manipulation Regulator. Wow, what a crappy recursive backronym. Honestly, I constantly forget what the 'R' stands for and I have to look it up.

The Web UI

There isn't too much to the built in Web UI. Enter a hexadecimal, or adjust the RGB sliders and then click Set to change all of the LEDs to the selected color, or click Fade to slowly fade the LEDs to the selected color.

There are also 3 modes for the LEDs:

  1. Chase: one LED is illuminated at a time across the length of the LED string
  2. Full: all LEDs are illuminated
  3. Twinkle: the LEDs randomly turn on and off

Using the API

Since the browser on my n900 is getting a bit old, I decided to write a Python Qt application that uses the GLMR API and it works wonderfully! Thanks Qt!

Wait a second! If the API is so simple, why don't I have more ways to control the LEDs? Aha! I'm one step ahead of you.

Remember Blather the speech recognizer that runs commands? Well, I've configured Blather to control the LEDs and here is the video of Blather and GLMR working together.

Booyah!

Now quit reading, and go hack some code ... and some LEDs

Comments
Name:
not required
Email:
not required (will not be displayed)
Website:
not required (will link your name to your site)
Comment:
required
Please do not post HTML code or bbcode unless you want it to show up as code in your post. (or if you are a blog spammer, in which case, you probably aren't reading this anyway).
Prove you are human by solving a math problem! I'm sorry, but due to an increase of blog spam, I've had to implement a CAPTCHA.
Problem:
8 minus 2
Answer:
required
subscribe
 
2016
2015
2014
2013
2012
2011
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008