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!