ArduinoGeneral

DFPlayer mini & Adafruit Feather 32u4 Fona

userHead lecalvez 2019-05-02 23:02:48 2053 Views1 Replies
Hello !

I'm using the Adafruit Feather Fona to send information through mobile network, and I would like to add an audio module to send sounds as responses to the user.
I use the DFPlayer mini module (https://wiki.dfrobot.com/DFPlayer_Mini_SKU_DFR0299) + one 1W speaker.
I did the wiring as explained on the website to try to make the getting started example works.
My wiring :
- the VCC pin on my 3.7V battery
- the two GND pins on the battery GND
- the 2 speaker's wires on both SPK_1 and SPK_2 (I tried to put on SPK_1 and GND and I had the same problem)

With this configuration, the module plays the 2 sounds on y SD Card when I put the IO_1 to the GND.

Then, I tried to plug it on my Feather Fona, with the Rx and Tx pins :
- Rx on the A4 pin with a 1K resistor.
- Tx on the A5 pin with a 1K resistor.

(I also tried to put Tx and Rx on different pins like 9 and 10, A3 and 10, A3 and A4).

I try to run the example program coming with the library. I setup mySerial like this :
Code: Select all
// ...
SoftwareSerial mySoftwareSerial(A4, A5); // RX, TX
DFRobotDFPlayerMini myDFPlayer;
void printDetail(uint8_t type, int value);

void setup()
{
  mySoftwareSerial.begin(9600);
  Serial.begin(115200);
  
  Serial.println();
  Serial.println(F("DFRobot DFPlayer Mini Demo"));
  Serial.println(F("Initializing DFPlayer ... (May take 3~5 seconds)"));
  
  if (!myDFPlayer.begin(mySoftwareSerial)) {  //Use softwareSerial to communicate with mp3.
    Serial.println(F("Unable to begin:"));
    Serial.println(F("1.Please recheck the connection!"));
    Serial.println(F("2.Please insert the SD card!"));
    Serial.println(myDFPlayer.begin(mySoftwareSerial));
    while(true){
      delay(0); // Code to compatible with ESP8266 watch dog.
    }
  }
  Serial.println(F("DFPlayer Mini online."));
  
  myDFPlayer.volume(10);  //Set volume value. From 0 to 30
  myDFPlayer.play(1);  //Play the first mp3
}
// ...
When I run the example program, it fails at the beginning saying :
Unable to begin:
1.Please recheck the connection!
2.Please insert the SD card!

When i print the return of myDFPlayer.begin, I always get 0.

I don't think it's the SD Card because it works when i use the IO pin, and I checked the Rx and Tx wiring, by measuring. I don't know where to look at right now !

Thnaks in advance!
2019-05-03 01:25:20 ok, after several tests, I realized that I had two problems :
1. The Ax pins does not work with this module, so i tried again on the 10 and 11 pins and it work, as well as the 6.
2. My SoftwareSerial config was wrong : I had to invert Rx and Tx pin number in the config. So : if you wire the Rx pin to the module to the pin 10, and you wire the Tx pin to the pin 11, your config should look like : SoftwareSerial mySoftwareSerial(11, 10);

With this in mind, I can have it working ! :)
userHeadPic lecalvez