How To

Build Your Mp3 Player Using Raspberry Pi

Are you a music lover? Do you own a Raspberry Pi kit already and want to make your own homemade music player using your beloved Pi board? If yes, then read the article here.

Today, I will provide a quick explanation on how to build an MP3 Player using Raspberry Pi. At the end of this project, you will have a custom device created by you which plays MP3 songs.

Things you will need:

  1. Raspberry Pi board (I recommend to use Pi B Rev 2)
  2. Power supply for the Pi
  3. Raspberry Pi compatible SD card
  4. A USB drive
  5. USB keyboard and mouse
  6. Connecting Wires
  7. Knowledge of programming with C

Mp3 Player for Raspberry Pi

Days are gone when people use traditional music players to listen to songs. Now, with the help of cheap and useful technology inventions, the way to listen to music is changed more interestingly. Let’s dig into the process and let’s hope for the good.

There are main four steps to finish this project.

Step-1: Check the USB drive

Check the functioning of the USB flash drive (SD card) you are using. It should be compatible with your Raspberry Pi. Also, make sure that you have correctly installed the Raspbian OS on the SD card. You can take help of NOOBS to do that.

Step-2: Scan the drive uploaded with MP3

Upload the MP3 music files on the flash drive and scan them for viruses. You can take help of some third party software like Avast to run a custom scan.     

Step-3: Setup and code

Combine all components together and make proper attachments with your Raspberry Pi. Get some use of your coding skills in C and write some program lines to operate the Raspberry Pi MP3 player.

But before you do any coding, be sure to write the below lines in your Raspberry Pi terminal:

sudo apt-get install mpg321

install mpg321 in rpi

sudo apt-get install libusb-1.0-0-dev

install libusb-1.0-0-dev in rpi

Also, you should install the GPIO access library, i.e., WiringPi which is written in C programming.

Step-4: Play MP3 songs

After setting up the things and commands on your Raspberry Pi, it’s time to control the files and play the songs as per your preferences.

You can use GCC compiler to compile the code in the Raspberry Pi:

gcc -Wall mp3.c vector.c usbcheck.c getpath.c -lpthread -lusb-1.0 -lwiringPi -o mp3

Now, when you boot your Pi, enter the command in the terminal:

sudo nano /etc/rc.local

In the file, add the line below:

sudo/home/rpi/mp3songs/mp3 &

Check the video of the full project here.


The initial version of the Raspberry Pi was meant for the educational purpose in the institutes to help the kids learn to code in an easy and fun way. And so it was not too much popular at the time of launch. But soon as the tinkerers and hobbyists got familiar with its tremendous capabilities, it was started being used in designing many useful and innovative creations. Gradually, the Raspberry Pi Foundation introduced newer versions of Pi with more advanced functionalities and usage. This project of making a Raspberry Pi MP3 player is one of the most relaxed and exciting Pi projects that even a beginner can do without many efforts.

I did not explain in full-fledged for the project, and I want you to complete wherever required. Hit the comment section below and show your coding skills.

Welcome to the Pi community!

Jessica Ward

Hey! I am Jessica Ward. I love to write about technology and learn or thinking about latest techno. And my forever ever love technology project is Raspberry Pi. I do and know more or more for Raspberry Pi.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button