newbie here...working on a project with an accelerometer, which involves movement and sound. Basically I will include the arduino in a device that, when thrown up in the air, will make a sound. I think I can figure out how to get the values from the accelerometer and relate them to particular sounds in the code. My questions: HOW DO I connect the speaker (should it be a piezo speaker? what size/specifications? Can it play .wav and .mp3 files, or just a particular type of audio files?). Thanks...
An Arduino can normally only play WAV or MP3 when using additional hardware, a shield or so.
For a piezo you might start here - http://www.arduino.cc/en/Tutorial/PlayMelody
Basically I will include the arduino in a device that, when thrown up in the air, will make a sound.
Maybe add some LED's too, different colors indicating diff speeds.
Does it need to play audio or will a beep suffice?
The tone library can do a beep and it could be set to trigger based on a value from the accelerometer.
If you really need it to play audio then you will need some kind of audio board/shield.
it will play pre-recoreded human voices. I can convert the audio files to any format. I thought piezo speakers could play more than just beeps...?
I thought piezo speakers could play more than just beeps...?
Well they can but you need some kind of chip to process this audio you want it to play. Without external hardware the arduino can only really get a piezo to play beeps.
There is not enough memory in the arduino to hold any sort of sound file. So you have to have an SD card to hold the data. Also there is no digital to analogue converter on the arduino so you have to have an external one. The two extra features can be found in a wave shield which also includes an audio amplifier to drive a speaker. This is typical:- www.ladyada.net/make/waveshield
Gesh, I just created a 6 voice Drum-Machine using the Arduino 2009 (ATmega328) ;-)
Check this out:
For 8khz it will do just fine for your project.