This project is a simple example of how to manage a WS2812B LED strip with a Raspberry Pi Pico W and a Web interface.
Note
Some of the light modes are not already implemented. The project is still in development.
- WS2812B LED strip controller
- IRQ based light state buttons handling
- Wi-Fi connection
- Web interface light state control
- NTP time synchronization
Documentation is available here.
- Raspberry Pi Pico W
- WS2812B LED strip
- 5V power supply/supplies
For 120 LEDs to power, you will need a 5V power supply with at least 6A current. The power supply should be connected to the LED strip and the Raspberry Pi Pico W. For this project, two 5V 3A power supplies were used. General schema is shown below:
The code is written in C and follows src, include
structure. The project is based on the Raspberry Pi Pico SDK and FreeRTOS.
For this project to build, you will need the following packages:
sudo apt-get update
sudo apt-get install -y cmake gcc-arm-none-eabi libnewlib-arm-none-eabi build-essential
You will probably need those environmental variables exported:
export PICO_SDK_FETCH_FROM_GIT="ON"
export PICO_EXTRAS_FETCH_FROM_GIT="ON"
export PICO_SDK_FETCH_FROM_GIT_PATH="./pico-sdk"
export PICO_EXTRAS_FETCH_FROM_GIT_PATH="./pico-extras"
There is gitignored Wi-Fi credentials file to create in following directory led_controller/include/wifi_credentials.h
:
#ifndef _WIFI_CREDENTIALS_H
#define _WIFI_CREDENTIALS_H
#define WIFI_SSID "wifi_ssid"
#define WIFI_PASSWORD "wifi_password"
#endif
The web interface is a simple page that allows you to control the LED strip. It is served by the Raspberry Pi Pico W itself. Data fetch intervals are set to 5 seconds to avoid overloading the Pico W. Start timestamp is created by the server although counting elapsed is fully client-sided.
To build the web interface, simply run:
python3 makefsdata.py
If you will be using the web interface locally, you don't need https to install the app. In Chrome, resolve chrome://flags/#unsafely-treat-insecure-origin-as-secure
and your's Pico W IP address. Restart the browser and manifest.json will allow for the install. Then, Chrome flag can be set back to default.
After building the project, you can flash the Raspberry Pi Pico W with the generated led_controller.uf2
file. The LED strip should light up with the default mode Rainbow Wheel
. You can change the color by choosing one of the buttons on the web interface. When connecting to the Wi-Fi for the first time, check the serial output for the IP address.
This project is licensed under the MIT License - see the LICENSE file for details.