DFplayer mini not playing any sound issue

@thomor - I followed this YouTube channel exactly and it worked without any Arduino!

I also used this online audio converter site to convert my audio/mp3 file to 128kbps

https://online-audio-converter.com/

Here is a sample mp3... it has a .txt extension so I could upload it, you must rename it .mp3
0001.mp3.txt (3.2 MB)

Why my second audio wont play in this code, can anyone help me to fix this.

#include <Stepper.h>
#include <Servo.h>
#include <SoftwareSerial.h>
#include "DFRobotDFPlayerMini.h"
#include "VoiceRecognitionV3.h"

SoftwareSerial mySoftwareSerial(8, 9); // RX, TX for DFPlayer
VR myVR(2, 3); // RX, TX for Voice Recognition

uint8_t buf[128]; // Increased buffer size for Voice Recognition
const int stepsPerRevolution = 32;
const int buzzerPin = 11;
const int irSensorPin = A0;
const int servoPin = 12;

Servo servo;
int servoAngle = 0;

Stepper myStepper1(stepsPerRevolution, 4, 6, 5, 7);
DFRobotDFPlayerMini myDFPlayer;

#define NeozepRecord (0)

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

  // Initialize DFPlayer Mini
  if (!myDFPlayer.begin(mySoftwareSerial, true, false)) {
    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);
  }
  Serial.println(F("DFPlayer Mini online."));
  myDFPlayer.volume(30); // Set volume

  // Initialize Voice Recognition Module
  Serial.println("Elechouse Voice Recognition V3 Module\\Control LED sample");
  if (myVR.clear() == 0) {
    Serial.println("Recognizer cleared.");
  } else {
    Serial.println("Voice Recognition Module not found.");
    Serial.println("Please check the connection and restart Arduino.");
    while (1);
  }
  if (myVR.load((uint8_t)NeozepRecord) >= 0) {
    Serial.println("NeozepRecord loaded");
  }

  // Setup pins
  pinMode(irSensorPin, INPUT);
  pinMode(buzzerPin, OUTPUT);
  pinMode(servoPin, OUTPUT);
  servo.attach(servoPin);
  myStepper1.setSpeed(900);
  myStepper1.step(0);
}

void loop() {
  int ret = myVR.recognize(buf, 75); // Adjust recognition threshold
  Serial.print("Voice Recognition Result: ");
  Serial.println(ret);

  if (ret > 0) {
    switch (buf[1]) {
      case NeozepRecord:
        // Actions for recognized voice command
        myDFPlayer.play(3); // Play the first MP3 file
        myStepper1.setSpeed(900);
        myStepper1.step(1024); // Rotate Stepper
        delay(500);
        myStepper1.step(-1024); // Rotate back

        int sensorStatus = digitalRead(irSensorPin);
        if (sensorStatus == LOW) {
          digitalWrite(buzzerPin, HIGH);
          delay(1000); // Buzzer sound
          digitalWrite(buzzerPin, LOW);
          servo.write(180); // Rotate Servo
          delay(200);
          servo.write(0); // Rotate back
          delay(100);
          myDFPlayer.play(4); // Play the fourth MP3 file
        }
        break;
    }
  }
}

Does your second audio play with the standalone configuration? (Post #42 - The Answer!)

Yes it plays

Okay... can you get a list of the filenames used? explorer... right-click... terminal... dir > files.txt then copy and upload the content

Also, check each file on this web site and verify128kbps or less.

https://online-audio-converter.com/

Here is my Explorer >> SD >> file >> 005.mp3 >> right-click >> properties >> details... showing the bitrate of one sound file.

Here is my "directory" (dir >> file.txt) from Terminal opened on my SD card:

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

PS D:\> dir > file.txt
PS D:\> dir

    Directory: D:\

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----         2/19/2024  10:21 AM        8326890 0001.mp3
-a----         2/23/2024   1:12 AM        3826553 0002.mp3
-a----         2/23/2024   5:21 PM          34107 0003.mp3
-a----         2/23/2024   5:25 PM        3482717 0004.mp3
-a----         2/23/2024   8:25 PM          73486 0005.mp3
-a----         2/24/2024  12:57 PM           2002 file.txt

PS D:\>

The listing shows have three songs (long files) and two sounds (short files). When I select "next" (by grounding the "next" pin) the next file plays and wraps again to the top after the last file.

The second file may not necessarily be at the second index of the files list. The DFPlayer injects hidden files on the SD card that may be causing your audio files to not be in the correct location.

If you run the AdvanceSettings example sketch, it will try to play all the audio tracks you have on the SD card. Do they play in the order you are expecting or are they scattered?

Still not working, I think the problem is my code can you check it for me?

Adi po amon code.

#include <Stepper.h>
#include <Servo.h>
#include <SoftwareSerial.h>
#include "DFRobotDFPlayerMini.h"
#include "VoiceRecognitionV3.h"

SoftwareSerial mySoftwareSerial(8, 9); // RX, TX for DFPlayer
VR myVR(2, 3); // RX, TX for Voice Recognition

uint8_t buf[128]; // Increased buffer size for Voice Recognition
const int stepsPerRevolution = 32;
const int buzzerPin = 11;
const int irSensorPin = A0;
const int servoPin = 12;

Servo servo;
int servoAngle = 0;

Stepper myStepper1(stepsPerRevolution, 4, 6, 5, 7);
DFRobotDFPlayerMini myDFPlayer;

#define NeozepRecord (0)

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

  // Initialize DFPlayer Mini
  if (!myDFPlayer.begin(mySoftwareSerial, true, false)) {
    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);
  }
  Serial.println(F("DFPlayer Mini online."));
  myDFPlayer.volume(30); // Set volume

  // Initialize Voice Recognition Module
  Serial.println("Elechouse Voice Recognition V3 Module\\Control LED sample");
  if (myVR.clear() == 0) {
    Serial.println("Recognizer cleared.");
  } else {
    Serial.println("Voice Recognition Module not found.");
    Serial.println("Please check the connection and restart Arduino.");
    while (1);
  }
  if (myVR.load((uint8_t)NeozepRecord) >= 0) {
    Serial.println("NeozepRecord loaded");
  }

  // Setup pins
  pinMode(irSensorPin, INPUT);
  pinMode(buzzerPin, OUTPUT);
  pinMode(servoPin, OUTPUT);
  servo.attach(servoPin);
  myStepper1.setSpeed(900);
  myStepper1.step(0);
}

void loop() {
  int ret = myVR.recognize(buf, 75); // Adjust recognition threshold
  Serial.print("Voice Recognition Result: ");
  Serial.println(ret);

  if (ret > 0) {
    switch (buf[1]) {
      case NeozepRecord:
        // Actions for recognized voice command
        myDFPlayer.play(3); // Play the first MP3 file
        myStepper1.setSpeed(900);
        myStepper1.step(1024); // Rotate Stepper
        delay(500);
        myStepper1.step(-1024); // Rotate back

        int sensorStatus = digitalRead(irSensorPin);
        if (sensorStatus == LOW) {
          digitalWrite(buzzerPin, HIGH);
          delay(1000); // Buzzer sound
          digitalWrite(buzzerPin, LOW);
          servo.write(180); // Rotate Servo
          delay(200);
          servo.write(0); // Rotate back
          delay(100);
          myDFPlayer.play(4); // Play the fourth MP3 file
        }
        break;
    }
  }
}

You do not need code to make the DFPlayerMini work. If you do not follow the instructions in post #46, or if you do follow the instructions in post #46 and get no sound, then all the code in the world will not help.

Post #46. Post #46. There. Three times. The rest is in your hands.

How to fix the problem with the dfplayer mini,, when I want to play two different audio in different condition, the first auido is playing but when it comes to second audio it is not playing, in serial monitor it says that the second audio is playing but no audio is playing.

Hello,

the issue is that your red wire is a bit loose and there is a memory overflow on line 42 in your code..

I'm not 100% sure this is the issue, that's only a guess because my crystal ball is still in the dishwasher

joke aside, do yourself a favour and please read How to get the best out of this forum and post accordingly (including code with code tags and necessary documentation for your ask like your exact circuit and power supply, links to components etc).

@thomor ,

Your two or more topics on the same or similar subject have been merged.

Please do not duplicate your questions as doing so wastes the time and effort of the volunteers trying to help you as they are then answering the same thing in different places.

Please create one topic only for your question and choose the forum category carefully. If you have multiple questions about the same project then please ask your questions in the one topic as the answers to one question provide useful context for the others, and also you won’t have to keep explaining your project repeatedly.

Repeated duplicate posting could result in a temporary or permanent ban from the forum.

Could you take a few moments to Learn How To Use The Forum

It will help you get the best out of the forum in the future.

Thank you.

See post #49.

Still not playing the second audio

Still not playing the second audio after I followed the steps in post #46

Please, show the bit rate of second audio?

Also, show the "directory" (%dir) of the SD card to see the file names.

How can I see the directory (%dir) of my sd card?

  1. Insert SD card
  2. Open File Explorer
  3. Left-click on SD card
  4. Inside right panel, Right-click >> Open in Terminal
    You will be in a Terminal/Command Line.
  5. dir<CR>

This is a really good parallel example why you need a drivers license to drive a car supported by basic automobile maintenance.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.