MP3 Player
An MP3 player with button controls and a display that shows the current track, play/pause status, and volume.
Author: Nistor Ioan-Mario
GitHub Project Link: https://github.com/UPB-PMRust-Students/proiect-marionistor
Description
This MP3 player, built around the Raspberry Pi Pico 2 microcontroller, enables playback of MP3 files stored on a microSD card. It features five tactile buttons for intuitive control, supporting play, pause, song navigation (next/previous), and volume adjustment. A 1.3" I2C OLED display delivers real-time updates, showing the current track title and playback status. The system employs a DFPlayer Mini module for MP3 playback, interfaced with the Pico via UART, complemented by a PAM8403 amplifier for improved audio output. Power is supplied by a 5V power bank, ensuring dependable and portable performance.
Motivation
This project draws inspiration from the nostalgia of early portable MP3 players, known for their compact screens and tactile buttons, aiming to revive their charm with modern technology. Using the Raspberry Pi Pico 2, DFPlayer Mini, and OLED display, the goal is to create a functional player that captures the simplicity and joy of those classic devices.
Architecture
Connections
- Microcontroller ↔ DFPlayer Mini: UART (GPIO0 TX → DFPlayer RX, GPIO1 RX → DFPlayer TX) for playback commands.
- Microcontroller ↔ Display: I2C (GPIO4 SDA, GPIO5 SCL) for displaying track info, with OLED VCC connected to 5V and GND to ground.
- Microcontroller ↔ Buttons: GPIO6–10 as inputs for the buttons.
- DFPlayer Mini ↔ PAM8403: DFPlayer audio output (L/R) to PAM8403D input for amplification.
- PAM8403 ↔ Speaker: PAM8403D output connected to the 4Ω/3W speaker.
- Power: 5V power bank connected to VBUS (Pin 40) of the Raspberry Pi Pico 2, supplying 5V directly to the OLED VCC, DFPlayer Mini VCC, and PAM8403D VDD.
Log
Week 5 - 11 May
Week 12 - 18 May
Week 19 - 25 May
Hardware
- Microcontroller: Raspberry Pi Pico 2 manages logic, UART communication with DFPlayer, and I2C with OLED.
- Audio Module: DFPlayer Mini plays MP3s from a microSD card.
- Display: 1.3" I2C OLED (SSD1306) shows track info and playback status, powered at 5V as per specifications (3.3V-5V range).
- Input: Five tactile buttons (SW1–SW5) for play/pause, next, previous, and volume control.
- Audio Amplifier: PAM8403D boosts the sound output to drive the speaker.
- Speaker: 4Ω/3W speaker connected to the PAM8403D for audio playback.
Schematics
Bill of Materials
Device | Usage | Price |
---|---|---|
Raspberry Pi Pico 2 | Main microcontroller running the firmware | 28 RON |
Raspberry Pi Pico 2W | Debugging | 40 RON |
DFPlayer Mini | MP3 decoder and audio playback module | 14 RON |
SanDisk 32GB MicroSD Card | Stores the MP3 files for playback | Already owned |
PAM8403 | Amplifies audio signal for the speaker | 3 RON |
4Ω/3W Speaker | Outputs the audio playback | 11 RON |
OLED 1.3" Display | Displays song info and player status | 30 RON |
HAMA PD10 201719 | Provides power to the breadboard setup | Already owned |
Buttons | User input for controlling playback and volume | 5 x 0.36 RON |
Resistors | Resistors used for buttons | 10 x 0.10 RON |
Breadboard | For prototyping the entire circuit | 2 x 10 RON |
Wires | Connect all components on breadboard | 19 RON |
Total | - | 168 RON |
Software
Library | Description | Usage |
---|---|---|
embassy-rp | Embassy framework for RP2350 | Used to control peripherals like UART, I2C, GPIO, and timers on the Pico 2 |
ssd1306 | Driver for SSD1306 OLED displays via I2C | Used to control the 1.3" I2C OLED display |
embassy-time | Async timers and delays | Used for implementing delays and scheduling tasks |
dfplayer-async | Async Rust driver for DFPlayer Mini MP3 module | Provides MP3 playback control over UART using async calls |
embassy-executor | Async task executor for embedded systems | Manages and schedules async tasks on the microcontroller |
embedded-graphics | 2D graphics library for embedded systems | Used to draw text, icons, and other UI elements on the OLED display |
embedded-hal | Hardware Abstraction Layer for embedded devices | Interface layer used by all driver crates for GPIO, I2C, UART, etc. |
defmt | Lightweight logging framework for embedded Rust | Used for debug logging during development |
panic-probe | Minimal panic handler for embedded Rust | Provides panic messages via logging for embedded debug purposes |