I moved your topic to an appropriate forum category.
In the future, please take some time to pick the forum category that best suits the subject of your topic. There is an "About the _____ category" topic at the top of each category that explains its purpose.
This is an important part of responsible forum usage, as explained in the "How to get the best out of this forum" guide. The guide contains a lot of other useful information. Please read it.
Thanks in advance for your cooperation.
thanks for your response.
If I select "esp32 dev module" , after I upload a code (even an empty code) , it goes into boot loop.
When I select "nodemcu-32s" , it does not go into boot loop and functions fine.
if the correct board is what you wrote, then what's wrong with my setup ?
when I use serial2 as you wrote, it compiles well. but I don't get any sound.
DFRobotDFPlayerMini myDFPlayer;
Serial2.begin(9600, SERIAL_8N1, /*rx =*/16, /*tx =*/17);
if (!myDFPlayer.begin(Serial2, true, true)) {
Serial.println(F("Unable to begin:"));
Serial.println(F("1.Please recheck the connection!"));
Serial.println(F("2.Please insert the SD card!"));
while(true){
delay(0);
}
}
Serial.println(F("DFPlayer Mini online."));
myDFPlayer.volume(20); //Set volume value. From 0 to 30
myDFPlayer.play(1); //Play the first mp3
I used the attached diagram.
TX (gpio 17) is connected with a 1K resistor to the player.
RX (gpio 16) is directly connected to the player.
Powered directly with 5V (VCC+GND)
And the speaker is connected as in the image.
I have a Fat32 formatted SD card on it. And it has 7 short mp3 files.
Does the format or name of the mp3 file matter ?
When I remove player's power , TX or RX, I get an error. So I assume the connections are OK.
Is there a way to test the speaker ? (dfplayer command ?) When I plug power, I hear a tock sound from the speaker.
it seems like "play(1)" command does not work and the code is stuck there.
if (!myDFPlayer.begin(Serial2, true, true)) {
Serial.println(F("Unable to begin:"));
Serial.println(F("1.Please recheck the connection!"));
Serial.println(F("2.Please insert the SD card!"));
while(true){
delay(0); // Code to compatible with ESP8266 watch dog.
}
}
Serial.println(F("DFPlayer Mini online."));
myDFPlayer.volume(20);
Serial.println(F("DFPlayer Mini log 1."));
myDFPlayer.play(1); //Play the first mp3
Serial.println(F("DFPlayer Mini log 2."));
delay(1000);
Serial.println(F("DFPlayer Mini log 3."));
because with this code all I get is:
13:01:17.462 -> DFPlayer Mini online.
13:01:17.961 -> DFPlayer Mini log 1.
when I remove the esp32 module and give a direct command to the player (connect ground to IO1) , its led goes ON and sound comes from speaker.
So the speaker is working. Module is working.
But when the library is used, "play(1)" command does not work
Long shot: I eventually diagnosed some problems with the DFR player to a bug in the latest library version. Going back from 106 to 105 fixed it. Suggest you try same to eliminate that possibilty.