CheerLights for Raspberry Pi Zero W and Blinkt!

Well, it’s that time of year… CheerLights time of year! I started CheerLights back in 2011 with one set of lights. Now there are lights synchronized all over the world and the project gets popular around the holidays. The idea behind CheerLights is to show how we are all connected. We are in this together. When someone changes the CheerLights color (via Twitter), all of the connected lights also change to that color.

For this season, I wanted to try out the Blinkt! kit from Pimoroni. I really what I am seeing from Pimoroni. Their starter kits and accessories for the Raspberry Pi are really well designed, colorful, and useful. If you are in the US, some of the Pimoroni kits are on Amazon.

Pimoroni Raspberry Pi Zero W Starter Kit

I do recommend the Pimoroni Raspberry Pi Zero W Starter Kit if you are using the Raspberry Pi Zero W for the first time. The main reason for using a starter kit is that the ports on the Raspberry Pi Zero W need some adapters. You need to get a mini to full-size HDMI adaptor and a Micro-USB adapter to be able to connect a monitor, keyboard, and mouse to the Raspberry Pi Zero W. The kit also includes a 16GB micro-SD card with an operating system pre-loaded.

Connect a monitor, keyboard, and mouse to the Raspberry Pi Zero W and connect the USB cable to a reliable 5V USB power supply and you are ready to start programming.

Raspberry Pi Zero W with Blinkt! LED Strip

I followed Pimoroni’s getting started tutorial to install the Blinkt! python library. The Blinkt! board is a strip of LEDs that sit on top of the Raspberry Pi’s GPIO pins. Blinkt! is a cool way to get started with controlling things with the Raspberry Pi. Consider turning on the LEDs for the first time using code as your “Hello World” program for physical computing.

After connecting your Raspberry Pi Zero W to your Wi-Fi network, open a terminal window and enter the following comment to install the Blinkt!~ libraries (type ‘y’ or ‘n’ when prompted).

curl https://get.pimoroni.com/blinkt | bash

Create a new file in your home directory called “cheerlights.py”. This file will contain the code that gets the latest CheerLights color on ThingSpeak and sets the color of the Blinkt! LEDs. Copy this code into the “cheerlights.py” file and save it.

python cheerlights.py

After a few seconds, you should see the latest CheerLights color on the Blinkt!

To keep the “cheerlights.py” running all of the time, you need to add the script to crontab. This will make the script stays running in case of an error or reboot of the device.

sudo crontab -e

Then, add this line to the end of the crontab file and save the file.

@reboot sleep 60 && sudo python /home/pi/cheerlights.py

A couple of years ago, I noticed that a maker space along with Qwirkshop created a desktop light kit for the Raspberry Pi Zero W and Blinkt! board. The kit was sold for a brief time on Etsy and I picked up a few kits. Well, I just found them in my storage closet! The kit is a bunch of laser cut pieces that you assemble together. It is an ingenious kit in that it was designed in layers and holds together with no glue. The results were beautiful.

Let me know if you build something to display the latest CheerLights color. I am always looking for new ideas for the CheerLights blog.

Let’s stay connected!

Adafruit Matrix Portal LED Display Diffused Acrylic Stand

I bought some parts over at Adafruit to build some ThingSpeak and CheerLights projects. If you know me, I am always attracted to multicolored lights and even more so around the holidays. Adafruit has simplified the way to work with LED matrix panels by offering a new device called the Adafruit Matrix Portal. The Matrix Portal connects to any HUB-75 compatible LED display and gives you Wi-Fi control, USB-C power, an accelerometer, and a processor to help you create animations and graphics. With all of these options, you can build anything from an On-Air sign to a kinetic sand toy.

LED panels are really bright without a diffuser. You can buy a diffuser to enhance the look of the display… if you remember to buy one. I found an 8×10 clear document frame stand at my house and remembered that I have Rust-Oleum Frosted Glass Spray Paint the I used for my arcade cabinet project. I sprayed on three coats of the frosted glass spray while allowing for each coat to dry for about 15 minutes.

Before and after applying the frosted glass spray

As an added bonus, the document frame also doubled as a stand for the Matric Portal display. The frosted glass enhancement turned out really well and greatly enhances the look of the LEDs.

Take a look at what Adafruit’s LED Sand demo looks like behind the diffused acrylic stand.

Adafruit Matrix Portal Sand Demo

Real-time Colors on CheerLights

CheerLights now supports the MQTT protocol. This means that devices and apps can receive real-time updates to changes in the CheerLights color without polling for the latest color.

How to use MQTT

Connect your device to mqtt.cheerlights.com:1883 and subscribe to the “cheerlights” topic. When the CheerLights color changes, the color name will be streamed to your device. You no longer have to poll for the latest CheerLights color on the ThingSpeak API.

Here are the valid color names:

  • red (#FF0000)
  • green (#008000)
  • blue (#0000FF)
  • cyan (#00FFFF)
  • white (#FFFFFF)
  • oldlace / warmwhite (#FDF5E6)
  • purple (#800080)
  • magenta (#FF00FF)
  • yellow (#FFFF00)
  • orange (#FFA500)
  • pink (#FFC0CB)

Check out the CheerLights API documentation for more detail.

Star Wars R2D2 Lamp on Twitch

This news is just in time for an R2D2 Lamp live streaming on Twitch.

Control IFTTT Webhooks with MATLAB

Yesterday, I was building an integration with IFTTT and my Philips Hue lights in my office. I wanted the Philips Hue lights to change to the latest CheerLights color. IFTTT offers a webhook as a trigger, so I decided to use MATLAB to trigger the webhook. MATLAB will get the latest CheerLights color, then send it to IFTTT and IFTTT sends the color to Philips Hue.

When I created the IFTTT webhook, IFTTT presented a CURL example:

curl -X POST -H “Content-Type: application/json” -d ‘{“value1″:”green”}’ https://maker.ifttt.com/trigger/mwOffice/with/key/xxxyyyzzz

Here’s how to turn the CURL request into a MATLAB command:

webwrite(‘https://maker.ifttt.com/trigger/mwOffice/with/key/xxxyyyzzz’,’value1′,’green’);

Check out the IFTTT documentation for more information.

Use the New MQTT Service from ThingSpeak for Real-time CheerLights Updates

It’s that time again. That time when people all across the world synchronize their lights together with CheerLights! People have built amazing CheerLights displays. I have seen everything from color-changing shoes to snowmen… and trees.

 

CheerLights Introduction

Here’s a quick introduction to the CheerLights project for those who are new to the project. Imagine 1000’s of multicolored lights all around the world synchronized to one color. When one of the lights turns red, they all turn red. To control CheerLights, send a tweet to @cheerlights or include “cheerlights” somewhere in your message with the name of a color. This will cause a chain reaction and all of the CheerLights displays and apps will change their color to red.

 

ThingSpeak MQTT Service

CheersLights is powered by ThingSpeak IoT. And, this year, I am happy to introduce real-time CheerLights updates using ThingSpeak’s new MQTT service. Using the MQTT service by ThingSpeak, your CheerLights change instantly. ThingSpeak has posted an example that gets a Particle Photon connected to CheerLights using MQTT. The Subscribe to Channel Updates Using Particle Photon Client example shows you how to use a Particle Photon Wi-Fi board to subscribe to channel updates from the CheerLights channel. The program displays the color read from the channel on the built-in LED on the Photon board. You can subscribe to the channel feed or directly to the color field on the CheerLights channel.

Once you learn how to use the MQTT service from ThingSpeak, you can easily adapt it to your IoT project. This is a great way to have real-time control of a device or real-time monitoring of sensors.

If you want to follow the project and see what others are building, visit CheerLights.com or follow on Twitter.

CheerLights Robot for Your Nursery

I shared my latest project over on my Nursery Hacks website. It combines some of my favorite things… IoT, CheerLights, ThingSpeak, Particle, and building things for my soon-to-be-here son’s nursery.  I didn’t want a bright light in the nursery, but I did want to build a little CheerLights display for something in the background.

I found a Robot Nightlight on Amazon and purchased it. This little robot is a great night-light and you can change the color using the included infrared remote control. To connect this light to CheerLights, I built an IR controller that is internet-connected using the Particle Photon. The Photon subscribes to the latest CheerLights color on ThingSpeak and transmits the IR code as if the button was pressed on the remote control.

To build your own CheerLights Robot, visit Nursery Hacks for the parts and code.

CheerLights with LIFX Wi-Fi Light Bulbs

My mom asked me to setup a CheerLights lamp in their living room to stay connected with me. I was thrilled that she asked me to do this for her.

CheerLights, BTW, is one of my projects that synchronizes color lights to the same color all around the world by sending a Tweet mentioning “cheerlights” and a color name.

“@CheerLights Let’s go Blue!”

For my mom, I wanted the setup to be easy. I have made @cheerlights with Arduino, Philips Hue, and Particle. But, all of these solutions are very DIY and require some programming to get working. I looked around for an alternative solution. I discovered the LIFX A21 Wi-Fi Smart LED Light Light Bulb. What makes this solution ideal for my parents home is that there is no hub needed – just Wi-Fi. The LIFX bulb is currently $99 at Amazon, but I found it in my local Best Buy store for $59! This means that the LIFX so far is the cheapest way to join @CheerLights and have a really nice display in your house.

LIFX Wi-Fi Light Bulb

Installation Steps:

  • Connect your phone to your Wi-Fi network
  • Install the LIFX mobile app on your phone
  • Connect the LIFX led bulb to any light socket and turn it on
  • Open the app and go to “Add Bulb”

LIFX Cloud:

Once your bulb is linked to the app, you will be notified that the bulb requires a software update. Once this happens the bulb will be connectable by the LIFX Cloud API. Sign into https://cloud.lifx.com/ and generate your secret key. Make sure to save this key somewhere so you can use it to setup ThingSpeak.

ThingSpeak Setup:

  • Signup for ThingSpeak
  • Create a ThingHTTP by selecting Apps -> ThingHTTP
  • ThingHTTP Settings:
  • Create a TweetControl for each color that you want to display
  • TweetControl Settings for “blue”:
    • Check “Anonymous TweetControl”
    • Trigger: blue
    • ThingHTTP Action: Select “LIFX Cloud API”

Testing:

Now, that you have everything setup. We get to have fun. Test everything out by sending a Tweet using Twitter.

“@CheerLights Let’s go Blue!”

Not only does your light turn blue, but thousands of other lights on the @CheerLights project will turn blue at the same time.

Visit CheerLights.com for more information about the project!

CheerLights is Back for the Holidays

For the third holiday season in a row, the CheerLights project is gearing up. The idea behind CheerLights is to show that we are all connected by synchronizing the color of lights around the world. Christmas lights are a staple around the holidays and with Internet-connected lights, the color of your lights matches the color of everyone else’s lights.

It has been a real treat watching this project evolve as more and more people add lights… and other things. Things like Android and iPhone apps that check the latest color of CheerLights, an old Commodore 64, and Christmas trees.

To control the lights around the world, send a Tweet mentioning @CheerLights and a color. The command is processed by ThingSpeak platform and distributed to all of the lights listening to the CheerLights API.

@CheerLights I am dreaming of a White Christmas

Another powerful aspect of the CheerLights project is that is shows off what is possible with the emerging Internet of Things. With a single message sent via a social network like Twitter, 1000’s of objects around the world are in sync with each other. Lights are connected by many types of controllers, such as Arduino, ioBridge, Philips, and the Raspberry Pi. This project is only possible through the Internet and the coordination of developers around the world.

Learn how to join the project at CheerLights.com.

We are all connected…