ArduinoTutorial: Sparkfun MP3 Player / Arduino

How to use the Sparkfun MP3 Player Shield

The Sparkfun MP3 Player Shield is a wonderful shield but the instructions for installing the libraries are a little out of date. My student Asa Hillis wrote the following instructions while setting his up, and he offers them here to the public in the hopes that this is useful to other:

Prerequisites

These instructions assume you are using Arduino version 1.0 or later, which accepts libraries in your sketchbook folder.

Installation Steps

  1. Download this zip file containing the Sparkfun MP3 Player Shield library written by Bill Porter. If you want to learn more about the library read here.
  2. Unzip the file, which will give you a folder called madsci1016-Sparkfun-MP3-Player-Shield-Arduino-Library-2b83891/
  3. In that folder you will find some documentation as well as two folders: SFEMP3Shield and SdFat. These are libraries and you will need both of them.
  4. Find your sketchbook folder. You can check by opening Arduino -> File -> Preferences and see what it says at “Sketchbook location”.
  5. Open your sketchbook folder and look for a folder named “libraries”. If you don’t have a libraries folder in your sketchbook folder, create one.
  6. Copy (or move) both the SFEMP3Shield and SdFat folders from the madsci1016-Sparkfun-MP3-Player-Shield-Arduino-Library-2b83891/ into your libraries folder.
  7. If you had Arduino running, close and reopen so that it finds the new libraries.

Changes to the Examples

You may use the examples in File -> Examples -> SFEMP3Shield -> Examples or from Bill’s website, but you must make the following change:

  • Find the line that initializes the SD card and change SD_SEL to 9:
    sd.begin(9, SPI_HALF_SPEED)

Preparing music files

  1. MP3 files must be compressed at 192kbps. You can find converters on the internet for your operating system.
  2. The names of all MP3 files must end with the extension “.mp3”. Rename them if they are something different.
  3. The names of all MP3 files must be in DOS 8.3 format meaning:
    1. At most 8 characters, starting with a letter and not a number
    2. All characters should be lower case (verify)
    3. The last 4 characters must be “.mp3
    4. E.g.
      track001.mp3
  4. Rename them if they are something different.

Problems?

  1. The most common problem is an inability to read the SD card. Verify correct file name formats, and verify that you can play your MP3 file from your SD card on your computer.
  2. The second most common problem is that your MP3 file is not compressed at the correct bitrate of 192kbps. Your music player may be able to report the file bitrate so you can verify.
  3. Bill has some excellent troubleshoting hints on his webpage

If you have any problems or updates to these instructions please leave a comment below

Thanks to Asa Hillis for writing the original instructions

Print Friendly
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Leave a Reply

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