Skip to content

Latest commit

 

History

History
137 lines (96 loc) · 4.63 KB

README.md

File metadata and controls

137 lines (96 loc) · 4.63 KB

Raspberry Pi Pico W LED Controller with Web interface

Build CodeQL Doxygen Pages

Logo

This project is a simple example of how to manage a WS2812B LED strip with a Raspberry Pi Pico W and a Web interface.

Table of contents

Features

  • WS2812B LED strip controller
  • IRQ based light state buttons handling
  • Wi-Fi connection
  • Web interface light state control
  • NTP time synchronization

Modes

  • Rainbow Wheel
  • Rainbow Cycle
  • Static Color
  • Breathing
  • Flashing
  • Wave
  • Fade

Colors

  • Red
  • Green
  • Blue
  • Cyan
  • Yellow
  • Pink
  • Magenta
  • Purple
  • Orange
  • Turquoise
  • White

Hardware

  • 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:

Schema

Software

The code is written in C and follows src, include structure. The project is based on the Raspberry Pi Pico SDK and FreeRTOS.

Build

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

Web interface

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.

Web interface

Build

Note

Building the frontend separately with Python is an older practice. This could be avoided using CMAKE.

To build the web interface, simply run:

python3 makefsdata.py

Install

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.

Usage

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.

License

This project is licensed under the MIT License - see the LICENSE file for details.

References