Mp3 Play From SD Card With Arduino
by sezgingul in Circuits > Audio
120034 Views, 85 Favorites, 0 Comments
Mp3 Play From SD Card With Arduino
Audio file playback from SD card will tell. Without using any module will play MP3 audio files only with SD card reader.
Materials:
Materials:
- Arduino
- SD card module
- Speaker
- sd card and adapter
Electronic Section:
Download fritzing file .
SPI pins in arduino model for the communication module according to the SD card SPI protocol varies.If you use a different model that models must insert pins according to the SPI pins.
You have to convert MP3 files into WAV format.You can do the conversion in the online wave convent site. 8-bit 32000 Hz in stereo mp3 file converter file set as follows: Click the button. the files you download, install directly to your SD card.
Software Part:
Library: SimpleSDAudio
Sample code:
#include <SimpleSDAudio.h>
void setup() {
SdPlay.setSDCSPin(4); // sd card cs pin
if (!SdPlay.init(SSDA_MODE_FULLRATE | SSDA_MODE_MONO | SSDA_MODE_AUTOWORKER))
{ while(1); }
if(!SdPlay.setFile("music.wav")) // music name file
{ while(1);
}
}
void loop(void)
{
SdPlay.play(); // play music
while(!SdPlay.isStopped())
{ ;
}
}
Result
Except arduino mega-plus pin 9 pin to digital speakers on other models, while the mega arduino 44. Insert the digital pin. We do not specify the speaker pins in the code. Library automatically provide output from these pins.
Original Project web site : turkish web and english web