Skip to main content
Version: ACS CC

Music Lights

A Raspberry Pi Pico system that synchronizes LED lighting with music

info

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

Arhitecture diagram

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 (like ws2812-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: Set up the Raspberry Pi Pico and assembled the main hardware components.
  • Week 12 - 18 May: Completed the full hardware assembly and tested each component with example code.
  • 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 Schematic

Project Photos

LED Strip in Action Project Overview1 Project Overview2 Project Overview3 Project Overview4

Bill of Materials

ItemQuantityUnit PriceTotal Price
Jumper Wires for Breadboard17.99 RON7.99 RON
Raspberry Pi Pico W239.66 RON79.32 RON
Breadboard HQ (830 tie points)19.98 RON9.98 RON
White Pin Header 2.54 mm (40p)30.99 RON2.97 RON
Colored Jumper Wires Female-Male (40p, 15 cm)17.99 RON7.99 RON
Electrolytic Capacitor 1000 µF, 35 V12.99 RON2.99 RON
Electrolytic Capacitor 470 µF, 50 V10.79 RON0.79 RON
USB Cable1--
Addressable LED Strip WS2812, 10 cm (60led/m)32.69 RON8.07 RON
Button 12x12x7.3 mm21.10 RON2.20 RON
Button Cap 12x12x7.3 mm, Blue10.34 RON0.34 RON
Button Cap 12x12x7.3 mm, Red10.34 RON0.34 RON
MAX4466 Microphone Module with Amplifier17.18 RON7.18 RON
4-Channel Logic Level Converter Module14.00 RON4.00 RON
330 Ω Resistor20.12 RON0.24 RON
10k Ω Resistor10.13 RON0.13 RON
Sursă alimentare 5V123.38 RON23.38 RON
Conector DC mamă12.07 RON2.07 RON
Conector JST PH2.0 2P22.00 RON4.00 RON
Jumper Wires Male-Male (40p, 30 cm)18.00 RON8.00 RON
Conector pentru LED12.99 RON2.99 RON

Estimated Total: ~ 173.27 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.

LibraryDescriptionUsage
embassy-executorCore asynchronous task executor.Runs all concurrent operations.
embassy-timeAsync time primitives (Delay, Timer, Instant).Essential for timing and scheduling.
embassy-syncAsync synchronization tools (Mutex, Channel, Signal).Enables safe data sharing between async tasks.
embassy-rpHAL for RP2040 peripherals (ADC, GPIO, DMA, SPI, etc.).Async access to hardware on the RP2040.
embedded-halStandard HAL traits.Used by embedded drivers like ws2812-spi. ([Docs.rs][1])
embedded-hal-asyncAsync HAL traits.For async control of peripherals like SPI, I2C, etc.
ws2812-spiSPI-based driver for WS2812 & SK6812, implements SmartLedsWrite.Sends LED data over SPI to WS2812 strips. ([Crates][2], [Docs.rs][1])
smart-ledsUtilities and types (RGB8, effects, gamma, brightness).Defines LED colors and visual effects. ([Docs.rs][3], [Crates][4])
smart-leds-traitTraits for smart LED drivers (SmartLedsWrite).Enables calling write() on Ws2812<SPI>. ([Crates][5])
microfftno_std FFT implementation (Radix-2 in-place).Real-time audio frequency analysis for LED effects. ([Crates][6])
libmPure Rust implementations of C math functions (sqrt, powf, etc.).Required for FFT math operations and signal processing. ([Docs.rs][7])
cortex-mAccess to ARM Cortex-M core peripherals.Used for low-level embedded operations.
cortex-m-rtMinimal runtime for Cortex-M.Defines program entry and exception vectors.
panic-probe / panic-haltPanic handlers for embedded targets.Choose one; panic-probe works well with defmt.
defmtEfficient logging for embedded (RTT).Enables lightweight debugging output.
defmt-rttRTT backend for defmt.Enables real-time logging via debug probe.
embedded-ioStandard I/O traits.Enables cross-crate I/O compatibility.
embedded-io-asyncAsync I/O traits.Used for async communication drivers.
heaplessno_std data structures (Vec, String, etc.).Useful for fixed-size buffers without dynamic allocation.