Skip to main content
Version: FILS English

Music Player

A device that plays, stops and skips music.

info

Author: Dragan Delia-Alexa
GitHub Project Link: https://github.com/UPB-PMRust-Students/project-ddeliaffelia

Description

Simple, compact music player built using a Raspberry Pi Pico W, programmed in Rust. It will allow users to play, pause, and skip songs stored on an SD card through a speaker, whose volume can be controlled using a potentiometer. The playing song's title will be shown on an LCD.

Motivation

I tried to find a project idea that fits my interests and that I could enjoy working on. I have been passionate about music since I was little, and I can still recall the day my parents bought me a music player just like my brother's. Besides, I find it quite fun to work on a hardware project like this one.

Architecture

Raspberry Pi Pico 2W:

  • the centre of the project, controls all the other components
  • connections: SPI - SD card module, ADC - potentiometer, PWM - buttons, amplifier, I2C - LCD

LCD:

  • displays the name of the song
  • connections: I2C - microcontroller

Amplifier:

  • increases the quality and strength of the sound
  • connections: through wires - speaker, DAC

Speaker:

  • emmits the music
  • connections: through wires - amplifier

Potentiometer:

  • increases or decreases the volume
  • connections: ADC - microcontroller

SD card module:

  • supplements storage space for the songs that will be played
  • connections: SPI - microcontroller

DAC:

  • transforms digital signal into analog signal
  • connections: SPI - microcontroller, through wires - amplifier, power supply

Power supply:

  • powers the DAC with 5V
  • connections: DC cable - battery, through wires - DAC

Battery:

  • powers the power supply
  • connections: DC cable - power supply

schematic.webp

Log

Week 28 April - 4 May

Purchased components, started my research for the software part, worked on a KiCAD scheme, uploaded the basics on my website

Week 5 - 11 May

Set up my components, focusing on the 2 Picos (connected and tested the target and debug microcontrollers). Started testing code for my components hardware0.webp

Week 12 - 18 May

Purchased more components after finding out about some possible errors (a 9V battery, DC cable, DAC) and set them up (except for the DAC that will arrive on the 19th). Focused on the software after assembling my components hardware1.webp

Week 19 - 25 May

Hardware

In this project, the core piece is a Raspberry Pi Pico 2W that gets its digital audio play-back from an SD card inserted in a module, interfaced via SPI connection, and outputs it through a speaker, powered by a PAM8403D amplifier. The amplifier functions with analog signal, which is why a MCP4821-E/P DAC (Digital-Analog converter) is used, that gets its power from a 5V power supply with a 9V alkaline battery. A 1602 LCD displays via I2C protocol the currently playing song's title. The emitted sound's volume is controlled by a manually adjustable variable resistor (potentiometer). There are also three buttons connected to the microcontroller's GPIO pins meant to play, pause and navigate through the songs.

Schematics

kicad.svg

Bill of Materials

DeviceUsagePrice
Raspberry Pi Pico WThe microcontroller35 RON
Breadboard kitBreadboard, resistors, cables, buttons, power supply71 RON
LCD DisplayDisplays song16 RON
AmplifierBoosts audio4 RON
SpeakerPlays audio4 RON
PotentiometerChanges the volume2 RON
SD Card ModuleReads SD card with songs6 RON
DACConverts digital signal into analog signal16 RON
Battery-DC cableConnects 9V battery to the power supply1.5 RON
BatteryPowers power supply9 RON

Software

LibraryDescriptionUsage
embassy-rpEmbassy HAL for Raspberry Pi RP2040Used for running Rust on Raspberry Pi
embassy-executorasync/await executorUsed for asynchronous programming
defmtHighly efficient logging frameworkUsed for debugging
cortex-mLow-level access to Cortex-M processorsUsed for accesing Cortex-M processor
lcd-lcm1602-i2cDriver for LCD1602Used to control the display
  1. Project Radio fm