Go Down

Topic: How to setup VS1053 with ESP32 and Adafruit VS1053 Library and pin connections (Read 924 times) previous topic - next topic


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.

FROM UNO shield

   UNO   ESP32
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

Code: [Select]

#define CSpin 14  //CS


Make sure to have installed his library in Arduino IDE

Adafruit VS1053 Library/player_simple

Set the pins for the ESP32
Code: [Select]

//#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

Comment out:-
Code: [Select]

 //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

Go Up