Internet of Things Christmas Tree #CheerLights #FastLED

Posted: 07/12/2014 in Arduino
Tags: , , ,

In this project I detail how I created an Internet light controlled Christmas tree. Last year I heard about a great project by ioBridge Labs named CheerLights but unfortunately at the time this was late December and it was simply too late for me to join in, well not this year! The idea of CheerLights is a simple one: connect a strip of RGB LEDs to an Internet connected Microcontroller and have it query the CheerLight servers for the current colour, now the real magic here is that anyone can synchronously change the colour of every CheerLights setup by sending a Tweet with Hashtag #CheerLights, for example

Here’s a quick video from ioBridge about CheerLights including a demo

If you’d like a go yourself please choose from the following supported Colours:

Warmwhite / Oldlace

You can see what the latest colour is right now by visiting or, getting the app android/iPhone and there is even a Google Chrome plugin but at the time of writing this is missing some of the new colours.

The Build

As with all projects of this nature, they can be customised to your own personnel preferences so I’ll not tell you what you should get but instead what I used for this build and I’ll try and highlight some pointers. I’ve got a few Arduino MCUs now, in fact I’m beginning to wonder if I’ve inadvertently become a collector as it seems I’ve just about one of each type, so from my stock I decided on a combination of Arduino Uno and Arduino WiFi Shield. The only real requirement here is that you use an MCU that you are comfortable with, if you have the same hardware (or similar – replacing the WiFi Shield with the Ethernet Shield would require minimal code changes) then you can simply upload my Sketch and away you go.
To control the LEDs I decided to use the FastLED Animation Library. This is quite a mature project and the library makes for some simple and easily readable code. FastLED supports popular LEDs including Neopixel, WS2801, WS2811, WS2812B, LPD8806, TM1809, and more so plenty of options. I went with a string of 25 WS2801 from



You’ll also need a Christmas Tree, I picked up a desktop sized one from eBay –




Be sure to get a power supply that can output at the correct voltage and has sufficient ampere to run the lights. Looking at the spec of my lights I know I needed a 5volts 2A (60mA*25=1500mA) AC Adaptor. I used a single AC Adaptor to power both the Arduinos and the LEDs with a splitter.

Tip: Don’t use the VIN on the Arduino to power more than 1A as this is the maximum tolerance of the forwarding diode, instead use a splitter.

The Code

Sketch flow
Boot up and connect to WiFi (halt on no connection) and run the Startup Routine (clears LEDs Black-White-Black)
Set current colours to black.
Start loop – { Check for current colour via ThingSpeak API
If it’s the same as the last check then wait and check again, if we’ve checked a couple of times without change then play either the Sparkle* or Twinkle* effect.
If the colour is different; then transition from the original colour to the new colour via the RGB colour wheel (see below image) using the shortest path, for example Red>Green would transition via Orange and Yellow or Blue>Red would transition via Magenta-Pink.



*The Sparkle effect increases the brightness of a single LED and runs that back and forth over the strip.
*The Twinkle effect creates a FastLED Colour pallet of the current colour with black stripes which is then looped over the LED strip.

I’m using the FastLED library which made coding these transitions and effects extremely simple.. The FastLED library has a lot to offer, one of my favourites is its ability to allow for compact colour palettes which use very little of my precious Arduino RAM, here’s a sample of the help section which explains this feature:

Normally, in computer graphics, the palette (or “color lookup table”) has 256 entries, each containing a specific 24-bit RGB color. You can then index into the color palette using a simple 8-bit (one byte) value. A 256-entry color palette takes up 768 bytes of RAM, which on Arduino is quite possibly “too many” bytes. FastLED does offer traditional 256-element palettes, for setups that can afford the 768-byte cost in RAM. However, FastLED also offers a compact alternative. FastLED offers palettes that store 16 distinct entries, but can be accessed AS IF they actually have 256 entries; this is accomplished by interpolating between the 16 explicit entries to create fifteen intermediate palette entries between each pair.

If you’re interested in lighting effects then I suggest you take a look at the Wiki

You can pick up a copy my code from GitHub –

Here’s a quick demo of it in action

Thanks for reading and good luck with setting up your tree

Merry Christmas!


  1. […] but surely the venerable traditions of Christmas must be immune, right? Wrong! Over on his blog John Milner has a fun little project to create an IoT Christmas tree, in which he hooks CheerLights […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s