Published on 23 December 2014
You tweet the keyword
cheerlights with a colour and the global CheerLight feed updates and all the connected lights update to match.
I wanted to combine the polypropylene tree topper I made recently with a simple RGB LED.
Arduino is great for a quick electronics prototype but network access is tricky. The Raspberry Pi offers much easier network support but it’s a bit bulky and there’s still setup involved before you can start prototyping. At work we have a radiodan disk image which has an environment that makes this a little easier but the distance between setup and prototyping is still quite a while.
I’ve been wanting to experiment with the Electric Imp since it’s supposed to offer a quick setup experience for connecting to wifi, writing code and sending to a device. It’s also really small (the same size and shape as an SD card) and the breakout board doesn’t add too much size.
I hooked up an RGB LED to three pins and ground.
In the Electric Imp model, you write 2 pieces of code, one that runs on the
device itself and the other runs in the cloud as an
agent. This is a neat idea as it means you can write complex code that runs on the server and just send data to the device when required. I poll the CheerLight API regularly and when the colour changes, send the new colour to the device.
ElectricImp also provides an
agent event whenever a device connects to the network. This makes it really easy to send the current state when a device is switched on.
Both types of code are written in a web-based IDE and are deployed whenever you Save. This makes iterating very simple and quick.
The whole thing works nicely and the Imp syncs with the agent very quickly when the lights are turned on. I’d definitely consider prototyping with it again.