Go Down

Topic: Arduino Speaker - how to do it? (Read 8988 times) previous topic - next topic

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

robtillaart

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

Quote
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.
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

mowcius

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

mowcius

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

Grumpy_Mike

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

WilliamK Govinda

Gesh, I just created a 6 voice Drum-Machine using the Arduino 2009 (ATmega328) ;-)

Check this out:

http://www.arduino.cc/playground/Code/PCMAudio

For 8khz it will do just fine for your project.

Wk

Go Up