The VS1053 can be configured as a simple audio player under control of the Arduino. The Arduino reads data from the on-board SD card, then plays it back through the CODEC via the SPI interface.
These steps are identical for both v1 and v2 codec breakouts, even if the boards look a little bit different
These steps are identical for both v1 and v2 codec breakouts, even if the boards look a little bit different
Prepare the breadboard
Place the VS1053 breakout on the breadboard. Center it so that there is one row of holes on each side.Add the breakout friendly headphone jack and wire power and ground jumpers as shown.
-
VCC -> 5v
- GND -> GND
Connect SPI and Reset
Add jumpers for:-
CLK -> Arduino #13 (Mega 52)
-
MISO -> Arduino #12 (Mega 50)
-
MOSI -> Arduino #11 (Mega 51)
-
CS -> Arduino #10
-
RST -> Arduino #9
Connect the rest of the digital signals
Add more jumpers for:-
XDCS-> Arduino #8
-
SDCS -> Arduino #4
-
DREQ -> Arduino #3
Connect the Headphone Jack
This step will be a little bit different depending on which version you have. If your breakout is v2 and has the round silver capacitors, add jumpers for:-
AGND -> Center 'ground' Pin
-
LOUT -> Left Pin
- ROUT -> Right Pin
If your breakout is v1, the pins will be labeled
-
GBUF -> Center 'ground' Pin
-
LOUT -> Left Pin
- ROUT -> Right Pin
Load some MP3 files
Copy 2 MP3 files to a micro SD card and name them track001.mp3 and track002.mp3 (this is just for the test, you can re-name them later). Then install the card in the slot on the VS1053 breakout.
Make sure you have a good quality SD card, some cheap SD cards won't work, causing confusion! Especially 'non-brand' knockoffs.
Simple Audio Player Sketch
Connect the Arduino to your computer with a USB cable and plug your headphones into the headphone jack. Select File->Examples->Adafruit_VS1053_Codec->player_simple to load the example code.You should hear your MP3 files in the headphones.
You can also run File->Examples->Adafruit_VS1053_Codec->player_interrupts. This example demonstrates playing files in the background using interrupts. This allows you to do other things in your sketch while the music plays!
With both examples, you can change the file names in the code to play different files - or even extend the code to search the SD card for files to play.
For the Micro:
Frank Cohen has submitted a wiring diagram for the FilePlayer example on a Micro. See his code posted here as well: http://votsh.files.wordpress.com/2014/02/vs1053-arduino-micro-connections.pdf
Note: For paying sounds in the background using interrupts, connect DREQ to pin 3 and change the code to match.
Page last edited July 21, 2013
Text editor powered by tinymce.