Picture of Playing Wave file using arduino
This is a simple circuit to play wav files using arduino Nano V3.0 ,it consist from 4 buttons ,each one play specific wav file loaded to SD card.
Remove these adsRemove these ads by Signing Up

Step 1: Parts

Picture of Parts
Funduino Nano V3.JPG
Funduino Nano V3 1.JPG
1- Arduino Nano V3.0 (I used the chines version called Funduino Nano).
2- SD card Module.
3- SD card.
4- Bread Board.
5- four push Button .
6- four 22K resistors.
7- one 4.7K resistor.
8- BC546B NPN transistor.
9- Speaker.
10- wires.

Step 2: Prepare your SD card

Picture of Prepare your SD card
Wav Sample Converter.png
1- Format SD card and make sure the setting as attached picture.
2- Convert your music to .WAV files and make sure the below:
-Samples Per second(Hz):16000
-Channel :Mono
- Bits Per Sample: 8
I use Wav Sample rate converter software (picture attached).
3- Wave files samples attached.

Step 3: Circuit Digram

Picture of Circuit Digram

Step 4: Source Code

Picture of Source Code
1-Before writing the code you need to install TMRpcm library from below link:
all information how to install and use the library included in the website .

2- Download the attached file and open it with arduino sketch ,I tried to copy and paste the Source Code from arduino sketch to instructable but for some reason the text convert to rubbish.

WavSW_ino.zip887 bytes
1-40 of 46Next »
DoctorWoo10 days ago
Sorry if this was already addressed, but could you just replace the speaker in here with a headphone jack and use a set of headphones or a speaker with the correct jack size?
peterj210 days ago

Been trying for hours now to get the stereo output to work on an Arduino Mega, is there a diagram somewhere where all the pins and connections are described for the Mega

hi nice work sir ,,,, how cn you make this polyphonic :DD im currently working on my electronic drum but i couldnt play two to three drums at a time ,, is there a way that i could make it polyphonic .

i really need your help :D please pm me on facebook

thank you

n1cod3mus1 month ago

Hi, thanks for the instructable really good works great however, I have an issue with volume, its not very loud, I am using an amplifier module and a 4W speaker, its a tiny speaker 30mm x 40mm. it has to be small to fit in the device I want to put it in.

any ideas how I can get a reasonable amount of volume out of a small speak or one that would fit in a 35mm high space?

its this speaker

TDW91 n1cod3mus1 month ago

Hi, I'm using this speaker for a similar project and I was wondering, what are you using as an amplifier module?

Thanks in advance!

n1cod3mus TDW911 month ago

it was an LM386

ok turns out my Wav files had low volume, upped them in a wav editior seems much better.

orgasmotron1 month ago

hello , you've made a great project , i have a question about it , will it be hard

to loop the sound wave when you press one of the 4 button

pain962 months ago

Hi. First of all, thanks for the tutorial because you did a very good work here but sadly, i can't get it work :( I'm using an Arduino Uno with an ethernet shield which has a micro-sd slot too. I downloaded your code and uploaded it on arduino, but when i connect the speakers to pin 9 and GND it just makes a noise, without playing anything.
Thank you for your attention, I hope you could help me.

Husham Samir (author)  pain962 months ago


first of all make sure everything connected correctly .

if you check below comment ,one of them get the same problem you have ,his name David Piccinini and he solved the problem by changing the communication speed baud rate to 9600

I hope it will work.

Good luck

Hi, thanks for the answer.

Actually, i didn't have to connect anything, cause i just put my ethernet shield on my arduino, put in the micro sd (class 5 type SDHC) with your files, connected the speaker (without amplifier, just to see if it worked) and upload your code. The baud rate was already at 9600, and i stil can't figure it out. I'm starting to think that my ethernet shield is a scam. If you have any further information, that would be appreciated. Thanks a lot.

Husham Samir (author)  pain962 months ago


try to check the SD card example .

go to File ----Example-----SD -----card info

verify then upload

open the serial monitor and check .

if you could not read the SD then read below article ,you may find something useful.

thanks for this comment, it helped me out, I thought I had done something wrong with my wiring and this proved I had it right.

so now I need to check everything else lol

vkaushik12 months ago

helpful tutorial indeed!!! I used a MEGA 2560 board, the output from the board is given to the speaker( 8 ohm 5W) through a easily available transistor 2N2222. I hooked the output pin from arduino to the base through a 100 ohm resistor , +5v to collector and the emitter to speaker's one pin. but still the audio output is very feeble. IS there any way to increase the sound rather than going for an conventional amplifiers???

Thanks in advance.

Husham Samir (author)  vkaushik12 months ago


if you use 5W speaker ,I believe you need to use Amplifier but before that try use ( 0.2 W speaker) ,you might get your requirement.

kvenkatesan12 months ago

Its cool. worked great. the audio was too low and so i used LM386 amplifier now all get is a humming noise. what could be the solution?


Husham Samir (author)  kvenkatesan12 months ago


try to connect ceramic capacitor (code 104 or 103) between the output from arduino and the input of LM386 ,this capacitor should filter the DC voltage that cause the noise.

thank you.

mrnateytatey3 months ago

Can you run the circut with out a transistor and say connect it to a amplifier would that work?

mrnateytatey3 months ago

I keep getting this error PLEASE help asap.

I want to get this project done a quick as possibal

TMRpcm error.PNG
Husham Samir (author)  mrnateytatey3 months ago

hi first of all make sure that the TMRpcm library installed in correct folder (libraries).

if you already install it and you get the same problem do the below:

1-Rename the folder TMRpcm libraries to TMRpcm1.

2-Enter inside TMRpcm1 folder you will find another folder called TMRpcm

3- copy TMRpcm folder and paste it in arduino libraries.

4- delete TMRpcm1 folder

5- Restart your IDE and check ,it should work.

Thanks lots,the fix worked. I cant believe i diddent think of that

Husham Samir (author)  mrnateytatey3 months ago

I'm glad to hear that.

I changed the TMRpcm tmrpcm; to Tmrpcm audio; but to no avail i diddent get it working even after that change

mrnateytatey3 months ago

Can you run the circut with out a transistor and say connect it to a amplifier would that work?

Husham Samir (author)  mrnateytatey3 months ago

try to connect it to headphone or smaller speaker first if you don't want to use transistor.

amplifier will work but if you get loud noisy sound ,you might add a ceramic capacitor in the way to solve this problem

mr79193 months ago

can we use sd card shield like

Husham Samir (author)  mr79193 months ago


yes you can but you have to change chip select in the code.

Check the link below:

thanks a lot

Which part of the code would I need to make the arduino play samples from its own memory?

or a PCs hard drive for that matter

E3D3 made it!5 months ago


funny and usefull project, nice to include even the wav-files.

It gives a nice and loud sound with an UNO.

Converting mp3's to 8bit 16 kHz mono wav's is easy with ffmpeg:

fmpeg -i orginalFile.mp3 -acodec pcm_u8 -ac 1 -ar 16000 convertedFiles.wav

Bruno1535 months ago

I am very impressed with this project! I've been looking for a method to play sound files with eletronics and this is by far the most reliable way I've found, probably easier than using ISD IC series. I'm also trying to do the same, but using a MSP430 and Energia, mainly because SD module here is sadly expensive, and as it operates with 3.3V I hope I can just solder a SD to micro SD adapter to the circuit.

But as I was trying to set pins to Energia, I tried to set for the other SD data pin, but I could only find CS and speaker, is it even possible to configure other pins?

Very nice Instructable, Thanks!

mayang065 months ago

Hi! I tried your diagram and code but it didn't work. The output of the speaker is static and when I verified the output's signal using oscilloscope, I saw digital signal. But it is distorted. Do I need to use DAC for an audio output? I'm using 8-ohm 1 W speaker. Does the wattage of the speaker matter? Thank you for posting this. It's very helpful with the project I'm making. :)

Husham Samir (author)  mayang065 months ago


first of all make sure that the pin that connected to speaker support PWM,

try to check the circuit using headphone instead of the speaker.

Yes, I've also tried using earphones but the output audio is still in static. The thing is "" doesn't really play the file at all. Is there something wrong with the TMRpcm library? The conversion of the sound file was based on the figure you've provided. By the way, I'm using Arduino Uno instead of nano. Does it affect the audio output?

Husham Samir (author)  mayang065 months ago

make sure the SD module working probably with arduino, go to

Example----SD--Card Info download the sketch and check .

The SD module is working properly. I did modify my circuit diagram. I didn't use switch. Instead, I use piezo transducer as trigger. And then, instead of using digital input, I used analog input. Does this affect the audio output? Hence the reason for the static audio?

Husham Samir (author)  mayang065 months ago

I'm not sure that the piezo will provide enough voltage for trigger ,so connect one button switch first to make sure the circuit works correctly .

Does the 5V supply in arduino affect the voltage input to the speaker and the MicroSD?

1-40 of 46Next »