This website was originally written in Ruby and hosted on the Raspberry Pi. It's now archived at GitHub for posterity!

Making A PiGlow Remote

A week or so ago I discovered the Pimoroni PiGlow via Twitter. Not so long after, it arrived in the post and I excitedly set about discovering its ins-and-outs.

First up, the PiGlow is small. Really small. It shouldn't come as much of a surprise, since in the photos its clearly narrower than the GPIO header. The diminuative size of the PiGlow counts in its favour, letting it fit snugly inside a PiBow case.

The PiGlow neatly circumvents the current expense and supply problems with RGB LEDs, its 18 LEDs are discrete colours, fanning out from a central point in 3 spokes of white, blue, green, yellow orange and red triplets. Because the PiGlow has Red, Blue and Green LEDs it's capable of producing a whole range of colours when combined with a suitable diffuser. I decided to repurpose a table-top, spherical glass lamp, which we'd been wanting to put an RGB LED bulb in for quite some time. If you want to achieve similar results, it's the FADO mouth blown glass lamp from Ikea it's a perfect enclosure for an RGB lighting project, and fits a Pi easily. It also costs only £12.

Turning the PiGlow on and off via SSH quickly got tedious, so I decided to put together a colour-wheel remote in Python and Javascript so that I could pick up any device around the house and adjust the lamp.

After experimenting with Django and becoming frustrated with its arcane approach to routing, I switched to Flask which is a little closer to Ruby's Sinatra and much easier to get to grips with.

To build the front-end for the PiGlow lamp, and ensure it would work at least in desktop browsers and the iPhone/iPad, I opted for my current favourite combo of jQuery and RaphaelJS. RaphaelJS is an SVG library which makes dynamically generating interactive graphics easy.

In this instance I used RaphaelJS to generate the colour wheel, which I limited to between 20 and 36 colours. In my current version of the remote code, which can be found on GitHub, I have a tap-to-select colour wheel. But I've already completed a drop-in replacement which will provide fluid, drag-and-drop fading between all the available colours.

My remote code is still very rough around the edges, but it's extremely satisfying to use and the PiGlow was a much better investment than an expensive RGB LED bulb. I plan to use the Orange and Yellow LEDs to provide a warmth adjustment to the overall light. Also, with all the LEDs driven to their full brightness the PiGlow seems to provide a pretty good approximation of white light and thus works as a very functional lamp in addition to a novelty RGB one.

« Back to index Posted on 2013-08-26 by