Audio Player Using Arduino With Micro SD Card




Posted in TechnologyArduino

Introduction: Audio Player Using Arduino With Micro SD Card

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 .

  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 "" 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.

2 People Made This Project!


  • Spotless Contest

    Spotless Contest
  • Microcontroller Contest

    Microcontroller Contest
  • Space Challenge

    Space Challenge

We have a be nice policy.
Please be positive and constructive.




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

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

Please help me.

1 reply

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

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

1 reply

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

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

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

Yes, you can......
And if you want to play song over voice commands then here is video

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

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

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:"A.wav"); //Play song 1 from 10th second

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

It is pretty tinny, but it is music!

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?

deprecated conversion from string constant to 'char*' [-Wwrite-strings]"test.wav");

5 replies

Did you changed your code.......
Or did you proper converted wav file

no bro i didnt change.. i just copied ur code..then when i compiled it found some errors

#include "SD.h"

#define SD_ChipSelectPin 4

#include "TMRpcm.h"

#include "SPI.h"

TMRpcm tmrpcm;

void setup(){

tmrpcm.speakerPin = 9;


if (!SD.begin(SD_ChipSelectPin)) {

Serial.println("SD fail");





void loop(){"001.wav");

delay(5000) ;


I am using arduino mega so.. i will change the pins.. but before that the compiling is shoing error.

Change the name of file.... Rename it in SD card and same as in Code.....
Like a.wav , b.wav
Not put number in sound name