Sunday, February 20, 2011

Rogue MP3 shield

The Rogue MP3 shield from RogueRobotics.com is a central to my project.  The shield has a slot for an SD card (you can see it sticking out the right side of the board).  On the SD card are the MP3 files, and the data files containing the instructions for turning on and off the lights.
This shield is really easy to use, and the code examples are very helpful.  There were some reports of problems with the libraries, but I found that upgrading to Arduino 022 solved it.


#include <RogueMP3.h>
#include <NewSoftSerial.h>


NewSoftSerial rmp3_s(6, 7);
RogueMP3 rmp3(rmp3_s);


void setup()
{
  rmp3_s.begin(9600); 
  rmp3.sync();
  rmp3.playfile("/ump3test.mp3");
}


Playing an MP3 can be done in just 7 lines of code.  I guess they had to update the serial library with their own NewSoftSerial library.  When initializing the NewSoftSerial, you can choose the pins to use (in case the default conflicts with the pins you are already using on the Arduino).

The Rogue MP3 library can be downloaded from their web site, and documentation can be found in their wiki.  Overall, the documentation is good, but it would benefit from Arduino examples.

The only criticism I have of the shield/library is the with the playback status.  For my project, it would have been very helpful if the current time position in the file were returned in milliseconds.  Unfortunately, the Rogue MP3 only returns position in whole seconds.

Overall, it's a fantastic shield.  I can definitely see myself using this again in other projects.

In my next blog entry, I'll look at another Arduino shield I'm using; the Centipede shield.

No comments:

Post a Comment