MP3 Player Shield Hookup

This Tutorial is Retired!

This tutorial covers concepts or technologies that are no longer current. It's still here for you to read and enjoy, but may not be as useful as our newest tutorials.

View the updated tutorial: MP3 Player Shield Hookup Guide V15

Pages
Contributors: jimblom
Favorited Favorite 4

Using the SFEMP3Shield Library

The SFEMP3Shield Arduino library -- written collaboratively by Bill Porter, Michael Flaga, ddz, and Wade Brainerd -- is an AMAZING resource for the MP3 Player Shield. Combined with the equally awesome SdFat library, SFEMP3Shield greatly simplifies the task of interfacing with the VS1053 and using the MP3 Player Shield.

We recommend using the SFEMP3Shield library with this shield. On this page we'll go over how to install and use the library. On the next page, we'll make a fun example sketch using it.

Install the SFEMP3Shield Library

To download the latest version of the SFEMP3Shield, click the "Download ZIP" link on the library's GitHub page. You should also be able to grab it directly from here.

This GitHub repo already includes a copy of the SdFat library, so you're covered there.

The "Sparkfun-MP3-Player-Shield-Arduino-Library-master" folder you extract should have a handful of folders within. The "SFEMP3Shield" and "SdFat" folders in particular need to be installed as Arduino libraries. For help installing the library, check out our Installing an Arduino Library tutorial. You'll need to place those two folders within your Arduino sketchbook (by default in your home/Arduino folder). Your file structure should look something like this once installed:

Libraries correctly installed

Now restart Arduino (if it was open), and check under the "Sketch" > "Import Library" menu to make sure "SFEMP3Library" and "SdFat" are both listed there.

Upload an Example Sketch

The SFEMP3Shield library includes a few fun example sketches that show off all of its awesome abilities. To begin, try loading up the "FilePlayer" example, by going to "File" > "Examples" > "SFEMP3Shield" > "Examples" > "FilePlayer".

Make sure the MP3 Player Shield is sitting comfortably on top of your Arduino, and upload away!

Once uploaded, open up the Serial Monitor and set the baud rate to 115200 bps. Once the sketch initializes, it should present you with a navigable menu:

Serial menu

Hopefully, towards the bottom of the menu, you'll see a list of MP3 files that the sketch found on your SD card. Try sending a 3-digit number with padding zeros (e.g. 001, 003, etc.) to make one of the listed files start playing. Are you grooving now?

If it's too quiet, try turning up the volume using the '+' command, or go down with '-'. There are all sorts of other fun options to try out too.

Helpful SFEMP3Shield Library Documents

If you're looking for help using the SFEMP3Shield, begin by checking out the main page of their support site. There's some good troubleshooting information there.

To dig into the code, you can check out their GitHub repository. There's also a helpful SFEMP3Shield Class Reference guide, which lists all of the functions made available by the library.


On the next page, we'll make an example sketch using the MP3ShieldLibrary to show off some of its more fundamental functions.