Go Down

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

Hachey

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.

https://www.geeetech.com/wiki/index.php/Arduino_MP3_shield_board_with_TF_card
FROM UNO shield

   NANO
   UNO   ESP32
5V
GND
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
https://github.com/espressif/arduino-esp32

You can test SDCard function separately using
Examples for ESP32 Dev Module
SD(ESP32)

You can define which CS pin is for the SDCard
Make these changes in the code
E.G.

Code: [Select]

#define CSpin 14  //CS

    //if(!SD.begin())
    if(!SD.begin(CSpin))




Make sure to have installed his library in Arduino IDE
https://github.com/adafruit/Adafruit_VS1053_Library

Examples
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...

...later...

Here's some fix for interrupt issue with ESP32
This particular one does get the musicPlayer.startPlayingFile() to work, but mangles the sound.
https://github.com/eziya/ESP32_ADAFRUIT_VS1053

This one does the trick nicely.

https://github.com/danclarke/Adafruit_VS1053_Library
Changes are in this file
https://github.com/danclarke/Adafruit_VS1053_Library/blob/master/Adafruit_VS1053.cpp

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