<
At this point I still had no idea what I’d use it for, but was able to write some simple sketches to control the individual lamps. All was well.
So what to do with a 3×3 ambient light?
I ran through various ideas including indicating weather forecasts, a count of unread emails, and any ‘ending soon’ eBay auctions. But in each case there would be a lot of bespoke coding required and, actually, the output would be pretty cryptic: “what does one red ball, two cycling balls, a flashing ball and four off balls mean again?”
So then I had an idea… could I display a text font on a 3×3 display? I had a hunt around for any fonts that would work on a 3×3 matrix. To my surprise I found a few and in the end I created my own font using some of the others as inspiration.
Some Arduino sketching later and I had the whole printable ASCII range mapped out in an Arduino array. Input via the serial line was printed directly to the display – result.
OK, so now it displays text, what next? Well, then I thought, “Is there a good existing API for handling small amounts of text?”. Twitter seemed like the obvious answer.
The Twitter angle
The benefits of using Twitter seemed pretty clear: the API is rock solid; there are clients for just about every platform I might want to send from (web, iPhone, SMS, etc); and it would be easy to hook it into other applications – like that weather forecast idea I’d had previously.
Putting it all together
Using the PHP OAuth library by Matt Harris it was pretty straightforward to get Twitter messages via the API. It can show anything that is available via the API, and right now I’ve settled for @ mentions for 9bulb. So if you send a message @9bulb it’ll pop up on my panel – sweet!
The one shortcoming at this point was that the messages ran across the panel in real time, even if I wasn’t there to see them. To fix that, I added a second ‘mode’ to the Arduino code.
In this mode the Arduino powers all lamps constantly, making it work just like it did when I bought it. But when a message comes in it’s held on the serial buffer and the lamps change to display a red cross to indicate an incoming message.
I then coded the old power switch to control modes: off for buffering, on for playback.
That’s about it. If you fancy trying it yourself the code is now available on GitHub: https://github.com/grantgibson/9-bulb
Thoughts for the future
Right now it’s a read-only Twitter client. A nice future enhancement would be to allow for the creation of messages directly on 9bulb. I don’t want to modify the case of the unit, but the power input socket is now free. It’s a 3.5mm headphone-style socket, so my current thinking is to have an external Morse code key which could be plugged into that 3.5mm socket. Messages could be tapped out in Morse and potentially previewed on the lamp display before sending.
If anyone wants to have a go at writing the sketch (and/or the PHP) for that I’d love to see it. There are several Arduino Morse input projects on the go, but I haven’t yet thought about how to handle both incoming messages and incoming dot-dash sequences in a single code loop. Thoughts on a postcard please.
One thought on “9bulb: a Twitter client in nine lamps”