Need help with DF Player Mini (MP3 Player) using Argon

Hey everyone, first time posting here. I’ve been struggling to get sound out of the speakers using an Argon connected to a DF Player mini.

I tried setting it up following this post, where it seems to be pretty straightforward, but I haven’t had any luck.

Below is a diagram of my setup. The only difference is that I’m using an Argon instead of the pictured Arduino controller and using 3.3V instead of 5V to power the MP3 player.

I tried the code shared in the link above, but didn’t work. Since then I’ve moved on to using the DFRobotDFPlayerMini library for Particle, but still no dice; I get the “Unable to begin… please insert SD card message”. I’ve also tried the DFPlayer Particle library, but still nothing.

Also, as soon as the Argon gets power, the speaker (connected to the MP3 player) continuously makes a crackling sound; not sure why.

DFRobotDFPlayerMini Code

#include "DFRobotDFPlayerMini.h"

DFRobotDFPlayerMini myDFPlayer;
void printDetail(uint8_t type, int value);

void setup()
{
  Serial1.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(Serial1)) {  //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);
  }
  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.
  }
}

DFPlayer Code


#include "DFPlayer.h"

DFPlayer dfPlayer;

int folder = 0;
int volume = 20;

void setup()
{
    Serial.begin(115200);
    Serial1.begin(9600);
    delay(5000);

    // the following command tells the program to display data on the serial console.
    // logging can be turned on and off at will throughout the user's code
    dfPlayer.setLogging(true);

    dfPlayer.setVolume(volume);
}

void loop()
{
    playMusic();
}

int playMusic()
{

    // the following commands play 6 tracks that were stored in the root folder of the TFCard
    // the dfPlayer.playTrack method uses DFPlayer command 0x03
    // The tracks were named 001 - 006.
    // The tracks were added to the TFCard in the following sequence 001, 002, 003, 005, 004, and 006
    // This code plays the tracks in order 001 - 006
    delay(3000);
    dfPlayer.playTrack(1);
    delay(3000);
    dfPlayer.playTrack(2);
    delay(3000);
    dfPlayer.playTrack(3);
    delay(3000);
    dfPlayer.playTrack(4);

    return 0;
}

SD Card Contents

I also tried all kinds of folder structures just to see if anything would work.

Root

root

Inside folder

Similar contents to root without the folders. Can’t share screenshot since new users are limited to 2 per post.

Hardware Components

Any ideas on what I might be doing wrong? Any help is greatly appreciated!

Thanks,
Henry

I have just tested this on a Boron and it works as expected

#include "DFPlayer.h"

DFPlayer dfPlayer;

void setup() {
    Particle.function("play", play);

    Serial.begin(115200);
    Serial1.begin(9600);

    //dfPlayer.setLogging(true);
}

int play(const char* arg) {
  int folder = -1;
  int track = -1;

  if (2 == sscanf(arg, "%d:%d", &folder, &track)) { 
    if (folder > 0) {
      Serial.printlnf("Playing track %03d in folder %02d", track, folder);
      dfPlayer.playFolderTrack(folder, track);
    }
    else {
      Serial.printlnf("Playing track %04d from root", track);
      dfPlayer.playTrack(track);
    }
  }
  else 
    Serial.printlnf("Arguments should be 00:0000 (folder:track) - given %02d:%04d", folder, track);
  
  return folder*10000 + track;
}
1 Like

Thanks for the reply. Unfortunately, I’m still getting the same result: just a bunch of noise always coming from the speaking. Do you mind sharing your hardware setup and SD card contents? It might be something with my hardware setup.

I’m using a dfplayer mini with a xenon (should be the same setup) I’m not using a resistor in line with the serial connections though, and my media files are not in folders on the SDcard. Everything else is identical to your setup, including using 3.3v instead of 5v.

1 Like

Does your speaker make a constant noise while connected to the DF Player?

No, mine is triggered on a certain input.

Thanks, guys! I finally got it to work! It seems to be some kind of wiring issue. I fixed the problem by simply moving the hardware to another breadboard with some different wires.

1 Like

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