The Adafruit Music Maker Shield with Amp is an Arduino-compatible shield designed to facilitate high-quality audio playback through a built-in audio amplifier. It is capable of playing a variety of audio formats from an SD card, making it ideal for creating custom audio projects such as musical instruments, sound effects boards, or MP3 players.
Pin Number | Function | Description |
---|---|---|
D9 | Amplifier Shutdown | Controls the amplifier's power state |
D10 | SD Chip Select | Selects the SD card for SPI communication |
D11 | MOSI | Master Out Slave In for SPI communication |
D12 | MISO | Master In Slave Out for SPI communication |
D13 | SCK | Serial Clock for SPI communication |
A0 | Volume Up | Increases volume when connected to a button |
A1 | Volume Down | Decreases volume when connected to a button |
A2-A5 | Optional Buttons | Can be used for additional controls like track change |
#include <SPI.h>
#include <SD.h>
#include <Adafruit_VS1053.h>
// Define the pins used
#define BREAKOUT_RESET -1 // VS1053 reset pin (unused!)
#define BREAKOUT_CS 10 // VS1053 chip select pin (output)
#define BREAKOUT_DCS 9 // 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.mp3");
}
void loop() {
// File playback in the loop can be controlled here.
}
Q: Can I play music from a streaming service with this shield?
Q: What is the maximum size of SD card supported?
Q: Can I use this shield with other microcontrollers besides Arduino?