ARDUINO‎ > ‎PROJECTS‎ > ‎

BareBone Arduino .wav player

 About: making a BareBone Arduino play a wav file from an SD-card directly connected
 Start date: 10/10/2012
 Last changed: 29/01/2013

INDEX




All YOU NEED TO KNOW ABOUT THIS PROJECT


When I started with my CastDuino project I knew I would need something as an alarm, so our workers would know about lunch brakes. Back then, I was thinking about using an mp3 shield, but when buying it, I found out it uses the Arduino as it's cpu to play MP3's leaving no place at all for doing anything else. Why not use a cheap MP3 player and use the Arduino for triggering it. I bought 2 at ebay (yep real cheap). Tom helped me out, connecting it to my Arduino. BUT ... The thing just starts playing what ever is on the card and keeps repeating it over and over. Mmmm, when you only need one sample to be played and you know the length of your sample, it ain't hard to get it right.

So I decided to try something with an SD card and an audio library, which seems to work out quiet well actually. Now, when you say: "but now you're off to square one, because you still have an ATMEGA used specially for playing sound.", you' re right. But this time I can use I2C to trigger all kinds of things. So that's perfect for my own shield AND I probably can combine the code with the one I made for the CastDuino OUTPUT, which would be nice, because ... after all, it is ... output.
 
Sometimes you just can't do without some theory. When I wanted to know, why I would need a capacitor and resistors before connecting speakers to an Arduino, I had to do some reading myself. Finally I did understand why (took me some time to find a site explaining simply and correct, what is happening when you connect speakers. I'll try to do the same, short and simple.

When you connect a device to your Arduino, like a speaker you create a short (well sort of). When you use a wire, you'll get sparks and probably surely damage the board. Why is that? If you look at Ohm's law, you'll understand:

I = V/R or amps = volts/ohms

Now when your ohms become 0, well your amps become indefinitely high, meaning *explosion* . When you keep that in mind and you know speakers come in 2,4 or 8 ohms of resistance, you'll surly understand that if your Arduino can only handle a max of 40 mA on every pin, this means 0,040 A = 3,3V/ohms or 3.3V/ 0,040 = 82 ohm.
But if your speaker is only 2 ohms or 3,3V / 2 ohms = 1,65 A which is way to high even 8 ohms gives you 0,410 A or 410 mA. Ten times what your Arduino can stand. The solution? add more resistance in series with the speaker, like a 100 ohm resistor => 3,3V / (100 + 2) ohm = 0,032 A or 32mA and that is perfect.





HARDWARE REQUIRED


  • BareBone Arduino + 1 extra wire: VCC to AVCC, but you could just use an Ethernet Arduino (don't forget the wiring for the line out) and use the library
  • 3,3 V power supply !!! DO NOT CONNECT THIS TO 5V !!!
  • SD to micro-SD adapter
  • strip of 7 bend or straight male headers
  • micro-SD card fully formatted FAT16
  • Simple SD audio library 



CIRCUIT OR SCHEMATIC


text
image developed using Fritzing. For more circuit examples, see the Fritzing project page
text

PICTURES









VIDEO








LINKS


text


CHANGELOG


V


FILES TO DOWNLOAD


The library and examples aren't mine, you can download everything from: SimpleSDAudio