Skip to main content
Version: ACS CC

Audio Player with Raspberry Pi Pico 2W

Audio player for headphones or devices with 3.5 jack.

info

Author: Rusu Carla-Maria
GitHub Project Link: link_to_github

Description

This project implements a compact WAV audio player using the Raspberry Pi Pico 2W microcontroller. The audio files are stored on a microSD card, read via SPI, and played through an I2S DAC (UDA1334A) connected to a 3.5mm headphone jack. The user can use the push buttons and the rotary encoder to customize the experience.


Motivation

The motivation for choosing this project was to explore embedded audio playback using Rust and Embassy on the Raspberry Pi Pico 2W. The goal was to build a music player while learning low-level embedded I/O, SPI, I2S, and async execution using Rust.


Architecture

Components Overview

ComponentResponsibility
Audio HandlerReads WAV files and streams audio via I2S to the DAC
SPI HandlerInterfaces with the SD card to access audio files and with the LCD to display information
UIDisplays UI (e.g., file list, song name, progress)
Input HandlerProcesses rotary encoder and buttons
Playback ControllerControls playback state (play/pause, skip, etc.)

Interconnection

  • Input Handler dictates the state of the Playback Controller
  • Playback Controller coordinates with Audio Manager and SPI Handler to stream audio.
  • Audio Handler uses SPI Handler to get WAV file data.
  • Playback Controller notifies UI to update the screen.

Diagram


Log

Week 5 - 11 May

Week 12 - 18 May

Week 19 - 25 May


Hardware Design

Hardware Description

The following hardware was used:

  • Raspberry Pi Pico 2W
  • UDA1334A I2S DAC with 3.5mm jack socket
  • LCD with built-in SD slot (will see if this is the best option)
  • Rotary Encoder
  • 3 push buttons
  • Breadboards and jumper wires

Schematic

Tried to do something in Kicad (not for dark mode)

alt text

Bill of Materials

ItemQuantityUnit Price (RON)Total (RON)Usage
Raspberry Pi Pico 2W139.6639.66Main controller
Raspberry Pi Pico (debug / Picoprobe)139.6639.66Used for SWD debugging
UDA1334A I2S DAC Module156.7656.76Audio output module
LCD SPI Display 1.8" (128x160) with SD slot128.9928.99Used for UI and SD (via SPI)
Push Button (white round cap)31.995.97Controls
Rotary Encoder Module14.994.99Controls
10k Stereo Potentiometer11.991.99Analog Control (ADC input)
Breadboard HQ (830 points)29.9819.96For main Pico + Picoprobe wiring
Header pins (2.54 mm, 40p)20.991.98For soldering Pico and accessories
Female Breakable Header (40p)12.562.56Extra connectivity (LCD/SD)
Breadboard rigid wires112.4912.49Neat wiring on breadboard
Breadboard jumper wires17.997.99General-purpose jumpers

Total Estimated Cost: 229.60 RON (for now)


Software

To-do : complete later when I've finished

Dependencies Overview

LibraryDescriptionUsage
embassyAsync embedded frameworkCore runtime for async tasks and peripherals
embassy-rpHAL for Raspberry Pi Pico (RP2040)Controls GPIOs, SPI, I2S, etc.
embedded-graphics2D graphics libraryUsed for drawing text and shapes on LCD
mipidsiGeneric MIPI DSI display driverDriver for ST7735 LCD
display-interface-spiSPI display abstractionConnects the embedded-graphics to SPI-based displays
embedded-sdmmcFAT filesystem over SD cardUsed to read .wav files from SD card
embedded-halTraits for embedded devicesBase for SPI, I2S, ADC, GPIO, etc.
defmtLogging crate for embeddedFor debugging and structured logs
micromathLightweight math functionsUsed for simulations of sound waves

  • PIO Programs : Helped me with drivers for I2S and Rotary Encoder