Connected lighting
The Cheerlights is a fun and innovative idea of connecting lighting equipments to the Internet and allow people to control it by Tweeting the color of the light. It understands a basic set of colors such as red, green, blue, cyna, warmwhite, etc..
A sample tweet will be something like:
Turn #cheerlights to Blue
The hardware
A Spark Core is used to drive a single strip of sixty WS2812b NeoPixel LEDs. An 0.9″ 128×64 OLED display is also attached to show the current time as well as the last Cheerlights color.
A 5V/3A regulated current limiting power supply is used here to protect the LED strip from overloading.
Instead of subscribing to the CheerLights feed (that is, polling the Thingspeak API for the last CheerLights command continuously) as suggested, I have created a TweetControl App on Thingspeak to get it to set the color of the LED strip directly through the Spark Could API.
The Set Up
To do this, you have to first create a ThingHTTP App so that Thingspeak can talk to your Spark Core via sending a HTTP Post directly to your Spark Cloud API.
Fill in the details as below to create the ThingHTTP App for use with the Cheerlights control:
URL: https://api.spark.io/v1/devices/CORE_ID/cheerlights
Method: POST
Host: api.spark.io
Body: access_token=ACCESS_TOKEN&color=%%trigger%%
When this is done, proceed to create theTweetControls for various color accepted by Cheerlights, plus those that are not!
Remember to tick the check box for “Anonymous TweetControl” to allow anyone to control the color of the LED light strip.
Fill in the “Trigger” field the color such as red, green, blue, cyan, etc.. They are case insensitive so don’t worry if you have use different upper case and lower cases for those color, it doesn’t matter.
You have to create one TweetControl per color supported.
The Source Code
Once you are done with Thingspeak.com, grab the source code and flash to your Spark Core.
The source code was written such that a rainbow color will be shown every 30s for a 5s duration, just so it is less bored when there is no change in the cheerlights color.