March 2nd, 2025

Raspberry Pi Pico audio player

A stand-alone audio player can be created using a Raspberry Pi Pico, featuring decent audio quality, MicroPython programming, and the ability to play 8k WAV files from an SD card.

Read original articleLink Icon
Raspberry Pi Pico audio player

The article discusses the creation of a stand-alone audio player using the Raspberry Pi Pico, highlighting its decent audio quality suitable for casual listening. The project utilizes MicroPython for programming and requires components such as a Raspberry Pi Pico or Pico W, buttons, resistors, capacitors, an SD card module, an OLED display, and speakers. The audio player is designed to play 8k WAV files stored on an SD card, with a user interface displayed on the OLED screen. The setup includes three buttons for navigating through the music tracks and playing selected songs. The author provides links to previous articles detailing the hardware setup, software requirements, and code necessary for the project. Additionally, the article suggests potential expansions for the audio player, such as adding a reset button, automatic song playback, or integrating other functionalities like a thermometer or clock. The author encourages readers to share their experiences with the project.

- The Raspberry Pi Pico can be used to create a stand-alone audio player with decent sound quality.

- The project requires basic electronic components and programming in MicroPython.

- The audio player is limited to playing 8k WAV files from an SD card.

- The author provides detailed instructions and code for building the player.

- Potential expansions for the project include adding more features like a reset button or additional functionalities.

Link Icon 12 comments
By @beala - about 2 months
I wanted to create an mp3 player (not just wav) using a pico and found this repository very instructive: https://github.com/ikjordan/picosounds

To handle decoding and the overhead of moving bits around, it uses a dual-buffer DMA approach. It reads data from an SD card, running the decoding routine on the main CPU. The decoded samples are written into one of two buffers. While one buffer is being written to, the other is read via DMA and sent to the PWM buffer (more on PWM audio here: https://x.com/beala/status/1826147833168408738). Because DMA is used, data transfer can occur in parallel with decoding, without involving the main processor. When the bits have all been written to the PWM buffer, an interrupt triggers a buffer swap, and the process repeats.

I'm leaving out many details. Tuning the pwm speed to achieve correct playback speed was quite an adventure. And when I needed to increase the clock speed to play higher sample rates, this caused I/O errors with the SD card that I never managed to solve. Although I learned a lot from this process, I ultimately opted to use an MP3 module in my final build: https://store-usa.arduino.cc/products/dfplayer-a-mini-mp3-pl...

This is probably routine for an experienced embedded engineer, but it was quite a learning experience for me!

By @bschwindHN - about 2 months
The RP2040 can output 24 bit (or technically 32-bit), 48kHz stereo audio over I2S. Combine that with a DAC like the PCM1502 (which has plenty of dev boards) and you've got yourself a high quality audio setup.

I have a Rust crate for outputting I2S data, or retrieving it from something like a mic or ADC. You can hook it up to DMA and make your audio go brrrr

https://github.com/bschwind/rp2040-i2s

By @34679 - about 2 months
I feel like the flaws of the Pico 2/RP2350 should be advertised better. The Pico is great. I waisted half of an extremely frustrating day with a Pico 2 before suspecting the board itself was the problem, and confirming it with very specific searches that brought up threads about the issue. The internal pull-downs don't work.

Maybe it's my fault for not making it to page 1357 (!) of the datasheet, where the issue is described as "RP2350-E9".

https://datasheets.raspberrypi.com/rp2350/rp2350-datasheet.p...

By @nerdralph - about 2 months
I think schematics are easier to read than looking at a (fritzing?) breadboard layout. Discrete resistors aren't necessary for the buttons if you enable the internal pullups on the RP2040.
By @atoav - about 2 months
If you want to do a similar audio player I can recommend the DY-SV5W module family, this is essentially a micro-SD playback chip with a headphone amp and a 5W (mono) amplifier, the whole thing can be powered from 5V/USB. Really great for art projects where you just need a single track to play/loop on the press of a button and can't be bothered to program.

It has thre DIP switches that set the mode, you can use them to set the playback modes, one of which is serial control, meaning you can easily beef this up using a microcontroller.

By @hoc - about 2 months
Due to the missing DAC on the Pico this always runs into that fully discrete vs. resistor ladder/network vs. external dac (i2s or other) decision.

Great that the author chose one and finished (and published) the project instead of stopping at that annoying junction :)

By @josteink - about 2 months
Am I understanding that this project is limited to play 8kHz samples wave-files, ie only up to 4kHz real world? Is that even tape-quality?

Not to talk down anyone’s hobby project, but that kinda limits the appeal for most other people I would think?

By @sandreas - about 2 months
I did a lot of research for building my own little iPod Nano sized player, which should also have the ability to be controlled by a wired headphone remote.

So here are my results up until now:

- The best device I found is a LicheeRV Nano[1] - also used in NanoKVM.

- It has enough CPU+RAM to support more complex formats like FLAC while still being very small.

- It has a full featured MIPI 31-pin / 6-pin touch display port, although I could not find any available display smaller than 7" to order without hassle (there is an unavailable official 3" though[4]).

- It also has USB-C, where it should be possible to use one of these external USB-C to audiojack adapters with mic support.

- Some of these adapters should support headset control buttons out of the box (via kernel usbsound) - on my notebook this works flawlessly.

- There also is a full featured configurable buildroot[2], so, less work to get started with an optimized build.

- Combining a TP4057 battery charger and a battery gauge (MAX17043) you should be able to support a 1200mah battery, read out battery status via I2C and recharge within a < 3" 3D printed case.

- All you would have to do is create a custom buildroot and a nice user interface via LVGL, they already have a music player sample on there samples listing[3]. Unfortunately this is where the workload is huge ;)

1: https://wiki.sipeed.com/hardware/en/lichee/RV_Nano/1_intro.h...

2: https://github.com/sipeed/LicheeRV-Nano-Build

3: https://github.com/lvgl/lv_demos/tree/master/src/lv_demo_mus...

4: https://aliexpress.com/item/1005006519668532.html

By @dangelov - about 2 months
I setup a project somewhat along these lines with a Raspberry Pi, a USB DAC, and spotifyd. Now I have a decent and convenient audio player hooked up to my sound system. May not pass all the bars for an audiophile but the sound quality is actually fairly decent - much better than my previous Alexa setup - which is all I needed.
By @slig - about 2 months
Last week YouTube recommended a video about a Logic Analyzer using the Pi Pico. Had no idea it was that powerful.
By @tyre - about 2 months
Plug for Shareplay, which turns a raspberry pi into an airplay server so you can connect non-Airplay speakers:

https://github.com/mikebrady/shairport-sync