Audio Player Using Arduino With Micro SD Card

38,479

69

114

About: i am 20 year old electrical engineer from india.

Please SUBSCRIBE my channel for more projects.........................

Many of People want to interface the SD card with arduino or want some audio output via arduino.

So here is easiest and cheapest way to interface SD card with arduino . you can use the audio output from arduino via a switch or sensor .

you can play any type of sound ,music and recording but that audio will be in to .wav file. If it is in .mp3 or any other audio type then we will convert it into .wav file.

Step 1: Components & ​Requirements

  • arduino uno
  • micro SD card Adapter module
  • micro SD
  • Card Reader
  • Speaker or earphone speaker
  • woofer or amplifier

Step 2: Convert Audio to .wav

Go to the Link to convert the audio into .wav .

http://audio.online-convert.com/convert-to-wav

  1. Go to The Link
  2. Upload your audio you want to convert to WAV
  3. Change bit resolution to " 8bit ".

  4. Change sampling rate to " 16000Hz ".

  5. Change audio channels " mono " .

  6. Click on " Show advanced options ".

  7. PCM format " unsigned 8 bit ".

  8. Convert file.

At next page click on "direct download link"

Step 3: Prepare SD Card

Download the Zip file and Extract it.

Here you will get the " SD formatter "

install the SD formatter in your PC.

Now, Connect your card with PC via USB card reader.

Open SD card formatter.

Select the drive of sd card then click on format .

In Next Step Open your SD card Drive .

Past the Audio file that we have converted in .wav file

Rename the file to "test.wav".

Step 4: Add Library in Arduino

Open The arduino Software

Click on then Sketch >> Include Library >> Add zip Library

Select "TMRpcm.zip" that is in zip folder.

Step 5: Upload the Codes

Download the code from link below or i have already mentioned in zip file .

Connect your arduino with pc and upload the Codes.

Step 6: ​Circuit Connections

Insert the card in micro sd adapter module.

Connect the circuit as given below.

CS ---------------------->> 10

SCK ---------------------->> 13

MOSI -------------------->> 11

MISO--------------------->> 12

VCC --------------------->> +5v

GND--------------------->> Arduino's Ground

Speaker Connection

one pin is in to 9 pin of Arduino and other is GND of Arduino

Step 7: Play the Audio

Now , It's Ready...............................

Click Reset button to play audio every time.

The OUTPUT sound is very Low so you can use woofer or amplifier for batter Output.

3 People Made This Project!

Recommendations

  • Optics Contest

    Optics Contest
  • Make it Glow Contest 2018

    Make it Glow Contest 2018
  • Plastics Contest

    Plastics Contest

114 Discussions

0
None
RokiR

Question 3 days ago

No SD fail, converted properly, but when i connect the speaker it plays beeping noise sound that glides up and down. Somebody can help?

0
None
Marvin14

Question 2 months ago

I still get the sd fail

0
None
yehya3

3 months ago

dude thank you so much it really worked, btw you better set the volume at 5 instead of 6 , but thank you so much

0
None
PankajS80

4 months ago

boss sound quality is soo bad what to do :

is it due to less voltage or due to less speed of arduino and liberary

1 reply
0
None
ua9901100

6 months ago

which other libraries can i use instead of tmrpcm(because it uses more space of memory) to play audio file in arduino uno?

0
None
AbubakrS5

7 months ago on Step 1

I did everything as per your instruction but the problem is it doesn't play song, instead it just plays noise. What could be the problem. Please reply to this post.

1 reply
1
None
AkinA5

10 months ago

Hi,I have controled whole connections .Also code is compiled.But it says SD failed.

Please help me.

1 reply
1
None
fengsfrancisAkinA5

Reply 8 months ago

I got the same problem. Do you know how to solve it?

0
None
AkinA5

10 months ago

I think ,The Pins of MicroSD Card was definated automaticaly for Arduino Uno .So are the pins same with Arduino Mega 2560?

1 reply
0
None
vishalsoniindiaAkinA5

Reply 10 months ago

Nope.........not same for arduino mega......
Just search spi pin for arduino mega in Google....

0
None
ankit1079

10 months ago

Hi I have done everything as mentioned in this but when i am uploading it,its showing me error .i also want to add PIR motion with this can you please help me in achiving

1 reply
0
None
yenrajan

10 months ago

Sir, Can I play the songs in the sd card one by one at a scheduled time for a fixed duration. If yes , can you please give me the codes for that?

1 reply
0
None
vishalsoniindiayenrajan

Reply 10 months ago

Yes, you can......
And if you want to play song over voice commands then here is video
https://youtu.be/Jcg1x1oC-5c

0
None
dzimmerm

10 months ago

I have been following Tan's cooments as I am getting the same "deprecated conversion from string constant to 'char*' "error. i copied your exact code, downloaded and included the libraries, and am getting this on the compile. since the cable to the arduino isn't even plugged in, that eliminates wiring problems, sd card issues, file size or wav coversion errors. I am not seeing what a char error has to do with this code.

2 replies
0
None
vishalsoniindiadzimmerm

Reply 10 months ago

Remember, do not connect anything to arduino while uploading program.
Did you used my library or download new one...???

0
None
dzimmermvishalsoniindia

Reply 10 months ago

I used your library.

I wound up ignoring the warnings since it did upload. The code only worked when I moved the following lines out of the loop area and into the setup:

music.play("A.wav"); //Play song 1 from 10th second

Serial.println("now playing A.wav");

It is pretty tinny, but it is music!

0
None
dzimmerm

10 months ago

looking at the exact error message, it looks like the error is coming from the TMRpcm library. Perhaps it has been changed since you got this code to work?