Arduino uno and dfplayer mini dosnt work

hi guys i have a dfplayer mini and an arduino uno i connected dfplayer mini to arduino with this pins

DFPlayer Arduino
VCC 5V
GND GND
TX Pin 10
RX Pin 11 (through 1k resistor recommended)
DFPlayer Speaker
--- ---
SPK1 Speaker +
SPK2 Speaker -

and i have connected arduino over usb connection to my pc and upload this code

#include "SoftwareSerial.h" #include "DFRobotDFPlayerMini.h"

SoftwareSerial mySoftwareSerial(10, 11); // RX, TX
DFRobotDFPlayerMini myDFPlayer;

void setup() {
mySoftwareSerial.begin(9600);
Serial.begin(9600);

if (!myDFPlayer.begin(mySoftwareSerial)) {
Serial.println("DFPlayer not detected!");
while(true);
}

Serial.println("DFPlayer ready!");

myDFPlayer.volume(20); // Volume: 0 to 30
myDFPlayer.play(1); // Plays 0001.mp3
}

void loop() {
}

its showing DFPlayer ready! and detect sdcard but dosnt play anything

Is there anything playable on the SD card? Follow DFPlayer wiki for that.

What size is the SD card?
All audio files should be in the root directory of the SD card.

Format your cose and paste it in a code block...

Your topic has been moved. Please do not post in "Uncategorized"; see the sticky topics in Uncategorized - Arduino Forum.

Your sketch failed here too. How exactly did you include the DFR library? When I replaced your

#include "DFRobotDFPlayerMini.h"

using Sketch > Include library > DFRobotDFPlayerMini

it worked OK.

I prefer angle brackets, not quotes, like this,

#include <DFRobotDFPlayerMini.h>

because it confines the compilation search to my \libraries folder.

If that doesn't fix it, check your wiring again and connect a jumper wire to the IO2 pin of the module (pin 11) and briefly touch it to ground. Assuming you do have more than one file on your mSD, that should play the next one with each touch, proving your module is working.

i have a file named 0001.wav in root of sd card and sd card capacity is 8 giga byte
on my dfplayer printed dfplayer mini - hw-267A and v0.5.1
i have changed
"DFRobotDFPlayerMini.h"
with
<DFRobotDFPlayerMini.h>
it dosnt work
also any leds in dfplayer mini is not on
could problem from dfplayer or power ?

#include "Arduino.h"
#include "SoftwareSerial.h"
#include "DFRobotDFPlayerMini.h"

SoftwareSerial mySoftwareSerial(10, 11); // RX, TX
DFRobotDFPlayerMini myDFPlayer;
void printDetail(uint8_t type, int value);

void setup()
{
  mySoftwareSerial.begin(9600);
  Serial.begin(9600);
  
  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!"));
    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
}

void loop()
{
  static unsigned long timer = millis();
  
  if (millis() - timer > 3000) {
    timer = millis();
    myDFPlayer.next();  //Play next mp3 every 3 second.
  }
  
  if (myDFPlayer.available()) {
    printDetail(myDFPlayer.readType(), myDFPlayer.read()); //Print the detail message from DFPlayer to handle different errors and states.
  }
}

void printDetail(uint8_t type, int value){
  switch (type) {
    case TimeOut:
      Serial.println(F("Time Out!"));
      break;
    case WrongStack:
      Serial.println(F("Stack Wrong!"));
      break;
    case DFPlayerCardInserted:
      Serial.println(F("Card Inserted!"));
      break;
    case DFPlayerCardRemoved:
      Serial.println(F("Card Removed!"));
      break;
    case DFPlayerCardOnline:
      Serial.println(F("Card Online!"));
      break;
    case DFPlayerUSBInserted:
      Serial.println("USB Inserted!");
      break;
    case DFPlayerUSBRemoved:
      Serial.println("USB Removed!");
      break;
    case DFPlayerPlayFinished:
      Serial.print(F("Number:"));
      Serial.print(value);
      Serial.println(F(" Play Finished!"));
      break;
    case DFPlayerError:
      Serial.print(F("DFPlayerError:"));
      switch (value) {
        case Busy:
          Serial.println(F("Card not found"));
          break;
        case Sleeping:
          Serial.println(F("Sleeping"));
          break;
        case SerialWrongStack:
          Serial.println(F("Get Wrong Stack"));
          break;
        case CheckSumNotMatch:
          Serial.println(F("Check Sum Not Match"));
          break;
        case FileIndexOut:
          Serial.println(F("File Index Out of Bound"));
          break;
        case FileMismatch:
          Serial.println(F("Cannot Find File"));
          break;
        case Advertise:
          Serial.println(F("In Advertise"));
          break;
        default:Serial.println(value);
          break;
      }
      break;
    default:Serial.println((value));
      break;
  }
  
}

this return error 126
DFRobot DFPlayer Mini Demo

Initializing DFPlayer ... (May take 3~5 seconds)

DFPlayer Mini online.

Time Out!

DFPlayerError:126

Did you test your player as I suggested?

Does your .wav file play OK in other player apps?

Is this your first Arduino sketch? Or first with the player module?

Your latest sketch compiles and runs OK here on my Uno.

yes of course i did exactly what u said
a weird thing is led on dfplayer module dont turn on at all
could this module damaged ?

You didn't tell us what happened?

You haven't replied.

You haven't replied.

there is only one file named 0001.wav in root of sdcard and its playing normally without problem in windows player , yes this is my first time with this dfplayer module

You make it hard to help you. Once again:

"Did you test your player as I suggested?

You didn't tell us what happened?

I'm guessing (but should not have to) that there was no play?

And re "...a weird thing is led on dfplayer module dont turn on at all could this module damaged ?"
my answer is yes.

the answer of this question
Did you test your player as I suggested?
yes i tested it as u said
nothing have changed same error
error 126

Verify your library is updated (some have learned how to stop automatic updates and forget to turn it back on).

What the library says about 126 (0x7e) in file DFRobotDFPlayerMini.cpp:

bool DFRobotDFPlayerMini::available(){
  while (_serial->available()) {
    delay(0);
    if (_receivedIndex == 0) {
      _received[Stack_Header] = _serial->read();
#ifdef _DEBUG
      Serial.print(F("received:"));
      Serial.print(_received[_receivedIndex],HEX);
      Serial.print(F(" "));
#endif
      if (_received[Stack_Header] == 0x7E) {
        _receivedIndex ++;
      }
    }
    else{
      _received[_receivedIndex] = _serial->read();
#ifdef _DEBUG
      Serial.print(_received[_receivedIndex],HEX);
      Serial.print(F(" "));
#endif
      switch (_receivedIndex) {
        case Stack_Version:
          if (_received[_receivedIndex] != 0xFF) {
            return handleError(WrongStack);
          }
          break;
        case Stack_Length:
          if (_received[_receivedIndex] != 0x06) {
            return handleError(WrongStack);
          }
          break;
        case Stack_End:
#ifdef _DEBUG
          Serial.println();
#endif
          if (_received[_receivedIndex] != 0xEF) {
            return handleError(WrongStack);
          }
          else{
            if (validateStack()) {
              _receivedIndex = 0;
              parseStack();
              return _isAvailable;
            }
            else{
              return handleError(WrongStack);
            }
          }
          break;
        default:
          break;
      }
      _receivedIndex++;
    }
  }
  
  
  return _isAvailable;
}

Maybe you can get more information if you find your DFRobotDFPlayerMini.h file, line 36, and un-comment this:

//#define _DEBUG

One last time: what happened when you did the test taking IO2 briefly low that I described?

Hello. Did you ever figure out what was happening with your DF Player

Minis? I ask because I’ve been using them for years, probably used 20 of them without a hitch, however I just recently bought a new bunch, and these ones do not work for me.