Cheerlights with Pimoroni’s Mood Light

Recently I’ve discover a new store fill with Raspberry PI goodies – Pimoroni – that has a lot of kits with the Raspberry PI Zero W .  And the Mood Light kit caught my eye !

I’m astonished to why I can’t buy Raspberry PIs Zero W in Portugal… No store has them… I wonder why…

One of the kits I stumble upon was Mood Light – a kit that resembles a light bulb with a Raspberry PI W and a unicorn pHat. The instructions for the assemble of the kit are straightforward and in no time, we have a Raspberry PI light bulb(ish) ready.

One of the things I love is that Pimoroni, for everything pHat has a Python library to work with.

A few years back I discovered Cheerlights – a collaborative IOT project “that allows people’s lights all across the world to synchronize to one color set by twitter” – It’s really interesting. Just imagine that, at any given time, your light turns RED and everybody’s lights also turn RED somewhere in the world. It’s really awesome.

So, I’ve decided to put the cheerlights project into the Mood Light. Part of the code is borrowed from Pimoroni’s examples for the Blinkt! board with a few changes.

In my case, I’ve decided to smooth the transitions of colors, instead of just change from one color to the other.

Here’s the code

You can check the code at my bitbucket account.

To start the script:

NOTE: We need sudo because the unicorn pHAT requires root to access the device

If you want to put the script starting automatically on Raspberry PI start, just add the following line to the crontab (as root):

 

And here, a small video showing the transitions of colors

 

Leave a Reply

Your email address will not be published. Required fields are marked *