Introduction: Audio Player Using Arduino With Micro SD Card

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.

Comments

author
suneththu (author)2017-07-28

when play sound it makes lot of noise can you explain me why

author

Use..... Tone library.....
Or some kind of filter.....

author
suneththu (author)2017-07-20

Ok I did it thanks for help

author
suneththu (author)2017-07-19

Dear ,

First time it play then gives error sd fail this is the sample code i wrote

if ((t.hour==12) && (t.min==07) && (t.sec==00)){
//playsound();
tmrpcm.speakerPin=9;
if(!SD.begin(SD_ChipSelectPin))
{
Serial.println("SD fail");
return;
}
tmrpcm.setVolume(6);
tmrpcm.play("test.wav");

//Serial.println("ok");
}
if ((t.hour==12) && (t.min==8) && (t.sec==00)){
// playsound();
tmrpcm.speakerPin=9;
if(!SD.begin(SD_ChipSelectPin))
{
Serial.println("SD fail");
return;
}
tmrpcm.setVolume(6);
tmrpcm.play("test.wav");

//Serial.println("ok");
}

please help me

author
suneththu (author)2017-07-19

Dear,

When I try to play audio file more than one time (I need to play audio again and again) code give me error

"SD fail" could you explain me why is that and how to correct it.

author

If you want to play audio more then one time then add the line in the void loop()

void loop()
{

tmrpcm.play("test.wav");
delay(5000);

}

author
prathik98 (author)2017-07-16

bro, i have followed all the steps exactly as mentioned above,but it isnt working at all...not even still sound just blank.i have used 8ohms speaker.i have converted the file into wav (file name xyz.wav)

....please help

2017-07-16 19.58.11.jpg2017-07-16 19.57.34.jpg
author

Ohkk.... Double check all steps....
Make sure the converted file name is xyz.wav and in program it is same.

Then
Open serial monitor what it prints...

author

it is showing "SD fail" in the serial monitor

what should i do?

author

Ohkk....... There is mistake in connections.... Check that if it not work

use the test.Wav file that I have added in folder.

author
suneththu (author)2017-07-15

please explain me how can I do it

author

Open program
find this.....

tmrpcm.speakerPin = 9;

Change 9 to as your choice

author
suneththu (author)2017-07-14

Can we use analog pin to out the audio sound

author

Yes, you can.....

author
aky125 (author)2017-07-09

Hello. It works fine, but when I want to use a servo motor with audio, servo doesn't work. Servo and audio works separately. Have you seen any problem like this before?

author
aky125 (author)aky1252017-07-09

in my code, first I rotate servo motor 180 degrees, and then I play an audio. Servo rotates but then I can't use it anymore. when the audio plays, servo goes off.

author
vishalsoniindia (author)aky1252017-07-12

Attache servo with 9v battery and short the battery ground with arduino's ground

author
aky125 (author)vishalsoniindia2017-07-13

both arduino and servo motor is connected to the same power source, so they have common ground.

author
aky125 (author)aky1252017-07-15

Solved it!

Since both audio and servo use timer1, I managed to control the servo motor with timer2 and the problem solved.

author
suneththu (author)2017-07-14

Can I use pin num 2 or 3

author
suneththu (author)2017-07-14

it wont work for other pin

author

It will work........

author
suneththu (author)2017-07-14

no ti won give output for defferent pin

author
suneththu (author)2017-07-14

Dear,

Can I use another pin for audio out

author

You will find this.....

tmrpcm.speakerPin = 9;

Change 9 to as your choice

author
suneththu (author)2017-07-12

Dear,

I have

2x16 LCD Display HD44780U Shield with push buttons Lcd module

can you explain how do i connect this unit to arduino board from the bread board wiering

thank you

author

Open arduino ide software in pc.
Now go to examples >>liquidCrystel >>hello
Now connect pins as shown in example.

author
suneththu (author)2017-07-11

Dear .

Do you have any idea about connect both lcd display and micro sd module

author

Yes,
Go to my YouTube channel
"Vishal soni"
Or click on subscribe on top of this page.
Then find "GSM control home automation"
Here led is added in this you can get basic idea from that. :)

author
Karudivate (author)2017-07-07

which amplifier circuit will be suitable?

author

Audio amplifier...

author
BeraatT (author)2017-04-15

it dont work but i did evreything in the post. Please Help !

author
vishalsoniindia (author)BeraatT2017-04-15

please Explain what you did.....every step..........................

author
BeraatT (author)vishalsoniindia2017-04-16

I did everThing in your post. I tried different tutorials to play wav files but none of em worked. Now i ordered another microsd card reader cuz i thong mine is not working. Please keep in touch . Do u have skype or something like that so i can ask u if i have too ?

author
vishalsoniindia (author)BeraatT2017-04-23

What the name of your .wav file

author
AnkushG19 (author)2017-04-22

Nice video !!
My speakers are making very ugly noise when i use the .wav file.
But when i use the tone library it works fine. Any suggestions?

author

Thank..


You...... :-)

About This Instructable

5,404views

61favorites

License:

Bio: i am 20 year old electrical engineer from india.
More by vishalsoniindia:DIY Build QUADCOPTER || Drone || Cc3d || Flight Controller Board (fcb) || in Only 13 Step || Simple & EasyAudio Player Using Arduino With Micro SD CardDIY Build BB-8 in India || Android Controlled and Talkative || Life-size
Add instructable to: