I have here detailed how to get VS1053 MP3 player to work with ESP32.
Hopefully to save others some of the time it has taken me to learn the dos and don’ts.
CS D9 D14 For the SDCard This can be a different pin
MISO D12 D19 Standard SPI pin
MOSI D11 D23 Standard SPI pin
SCK D13 D18 Standard SPI pin
XCS D6 D5 For the shield
XReset Rst EN/Rst (Doesn’t seem essential to connect this. Pin 3 may be the one on my board??)
XDCS D7 D33
DREQ D2 D35
Make sure to have installed this library in Arduino IDE
You can test SDCard function separately using
Examples for ESP32 Dev Module
You can define which CS pin is for the SDCard
Make these changes in the code
#define CSpin 14 //CS //if(!SD.begin()) if(!SD.begin(CSpin))
Make sure to have installed his library in Arduino IDE
Adafruit VS1053 Library/player_simple
Set the pins for the ESP32
//#define SHIELD_RESET -1 // VS1053 reset pin (unused!) #define SHIELD_RESET 3 // VS1053 reset pin (unused!) #define SHIELD_CS 5 // VS1053 chip select pin (output) #define SHIELD_DCS 33 // VS1053 Data/command select pin (output) // These are common pins between breakout and shield #define CARDCS 14 // Card chip select pin // DREQ should be an Int pin, see http://arduino.cc/en/Reference/attachInterrupt #define DREQ 35
//musicPlayer.useInterrupt(VS1053_FILEPLAYER_PIN_INT); // DREQ int
It caused the ESP32 to reboot when it tried to play track.
Will investigate later…
Here’s some fix for interrupt issue with ESP32
This particular one does get the musicPlayer.startPlayingFile() to work, but mangles the sound.
This one does the trick nicely.
Changes are in this file
Add this in the .ino sketch
#define ESP32 1
Didn’t need to comment out
musicPlayer.useInterrupt(VS1053_FILEPLAYER_PIN_INT); // DREQ int