Skip to content

Latest commit

 

History

History

WavePlayer

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

#574 MicroSD WAV Player

A basic demonstration of playing a sound file (WAV) from an SD card with an Arduino.

Build

Here's a quick demo..

clip

Notes

Microcontrollers generally have very limited memory, so playing audio samples of any complexity usually requires external storage. An SD card is a convenient option, as it can easily be prepared on most computers.

This is a quick test of an SD card reader with an Arduino to play an audio file from the SD card.

MicroSD Card Module

I'm using one of the very common Micro SD card reader modules from an aliexpress seller.

The module uses SPI, and includes level shifting and regulation so that it is 5V tolerant.

FeatureMinNominalMaxUnit
Supply Voltage4.555.5V
Current0.280200mA
Supported cardsMicroSD < 2GbMicroSDHC < 32Gb

module_functionalmodule_image

Construction

I'm just using a pieze buzzer for output, without any current limiting resistor R1 (may be required depending on the piezo component). Of course, any other audio output device could be substituted here.

Breadboard

Schematic

Build

Code

The TMRpcm Library does all the heavy lifting of reading the sound file and streaming the audio output. It uses the Arduino SD Library under the covers.

I've kept the demo code in WavePlayer.ino super-simple - it just plays a single given file (SAMPLE.WAV) when the push-button is pressed.

Preparing the Audio

I'm using a short sample - included in the sample folder as an Audacity project.

The sample has been reduced to mono 16kHz, and exported to sample.wav as an unsigned 8-bit PCM file. This file is then written to the SD card.

audacity_export

Credits and References

close