Getting Started with the LilyPad MP3 Player

Contributors: MikeGrusin
Favorited Favorite 12

Writing Your Own Code

The LilyPad MP3 Player uses the same pinout as SparkFun's MP3 Player Shield and should run the same code without modification.

The LilyPad MP3 Player is Arduino-compatible. It uses the same bootloader as SparkFun's "Pro" and "Pro Mini" series of boards. Tto select the correct board from the Arduino IDE, go to the "Tools/Board" menu, and select "Arduino Pro or Pro Mini (3.3V/8MHz) w/ATmega 328".

We made it this way to support Bill Porter's excellent MP3 Player Library, which takes care of most of the hard work involved in playing audio files. If you look at the example code we provide, you'll find this library at its core.

The best way to write new code is to start with one of the existing examples. For example, we modified the stock code to play a prank on "According To" Pete Dokter where we looped the "It's A Small World" song over and over, while very slowly increasing the volume. We've included this code is in the examples directory.

You can download the LilyPad MP3 Player code from the github repository. Clicking the "ZIP" button on that page will download the latest version. You could also install a github client and clone the repostitory to your local machine.

Within the archive, you'll find the "Trigger" and "Player" sketches, as well as example programs showing off different features of the board, such as the use of the rotary encoder. All of the code is fully-commented and completely free for you to use and modify.

If you'd like to bypass the Arduino environment and program the ATMega328 directly, you can do that as well. There is an unpopulated 6-pin ISP header on the board. You can use this header to program the board using an Atmel ISP programmer such as SparkFun's Pocket Programmer.

We'd like to extend huge thanks to Bill Porter and Michael Flaga for their hard work on the MP3 Player Library.