DFPlayer Mini Stops When LoRa data packet is received

Hi, this is my first time posting so forgive me if I miss anything. I am busy with a project where I want to control a speaker with a remote over a long distance. For the remote I am using a Arduino Nano and RFM9x LoRa Radio to send an array with a length of 2 to the "Speaker" when a button press is registered. The speaker consists of an Arduino Nano, RFM9x LoRa Radio and a DFPlayer mini. The audio out of the DFPlayer is connected to an amplifier and speaker.

I have gotten it to start playing a mp3 file from the SD card in the DFPlayer Mini. I send a data packet with length 2, that tells the DFPlayer which track number to play. It received the data packet and starts playing the song I want. After the DFplayer mini starts playing and I send another data packet the DF Player resets.
Below is an image of my "Speaker" circuit diagram.

Attached find the code that I am using

#include <RHReliableDatagram.h>
#include <RH_RF95.h>
#include <SPI.h>
#include "Arduino.h"
#include "SoftwareSerial.h"
#include "DFRobotDFPlayerMini.h"

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

#define RF95_FREQ 868.0

RH_RF95 driver;
// Class to manage message delivery and receipt, using the driver declared above
RHReliableDatagram manager(driver, SERVER_ADDRESS);

uint8_t volVal = 20;
uint8_t data[2]; //Array to store data that is sent to remote
uint8_t buf[2]; //Array to store data recieved from remote

uint8_t playFlag = 0; //used to determine if start() or pause() function is used for DFPlayer mini. 
uint8_t mp3Flag = 0; //Value of 0 if mp3 failed and value of 1 if mp3 online

void setup() 
  if (!myDFPlayer.begin(mySoftwareSerial)) {  //Use softwareSerial to communicate with mp3.
      delay(0); // Code to compatible with ESP8266 watch dog.
  mp3Flag = 1;
  myDFPlayer.volume(volVal);  //Set volume value. From 0 to 30

  if (!manager.init()){
  if (!driver.setFrequency(RF95_FREQ)) {
    while (1);
  driver.setTxPower(23, false);

void loop()
  if (manager.available())
  { uint8_t len = sizeof(buf);
    uint8_t from;
    if (manager.recvfromAck(buf, &len, &from)) //Recieve message from remote and store message in "buff"
      if (buf[0]=10)
      { uint8_t trackNum = myDFPlayer.readFileCounts(); //Reads number of tracks on SD card
        data[0] = mp3Flag;
        data[1] = trackNum;
        // Send a reply back to the originator client
        manager.sendtoWait(data, sizeof(data), from); //send mp3 status and number of tracks to remote
      if (buf[0]=2) //If selMsg is received
      { myDFPlayer.play(buf[1]);  //Play trackNum
      if (buf[0]=1){ //If volMsg is received
        if (buf[1]>volVal){
          myDFPlayer.volumeUp();  //Set volume value (0~30).
          myDFPlayer.volumeDown();  //Set volume value (0~30).
      if (buf[0]=3){ //If play_pauseMsg is received
        if (playFlag==1){
          myDFPlayer.pause();  //pause the mp3
          myDFPlayer.start();  //pause the mp3


I am in no way an expert in digital communication. From what I can tell the DFPlayer mini uses UART and the RFM9x Radio uses SPI. Could these 2 interfere with each other?

Start at the beginning.

Forget the DFplayer mini code for now.

Can you send messages to the LoRa Receiver device and have it print on the serial monitor;

Play track 1
Play track 2
Play track 3


seems you are powering the Nano with 12V, that's a huge load on the regulator... You probably get some issues generating the 5V for the other devices. Have you checked what's the Amp required from the nano (besides it's own consumption).

probably up to 150mA for the DFplayer and 50mA for the Lora board + the nano let's say 50mA too = 250mA

➜ the regulator has to burn (12V - 5V) x 0,250 A = 1,75W... It's probably safe to keep power dissipation under 0.5 W.. (might shut down otherwise due to heat).

you might want to try by powering the system through USB first and see if you get the same behavior

Yes, the LoRa works. I can send the commands and I receive them without problems. It is only when the 2 work together that I get problems. Like I mentioned, when starting everything up I establish a connection between the remote and speaker. I then read how many songs are on the SD card upon receiving a "hello" message from the remote and send the number of songs to the remote. I then choose what song to play on the remote and send it back to the "Speaker". Everything works up until this point. If I receive a data packet while the mp3 is playing, the dfplayer shuts down.

Yes, I am currently testing with USB. Both ways give the same results unfortunately. But I will definitely change the power supply to a lower voltage for the final project thanks.

try powering the Nano separately from the other devices (join grounds)

I just tried powering the dfplayer with a different power supply with similar results. Everything works fine until I receive a data packet. Could it be that when receiving a data packet, the RFM9x library does something that causes the dfplayer to reset? I have sent a "test message" as well that does not trigger any of the if-statements, just to see if the dfplayer resets when receiving any data packet and it did. Thanks for taking the time to trouble shoot with me by the way.

That would imply that the chosen RFM9x library is sending spurious pin changes on a pin it knows nothing about, which seems highly unliklely.

You need to add a pile of debug code to printout to serial monitor stuff like the LoRa payload received and the actions taken by the code.

can you write a code where you launch a Sound in the setup and then in the loop just print messages you get and see if there is an impact?

I don't think the DFPlayer is sending lots of data to the Arduino so you should not have interrupt conflicts

As embarrassing as it is to admit, I found the error. I didn't use 2 equal signs in some of my if statements. It works now. Thanks for your willingness to help.

We missed it too….

If there were debug printouts there, you would have likely spotted the error ...............

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