Skip to content
  • Live
  • Blog
  • Shop
  • Contact
  • About
  • Twitter
  • Instagram
  • YouTube
  • Twitch
  • GitHub
CheerLights

CheerLights

We are all connected.

  • Learn
  • Build
  • Connect
  • Toggle search form

CheerLights + Raspberry Pi Pico W + MicroPython

Posted on November 10, 2022 By Hans Scharler No Comments on CheerLights + Raspberry Pi Pico W + MicroPython

What if I told you that there was a Raspberry Pi board that you could actually buy right now with Wi-Fi? It’s true. The Raspberry Pi Pico W is here to fill the void and give you some great options as a maker to make anything you want. How about you want to make a CheerLights display?

CheerLights on a Pimoroni Galactive Unicorn Display

MicroPython

To make the Raspberry Pi Pico W do something, you need to give it some instructions. One way to do it is to use MicroPython. MicroPython is an efficient subset of the Python 3 programming language tailored for microcontrollers like the Raspberry Pi Pico W.

Install Thonny

Default View of Thonny 4.0.1

Now, we need to do some configuration. Click on View and enable Files.

Files are now being displayed in Thonny

Additionally, we need to tell Thonny that we will be controlling the Raspberry Pi Pico W. Click Tools and then Options. Select the Interpreter tab and select MicroPython (Rasberry Pi Pico).

Thonny Options

Now, plug in the Raspberry Pi Pico W to your computer while holding the BOOTSEL button.

Raspberry Pi Pico W (not to scale)

Find your Raspberry Pi Pico W in your folder explorer and copy over the appropriate UF2 file. The appropriate file is determined if the Pico is standalone or hooked up to something like the Galactic Unicorn from Pimoroni. The Pico will reboot.

UF2 files from Pimoroni

If everything goes well, Thonny should show you that it is connected to the Raspberry Pi Pico W.

Raspberry Pi Pico W successfully connected Thonny

Wi-Fi

We have MicoPython running on the device. We have Thonny running on our PC. We are ready for the fun stuff. All of the fun stuff is on the internet so we need to connect our Raspberry Pi Pico W to Wi-Fi. The Pico requires a 2.4Ghz connection.

Add a new file to the Pico called, “WIFI_CONFIG.py”.

Enter this code in the new file and click save. This will create a new file on your Pico that contains your Wi-Fi credentials and shared among your projects that need to connect to the internet.

SSID = "change"
PSK = "change"
COUNTRY = "US"
Raspberry Pi Pico W Wi-Fi Configuration

In the same way that you created the Wi-Fi config file, create a new file called, “network_manager.py” with this code, and click Save.

“network_manager.py” file on the Raspberry Pi Pico W

Okay… we have done a lot of configuration at this point, so let’s test the Wi-Fi connection. I created a quick “network_test.py” script to set up a Wi-Fi connection based on your Wi-Fi settings. Once connected, the script tries to read data from the ThingSpeak CheerLights channel. If the test is successful, you should see a local IP address and the latest CheerLights HEX color code.

“network_test.py” results

CheerLights

So, the idea behind CheerLights is to keep a global network of multicolored lights in sync with each other. Anyone at any time can set the color and all of the connected lights on CheerLights set their color to match. To set the color of the CheerLights network, you can tweet to @CheerLights to mention a color name or use our Discord server CheerLights bot.

Set all of the Raspberry Pi Pico W connected #CheerLights to blue.

— CheerLights (@cheerlights) November 9, 2022

To build a CheerLights display, you need a device to get the latest color from CheerLights or from an IoT platform like ThingSpeak or ADafruit IO, parse the data, and set itself to that color. If your network settings are working, you are in good shape to get your display working.

I recommend using a Raspberry Pi Pico W board connected to the Galactic Unicorn from Pimoroni. It is a wonderful display of 500+ LEDs, a speaker, and a Raspberry Pi Pico W bolted right on the back.

Galactic Unicorn from Pimoroni

The brains of the Galactic Unicorn from Pimoroni is the Raspberry Pi Pico W board. The Pico is what connects to the Wi-Fi and controls the pixels on the display. I spent some time making a straightforward script to get the color and light up the display. I munged code from Hel Gibbons. Thanks for the inspiration. I am still working on new examples and stability. Follow my code updates on GitHub and check in on our Discord server.

The Galactic Unicorn displaying the latest CheerLights color

Resources

  • CheerLights API documentation
  • Pimoroni Pico files
  • CheerLights Raspberry Pi Pico W files

Share this:

  • Twitter
  • Facebook
  • Tumblr
  • Reddit
  • More
  • Pinterest
  • LinkedIn
  • Email
  • Print

Related

Projects Tags:Galactic Unicorn, iot, Pimoroni, raspberry pi, Raspberry Pi Pico W

Post navigation

Previous Post: Learn Redis Streams with the CheerLights IoT Project
Next Post: YouTube Live with Kevin McAleer: Making a CheerLights-connected Christmas Tree Bauble

Related Posts

CheerLights Nominated for Best DIY Internet of Things Project #IoT Uncategorized
Internet of Things Awards 2013 News
Wireless CheerLights Tree with Raspberry Pi Projects

Leave a Reply Cancel reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  • Keep Multiple CheerLights in Sync with MQTT
  • CheerClock: A CheerLights Clock Powered by the Pimoroni Galactic Unicorn and Raspberry Pi Pico W
  • YouTube Live with Kevin McAleer: Making a CheerLights-connected Christmas Tree Bauble
  • CheerLights + Raspberry Pi Pico W + MicroPython
  • Learn Redis Streams with the CheerLights IoT Project

Copyright © 2023 CheerLights.

Powered by PressBook Grid Blogs theme

 

Loading Comments...