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.

Step 1: Parts

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.
<p>Success!! Thank you to Gutisie for all your suggestions! It seems the audio converter I was using must not have been getting things into the right format. I tried a different online .wav converter and BOOM... It worked just fine. I really appreciate the advice though. </p><p>This is one of those head-smacking &quot;doh&quot; moments </p>
<p>Posted this a few months ago and I'm still at a loss. Any help would be appreciated:</p><p>Hello! This instructable is awesome, and I appreciate your writing it. I am, however, having major issues getting my audio files to play. I have gotten the whole set up working using the sample files, but I cannot get mine to play.</p><p>I have converted the files to 8bit 16 kHz mono wav files, and have tried multiple attempts with naming conventions with no luck. The files play fine on my computer (degraded in quality somewhat due to the 8bit 16 kHz factor, but certainly more recognizable the fuzz I'm getting out of the speaker in my set up).</p><p>Thanks for any help anyone could give me in this. I have multiple DAWs and am capable of manipulating the audio files however is necessary, but I'm at a loss of what to try.</p>
<p>hi, did you get any luck? i have same problem. converted my files to the required setting but still nothing.</p>
<p>No luck yet. I'm at a loss of what else to try. I'm working on a mac, but I can't imagine how that would matter. I've tried everything I could think of. At this point I've entirely abandoned the project out of frustration. I'd love to make it happen, but it doesn't seem like its going to work for me. Certainly give a reply back if you figure it out though! Most of my arduino project ideas require this functionality at the core of their purpose.. kind of a bummer. </p>
<p>i think you forgot to put the delay:</p><p>tmrpcm.play(&quot;1a.wav&quot;); </p><p> delay(6000);</p><p>for me its that long as my intro wav file is nearly a min long.</p>
<p>Good thought! I have been holding down the button, however, to let the sound play completely</p>
<p>hi, i figured out!! it is the volume, basically your computer has better speakers than the little one, and better gain, so i found out with audacity that increasing the db levels i can hear them, so i have got me an amplifier module booster for arduino, sort of like a volume control. I hope that helps.</p><p>Or if you are not too bothered with distortion, then amplifly the audio with audify and export it, remember the &quot;save as other formats&quot;, then in option click the 8 bits unsigned, and wav (windows). that will do the trick.</p>
<p>Hello Friend! Thanks so much for your replies. After a few months of my life being too busy for side projects I'm finally back to it, and I appreciate the help! </p><p>I don't think my files were playing out of my computer much/any quieter than the sample files were. I will, however, definitely give boosing them a shot. </p>
<p>hi,</p><p>Do you have more buttons than 4? are you compiling code with more than 4 buttons, but you only have 4 connected? if you do, that is why you get noice etc...</p><p>in code buttons pins are to 5 volts but if you dont connect pins in arduino to the 5 volts with the resistor then your code will not work.</p><p>so that is why when you compile only 4 buttons it works, but when you put 5 or 6, if they are not wired, it doesnt work.</p><p>any way...just trying to help.</p>
<p>here, try this link to adjust volume. <a href="https://discussions.apple.com/thread/4957602" rel="nofollow">https://discussions.apple.com/thread/4957602</a></p>
<p>Hey, can you still use this set up for the arduino 1.6.6?<br>If you can will somebody send me his sketch? <br>I use an arduino uno.</p>
<p>hey!!<br>i am usung IMU as well as sd card reader together, but there is an eroor twlling that 'Buffer' has been defined defined twice, once in actual code(for IMU) and once in tmrpcm(audio library).<br>how can i remove this error?</p>
<p>Hi Husham</p><p>Firstly I hope you are safe where you are so to for your country's future.</p><p>I have project to build similiar to this .</p><p>I have a panel with 30 buttons and want to have 30 different waves sound for each one. Of course the board only hace limited inputs. Can you help a little with this?</p><p>Thanks you</p>
<p>Thanks Felwin,</p><p>I will suggest you to use one analog input for multiple buttons by connecting different type of resisters ,just search in google (Arduino analog input for multiple buttons ) to understand the concept.</p><p>Also there is MP3 module support multiple buttons without using Arduino ,Search for the below and take a look on the datasheet :</p><p>MP3 FN-M16P Embedded MP3 Audio Module Datasheet</p>
<p>Just made it worked.</p>
<p>Got the tmrpcm Lib and the sample provided here to work with the Arduino IDE 1.6.5 and a Nano.</p><p>Add the SPI.h at the beginning of the code (as mentioned before).</p><p>Put a delay(5); directly behind the .play method. Without delay, no sound is played.</p>
<p>Thanks Stefan , That's Perfect . Without delay(5) it is not working . I wasted almost 3hr's and then saw your comment . It now works .</p>
<p>can ask for all who has the complete codes regarding on this project?...i would like make a project that really needs basic codes...thank you</p>
I have using arduino uno <br>instead of speaker I connected to GSM shield for reporting fault with playing the pre recorded voice<br>....thanks
<p>can you kindly share your sketch? It will be useful to many other! :) Thank you in advance</p>
<p>Yes Sure .. Sorry for Late reply ..</p>
<p>Hi Anil , Could you please share your contact details to me at <a href="mailto:brevildsilva100@gmail.com" rel="nofollow">brevildsilva100@gmail.com</a> </p>
<p>Here is the link .. hope its accessible</p><p>https://drive.google.com/file/d/0B4iK8w7n6zwWNUxxYmVQQ3IwSUk/view?usp=sharing</p>
<p>hi, i haven't the gsm shield, i've 2 sim800l modules... where do i need to link the wires you disconnected from speaker and connected to the shield? Thanks</p><p>http://www.aliexpress.com/item/Smallest-SIM800L-GPRS-GSM-Module-MicroSIM-Card-Core-BOard-Quad-band-TTL-Serial-Port/32284560394.html?ws_ab_test=searchweb201556_2_79_78_77_92_91_80,searchweb201644_5,searchweb201560_9</p>
<p>yes instead of speaker connect to Microphone of GSM .. look for polarity.. connect Speaker + to Mic+ and Gnd to Mic - ..</p>
<p>thank you, i'll try this weekend :)</p>
<p>Great work AnilKumar . I am trying to build this . Will need your help . </p>
<p>Sure i will help as soon as possible.. some times it takes two days sorry for that</p>
<p>thank you very much! :D</p>
<p>Awesome!</p><p>congratulations AnilKumars.</p>
<p>Thank you very much for this instructable Husham!</p>
<p>Awesome project, helped me out a lot. If your a MAC user make sure you get the drivers for Arduino Nano Installed (https://learn.sparkfun.com/tutorials/how-to-install-ftdi-drivers/mac). Also, if you need to convert to 8 bit, 16 KHz WAV files you can 1.) import any WAV file into iTunes 2.) Change your import settings in preferences to WAV / 8 bit / 16000 Hz and 3.) Select your WAV files &quot;right click&quot; and convert to WAV which will apply the new settings. Then you just drag them out of iTunes and on to your SD</p>
<p>Isn't is work using arduino uno???? </p>
<p>i want to make it, but have some queries<br>1 power supply is not shown in circuit diagram?<br>2 what changes i need to make in circuit and program for more then 10 files?</p>
<p>I'm using a slide angle switch to choose what audio to play, but it won't work, can someone help me?</p>
<p>Any one who has any troubles in compiling the sketch ... just add this line above </p><p>#include &lt;SPI.h&gt;</p><p>And thanks Husham alott for this informative Tutorial</p>
<p>I can't compile the sketch I get </p><p>TMRpcm.h: No such file or directory, yet the library is there.</p>
<p>use arduino 1.0.3 software.. Newer version does not support this library </p>
<p>just add this line after * #include &lt;TMRpcm.h&gt;*</p><p>ADD This --&gt; #include &lt;SPI.h&gt;</p>
<p>this error telling you that you didn't install theTMRpcm library in the right location.</p>
<p>i also got a compile error:</p><p>TMRpcm.h: was not declared in this scope</p><p>But i have installed the library</p>
<p>My setup is a little different, i used 2 buttons and 2 1 k resistors instead of 22k. <br>The setup is pretty fine, don't have amplifier, but the sound have noise and a continuous sine noise. i believe this is lack of amplifier, can be arranged with some amplification and a 104 capacitor!</p>
This is driving me nuts. All i am able to get is static when it's playing the file (tested with earphones). I am using an Uno with an ethernet shield that has a micro sd. See you've had a couple of others with the same problem. Does that mean potentially that the ethernet shield is what's causing the problem?
<p>I set up this circuit with Arduino Uno. Is it necessary any changes on my circuit or codes?</p>
<p>Got it working!!!!!! (sorta)</p><p>1. Sound plays from each button, but after about 5 seconds it loudly fuzzes out, I used Cool Edit Pro to adjust the wav settings as stated about in instructions. Any ideas. I am attempting to download your wav files and try them to see what happens.</p><p>2. Can I put an 1/8th inch jack inplace of the speaker so I can connect to bigger speakers or a sound system? If so, is there a pinout for the 1/8 and ??transitor?</p><p>3. I am building a Tartus (phone booth) for a friend's daughter's door facaude. When she opens the door, he wants it to play music for her. I was thinking of doing an always on switch. Will I need to change the code a bit to tell it to play when a button is pushed, or will just telling it to play when the switch is high work the same (door will push the button &quot;closed&quot; when closed, and &quot;open&quot; the button when the door opens) hope you understand.</p><p>this is my first Arduino project and look forward to doing more now.</p><p>Thanks,</p>
<p>finally got it to work. My switches were only hooked to ground on the right side and the left went to the resistors. The transistor is flat side out not up like the picture looks like. this is for the ones who are new at it like me and try to follow the picture. I also connected 5v to the bottom line on breadboard that the resistors went to (along with the red wire for the speaker) and connected ground to the SD card (but any ground connection on the arduinos will work). You'll get a blue light on, on the Arduino Nano. couple questions to follow. </p>
<p>Thanks so much for this Instructable! I'm hoping you can help me with a coding issue. In my code I need to either call for TMRPCM to play the audio file in a specific directory or, use a variable to define which name of the file to call for TMRPCM to play...</p><p>Basically, I'm looking to have pages from a book recorded as separate tracks for each page.</p><p>In the first part of the code, the user defines the book to be played.</p><p>Then in the second part of the code, the page that is played is determined by sensor input. This sensor input will be the same for Page 1 of any of the books, so it ends up being something like:</p><p>tmrpcm.play(&quot;page1.wav&quot;);</p><p>But the files should be named: </p><p>&quot;BK1page1.wav&quot;</p><p>&quot;BK2page1.wav&quot;</p><p>etc....</p><p>So the call to play the file should have a variable for the BK1 part and then page1.wav at the end....</p><p>Cant figure out how to do that... tmrpcm.play(bookNumber, &quot;page1.wav&quot;);</p><p>Or if it can just look into a directory? tmrpcm.play(bookNumer, &quot;/page1.wav&quot;); </p><p>Something to that effect.. (Though those examples don't work, I've tried.)</p>
<p>Hi Husham Samir ,</p><p>I have got some <br>problem, but a figured out.</p><p>-Fist problem, the transistor didn&rsquo;t amplified well, so I <br>removed it and put this circuit (amp-op): <br><a href="https://www.arduino.cc/en/uploads/Tutorial/LM386_AudioDue.jpg" rel="nofollow"> <br>https://www.arduino.cc/en/uploads/Tutorial/LM386_...</a> </p><p>- I tried to convert some mp3 audios from r2d2 to wav <br>format, but only worked with this steps.</p><p>1. Open mp3 to Audacity 2.1.1</p><p>2. Split the stereo track on two tracks</p><p>3. Make each track <br>mono</p><p>4. Mix them</p><p>5. Set Sample <br>Format -&gt; 16-bit</p><p>6. Set Project <br>rate -&gt; 8000Hz (this function is under the sample format)</p><p>7. Project rate <br>-&gt; 8000Hz</p><p>8- Effect -&gt; <br>change speed -&gt; new length -&gt; put the original time of the audio (when <br>you change project rate the audio slow down, so you need force it to the <br>original speed)</p><p>9. File-&gt; <br>export-&gt; other uncompressed files -&gt; options -&gt; header-&gt; wav <br>(Microsoft)</p><p>10. Options -&gt; encoding -&gt; unsigned 8-bit PCM</p><p> 11- Save.<br> <br><br> <br>Or : <a href="https://learn.adafruit.com/adafruit-wave-shield-audio-shield-for-arduino/convert-files" rel="nofollow">https://learn.adafruit.com/adafruit-wave-shield-audio-shield-for-arduino/convert-files</a><br> <br>but didn&rsquo;t worked with 16khZ only with 8kHz&hellip;<br> <br><br> <br>by the way, you can&rsquo;t put some characters like <br>&ldquo;-&ldquo; or space, well, didn&rsquo;t worked with me&hellip; And the audios working: <a href="https://www.dropbox.com/sh/b8u8d02kfddpd21/AABCBEbiO6Ow1Ro_aF0EiO8sa?dl=0" rel="nofollow">https://www.dropbox.com/sh/b8u8d02kfddpd21/AABCBEbiO6Ow1Ro_aF0EiO8sa?dl=0</a><br> <br><br> <br>Thanks so much for the light. May the force be with you.<br>&Aacute;.N.</p>
<p>Great Work,</p><p>Thanks for sharing your troubleshooting steps ,this will be helpful to many people who have some issues in this circuit.</p>

About This Instructable


312 favorites


Bio: Electrical Engineer
More by Husham Samir: Using MikroTik Router Board 433 & Arduino To Control Two LEDs Arduino Keypad Door Lock Temperature Data Logger
Add instructable to: