Music Lights
A Raspberry Pi Pico system that synchronizes LED lighting with music
Author: Antonio-Christian Carazeanu
GitHub Project Link: link_to_github
Description
Music Lights is a project that uses a Raspberry Pi Pico to control an LED strip based on live music input. A microphone captures ambient audio, and a signal processing algorithm detects the beat and dominant frequencies. The LEDs react in real-time by changing color and brightness, creating an immersive audio-visual experience.
Motivation
The idea behind this project came from a desire to blend music with dynamic visual effects. I wanted to explore how embedded systems can process audio and produce synchronized lighting, making music more interactive and engaging.
Architecture
The project is composed of the following main components:
- Microcontroller: Raspberry Pi Pico running real-time firmware using Embassy.
- Audio Input: MAX4466 Microphone module connected to the Pico's ADC, capturing audio signals.
- Signal Processing: Algorithm performing FFT using the
microfft
library to analyze frequencies. - LED Control: LED strip controlled via the RP2040's PIO unit using
embassy-rp
and a compatible WS2812 PIO program (likews2812-pio
or similar). Requires a Logic Level Shifter (3.3V to 5V) for the data signal. - Output: WS2812 LED strip visualizing music dynamically.
Connections:
- Microphone Analog Out → Pico ADC GPIO (e.g., GPIO26)
- Pico GPIO (PIO Output) → Level Shifter (Low Voltage Input)
- Level Shifter (High Voltage Output) → LED Strip Data In (via ~330Ω resistor)
- Buttons → Pico GPIO Inputs (with 10kΩ pull-up/pull-down resistors)
- Pico USB → Power (for Pico) and programming
- Separate 5V Power Supply → LED Strip (+5V, GND)
- Separate 5V Power Supply → Level Shifter (HV Pin)
- Common Ground: Crucial connection between Pico GND, Level Shifter GND, and the Separate 5V Power Supply GND.
Log
- Week 5 - 11 May: Research and initial setup of Raspberry Pi Pico and LED strip. Completed the project description.
- Week 12 - 18 May:
- Week 19 - 25 May:
Hardware
- Raspberry Pi Pico W (x2 - one for development/debug)
- WS2812 LED Strip (3x 10cm segments = 18 LEDs)
- MAX4466 Microphone Module
- Logic Level Shifter Module
- Jumper wires (M-M, M-F) and Breadboard
- USB cables (for Pico power/programming)
Schematics
(KiCAD schematics to be added here)
Bill of Materials
Item | Quantity | Unit Price | Total Price | Notes |
---|---|---|---|---|
Jumper Wires for Breadboard | 1 | 7.99 RON | 7.99 RON | |
Raspberry Pi Pico W | 2 | 39.66 RON | 79.32 RON | |
Breadboard HQ (830 tie points) | 1 | 9.98 RON | 9.98 RON | |
White Pin Header 2.54 mm (40p) | 2 | 0.99 RON | 1.98 RON | |
Colored Jumper Wires Female-Male (40p, 15 cm) | 1 | 7.99 RON | 7.99 RON | |
Electrolytic Capacitor 1000 µF, 35 V | 1 | 2.99 RON | 2.99 RON | |
Electrolytic Capacitor 470 µF, 50 V | 1 | 0.79 RON | 0.79 RON | |
USB Cables (for LEDs and Pico) | 2 | - | - | Powered from laptop |
Addressable LED Strip WS2812, 10 cm (60led/m) | 3 | 2.69 RON | 8.07 RON | |
Button 12x12x7.3 mm | 2 | 1.10 RON | 2.20 RON | For switching LED modes |
Button Cap 12x12x7.3 mm, Blue | 1 | 0.34 RON | 0.34 RON | |
Button Cap 12x12x7.3 mm, Red | 1 | 0.34 RON | 0.34 RON | |
MAX4466 Microphone Module with Amplifier | 1 | 7.18 RON | 7.18 RON | |
4-Channel Logic Level Converter Module | 1 | 4.00 RON | 4.00 RON | |
330 Ω Resistor | 2 | 0.12 RON | 0.24 RON | For buttons |
10k Ω Resistor | 1 | 0.13 RON | 0.13 RON | For data line |
Estimated Total: ~ 133.84 RON (excluding USB cables)
Software
This list details the recommended Rust crates for the "Music Lights" project using the Embassy async runtime on the Raspberry Pi Pico.
Category | Library | crates.io Link | Description & Usage in Project |
---|---|---|---|
Runtime Async | embassy-executor | link | Core asynchronous task executor. Runs all concurrent operations. |
embassy-time | link | Async time primitives (Delay, Timer, Instant). Essential for timing. | |
embassy-sync | link | Async synchronization (Mutex, Channel, Signal). For safe data sharing between tasks. | |
HAL (Embassy) | embassy-rp | link | Async HAL for RP2040 peripherals (ADC, PIO, GPIO, DMA, etc.). |
LED Control | ws2812-pio | link | (Recommended) PIO program & driver for WS2812 LEDs. |
pio | link | Base crate for defining PIO programs (dependency for ws2812-pio ). | |
Audio Proc. | microfft | link | no_std Fast Fourier Transform implementation for frequency analysis. |
libm | link | no_std math functions (sqrt, powf, etc.) for FFT post-processing. | |
Core Embedded | cortex-m | link | Low-level access to ARM Cortex-M core APIs. |
cortex-m-rt | link | Minimal runtime for Cortex-M (entry point, exceptions). | |
panic-probe or panic-halt | link link | Panic handler implementation. panic-probe works well with defmt . | |
Logging | defmt | link | (Recommended) Efficient embedded logging framework. |
defmt-rtt | link | (Recommended) RTT transport for defmt (requires debug probe). | |
HAL Utilities | embedded-hal embedded-hal-async | link link | Standard HAL traits used for interoperability (often dependencies). |
embedded-io embedded-io-async | link link | Standard IO traits (often dependencies). |
Notes:
ws2812-pio
or a similar PIO-based implementation is recommended for controlling WS2812 LEDs withembassy-rp
on the RP2040, leveraging its Programmable I/O capabilities. An alternative likews2812-spi
might require adaptation for async use.- Using
defmt
also typically involves addingdefmt-rtt
for transport and a suitable panic handler likepanic-probe
. Basic runtime crates likecortex-m
andcortex-m-rt
are also fundamental dependencies.