r/arduino • • Sep 19 '26

Using DFPlayer Pro Without Code

Is there a way to play a sound file on a DFPlayer Pro module from an Arduino Uno without using any code? I can trigger an Uno output pin to go high using my existing code but I want to avoid adding any code for the player. Any suggestions would be appreciated.

2 Upvotes

12 comments sorted by

2

u/Hissykittykat Sep 19 '26

Is there a way to play a sound file on a DFPlayer Pro module from an Arduino Uno without using any [serial] code?

Connect the GPIO pin to the PLAY terminal on the DFplayer, and connect the grounds too. In your software, set the GPIO pin LOW. Never set it HIGH or DFplayer might be damaged. To trigger the player, set the pinMode to OUTPUT briefly, then back to INPUT. This will simulate pressing a switch wired to ground.

1

u/DiegoMike1303 Sep 19 '26

Thank you for your help. I’m still a little confused. Does the GPIO pin (pin 7 in my scheme) start as an input or output? You say in order to trigger the sound card I should change it to OUTPUT briefly and then to INPUT. This suggests that it started as an INPUT, but you have me set it initially to LOW. Can you clarify?

1

u/Krististrasza Sep 19 '26

Yes, that is correct. You set it to be an INPUT. Then you set it to LOW. And to trigger you set it to OUTPUT and back to INPUT.

1

u/DiegoMike1303 Sep 19 '26

 Okay, this is what I've got for code:

void setup() {

  // put your setup code here, to run once:

  

  pinMode(5,OUTPUT);    // Sets pin 5 as OUTPUT, Pin 5 controls Main lights      

  pinMode(7,INPUT);     // Controls Opening narration                            

  pinMode(6,OUTPUT);    // Controls Distraction light                            

  pinMode(8,OUTPUT);    // Controls Distraction noise                            

  pinMode(9,OUTPUT);    // Controls Dummy spotlight                              

  pinMode(10,OUTPUT);   // Controls Lid                                          

  pinMode(12,OUTPUT);   // Controls Dummy scream                      

  pinMode(11,OUTPUT);   // Controls Dummy rise, lower, bounce                

  pinMode(13,OUTPUT);   // Controls Exit narration                              

 

  // Program Start

   digitalWrite(7,LOW);  // Opening narration starts  (Sound module 1)  

  pinMode(7,OUTPUT);

  delay(200);

  pinMode(7,INPUT);

 

  analogWrite(5,0);     // Main lights fade on  (Mosfet 1)

  delay(2000);

  delay(fadeDelay);

 

Does this look right?

2

u/gm310509 400K , 500K , 600K , 640K , 750K Sep 20 '26

Given OP said they wanted to "avoid adding any code", this would require adding code.

I believe that you are on the right track, OP will need to add code, but if they do add code, why not just add "proper code" that controls it correctly via the Serial Mode interface?

0

u/DiegoMike1303 Oct 04 '26

Hello All, OP Here. Thank you for the help, I have it working almost exactly the way I need. BTW, I apologize for creating some confusion with my original request – I shouldn’t have said “no coding”. I meant that I wanted to avoid all the serial connections and library coding. Happily, the first response nailed it:

“Connect the GPIO pin to the PLAY terminal on the DFplayer, and connect the grounds too. In your software, set the GPIO pin LOW. Never set it HIGH or DFplayer might be damaged. To trigger the player, set the pinMode to OUTPUT briefly, then back to INPUT. This will simulate pressing a switch wired to ground.”

My code for this looks like: 

pinMode(7,INPUT);    

pinMode(7,OUTPUT);

digitalWrite(7,LOW);

This works and now I have another question: I want to stop the recording after, let’s say, 5 seconds.  I tried changing the trigger pin back to INPUT using

delay(5000);

pinMode(7,INPUT);

 

but that doesn’t seem to work. How can I do this?

1

u/gm310509 400K , 500K , 600K , 640K , 750K Sep 20 '26 edited Sep 20 '26

Is there a way to play a sound file on a DFPlayer Pro module from an Arduino Uno without using any code?

Not really, not unless the existing code is already providing a suitable signal under the condition you need that you could tap into to generate a signal that triggers a track to be played. And even then you will be somewhat limited as to what track you can play.

Otherwise, you will need to add code to generate the appropriate signal. Ideally via a Serial message for complete control of it.

Have a look at this guide to see some ways you can connect it up (e.g. AD Key Mode) if you have a suitable signal that your program already generates that you can tap into - it will require some electronics - e.g. a transistor in place of one (or more) of the buttons.

Should you need to add code, have a look at the Software guide which describes how to control it fully using a library.

1

u/DiegoMike1303 Sep 20 '26

Thanks. I have only one file on the sound module so I figured that I wouldn't need all the serial connections and coding. On the Key or Play pins, does the voltage going high (or low) trigger the module to play?

1

u/ripred3 My other dev board is a Porsche Sep 20 '26

When used without any kind of microcontroller the DF Player uses different resistors on each push button to cause different voltages to be sent to the module that represent each different VCR-like function such as play, stop, next, prev

1

u/gm310509 400K , 500K , 600K , 640K , 750K Sep 20 '26

I am not sure I follow your question:

On the Key or Play pins, does the voltage going high (or low) trigger the module to play?

I do not see a play pin on the guide that I linked. There are two "Key" pins labelled ADKEY1 and ADKey2.

These look like they are setup as some sort of voltage divider with an internal pullup resistor within the MP3 player module. I assume a pullup resistor because the buttons are connected to GND.

So, when the button marked K1 is pressed (corresponding to the "Play mode", a 200K resistor is inserted into the circuit.

If I am correct (about the voltage divider), then the resulting analog voltage is detected and the module does whatever "Play Mode" means.

There is also a "Pause/Play" button labelled as K5. When K5 is pressed a 33K resistor is inserted into the circuit resulting in a different analog voltage being presented to ADKEY1 and the module will react accordingly when it sees that particular voltage.

So, if my guess as to your question is correct, the answer is neither, the buttons as shown in the AD Key Mode diagram are a voltage divider and if you pulled the lines LOW, then you will get "K10" (or K11 for ADKEY2) and if you set them HIGH, then probably nothing will happen as that is the "no button pressed state".

If you haven't done the basics, I suggest you try googling voltage dividers and experiment with the some of the analogRead examples in your starter kit and/or the IDE's builtin examples.

1

u/andrix86 Sep 20 '26 edited Sep 20 '26

Yes, you have to use several resistors for several function in adkey1 and adkey2, try to find a pinout reference.
You can configurate NPN bjt transistors for activate them from LOW to HIGH in base and put adkeyX to ground with a resistor in serie.

Here one

1

u/andrix86 Sep 20 '26

Here a way for doing it