The Adafruit Music Maker Shield (no Amp) is a versatile audio playback module designed for use with the Arduino platform. This shield allows users to play back audio files in the WAV format from a microSD card, making it an ideal component for projects that require high-quality sound output, such as DIY music players, sound effect boards, or interactive art installations.
Pin Number | Function | Description |
---|---|---|
D9 | Reset | Resets the VS1053 chip |
D10 | CS (Chip Select) | SPI chip select for the VS1053 chip |
D11 | MOSI | SPI Master Out Slave In for SD and VS1053 |
D12 | MISO | SPI Master In Slave Out for SD and VS1053 |
D13 | SCK | SPI Clock for SD and VS1053 |
D4 | Card CS | SPI chip select for the microSD card |
#include <SPI.h>
#include <SD.h>
#include <Adafruit_VS1053.h>
// Define the pins used
#define BREAKOUT_RESET 9 // VS1053 reset pin (output)
#define BREAKOUT_CS 10 // VS1053 chip select pin (output)
#define BREAKOUT_DCS 8 // VS1053 Data/command select pin (output)
#define CARDCS 4 // Card chip select pin
#define DREQ 3 // VS1053 Data request, ideally an Interrupt pin
Adafruit_VS1053_FilePlayer musicPlayer =
Adafruit_VS1053_FilePlayer(BREAKOUT_RESET, BREAKOUT_CS, BREAKOUT_DCS, DREQ, CARDCS);
void setup() {
Serial.begin(9600);
if (!musicPlayer.begin()) { // Initialise the music player
Serial.println(F("Couldn't find VS1053, do you have the right pins defined?"));
while (1);
}
Serial.println(F("VS1053 found"));
if (!SD.begin(CARDCS)) {
Serial.println(F("SD failed, or not present"));
while (1); // Don't do anything more if there is no SD card
}
// Set volume for left, right channels. lower numbers == louder volume!
musicPlayer.setVolume(20, 20);
// Play one file, don't return until complete
Serial.println(F("Playing track 001"));
musicPlayer.playFullFile("/track001.wav");
}
void loop() {
// Use the musicPlayer object to control playback
}
Q: Can I play MP3 files with this shield? A: Yes, the shield can play MP3 files, but this documentation focuses on WAV playback.
Q: How do I control the playback of multiple files? A: You can use the functions provided by the Adafruit_VS1053 library to play, pause, and stop tracks, as well as navigate through multiple files on the SD card.
Q: What is the maximum size of the SD card that can be used? A: The shield typically supports standard SD card sizes up to 32GB, but it's best to check the latest specifications and library updates for any changes.