Introduction: 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.

Step 1: Materials:

Materials:

  1. Arduino
  2. SD card module
  3. Speaker
  4. sd card and adapter

Step 2: 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.

Step 3: 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())

{ ;

}

}

Step 4: 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

Comments

author
suneththu (author)2017-07-29

It makes lot of noise can you explain it why

author
Tataaa (author)2017-07-17

How can I download simpleSDaudio library????????????

author
suneththu (author)2017-07-14

can i change the speaker pin to 2,3 or 1

author
jnh123 (author)2017-06-21

tried and tried again , really started over 3 times got a little noice one time is all.

author
KunalK6 (author)2017-04-10

To which pins can I connect the Speaker

author
AntunN1 (author)KunalK62017-06-21

to digital pin 9 and gnd!!!

author
AntunN1 (author)2017-06-21

i will make it ,but, where is WProgram.h and Arduino.h?

please contact me!!!!!!!!!

author
Md. Fakrul bink (author)2017-05-07

wow!!!

author
UMAR B (author)2017-02-27

iam getting an error of"Arduino: 1.6.7 (Windows 10), Board: "Arduino/Genuino Uno"

C:\Users\4G\Documents\Arduino\sketch_feb28b\sketch_feb28b.ino: In function 'void setup()':

sketch_feb28b:7: error: 'SSDA_MODE_AUTOWORKER' was not declared in this scope

if (!SdPlay.init(SSDA_MODE_FULLRATE | SSDA_MODE_MONO | SSDA_MODE_AUTOWORKER))

^

exit status 1

'SSDA_MODE_AUTOWORKER' was not declared in this scope

This report would have more information with

"Show verbose output during compilation"

please help me and tel me what to do

enabled in File > Preferences."

author
Tanmay Deuskar (author)2016-05-13

Hello,

really good project and and the sd card part is really cool, but could explain the music part of the code

About This Instructable

20,842views

44favorites

License:

Bio: Mechanical engineer, Entrepreneur, Maker, robotic systems expert and Robimek founder
More by sezgingul:Arduino Mini CNC Making Robot Hand With  Plastic PipesUse of Microphone Module
Add instructable to: