RC522 & DFPlayer on Elegoo Uno R3 (problem fixed)

I’m trying to get my Elegoo Uno R3 to be able to react to different RFID-Chips by playing mp3s.
It works perfectly fine seperate from one another, I can tell the RFIDs apart and play the mp3s that I want to. But when trying to combine those two, I’ve run into problems: Using the DFPlayer works just fine until I call
after wich none of the commands called for the Player do anything. But without that command the RC522 doesn’t work.

You seem to need a separate SS-Pin (why is it called SDA on the RC522 and Transciever on the DFPlayer?) for each device, but on my board there’s only one SS (at least if the Elegoo is like the Arduino Uno).
Does anyone here know a way to get two slaves working without buying a new board?


Elegoo Uno RC522 DFPlayer
10 SDA Tx
11 MOSI Rx
13 SCK
3.3V 3.3V
GND GND GND(separate)

Tx and Rx are connected to the breadbord through a 1kOhm resistor (unlike seen here, but I read it’d reduce noise).
Used these connections to the RC522.

Copied together codes from this and this source:

#include <SPI.h>
#include <MFRC522.h>
#define RST_PIN         9
#define SS_PIN          10

MFRC522 mfrc522(SS_PIN, RST_PIN); 

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

SoftwareSerial mySoftwareSerial(10,11); // RX, TX
DFRobotDFPlayerMini myDFPlayer;
void printDetail(uint8_t type, int value); //[i]idk what this does?!?[/i]

void setup()
  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!"));
      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 [i]does work[/i] 
    while (!Serial);            // Do nothing if no serial port is opened (added for Arduinos based on ATMEGA32U4)
    SPI.begin();                // Init SPI bus
    myDFPlayer.play(1);      //[i]added to test, should play the first mp3, doesn't work[/i]
    mfrc522.PCD_Init();         // Init MFRC522 card  

1.) Use different pins for TX and RX - use any digital pins NOT used by SPI
2.) The stock DFPlayerMini.h library is trash - use this highly efficient library instead

Okay, I switched Tx to Rx/Digital Pin 0 and Rx to Tx/D1, changed it in the declaration of mySoftwareSerial and used your library. But I don’t have the possibility to use a second hardware serial - in the example you said one could use a SoftwareSerial instead, but I get an Error:
could not convert ‘myDFPlayer.DFPlayerMini_Fast::begin(mySoftwareSerial.SoftwareSerial::)’ from ‘void’ to ‘bool’
What’s the intended way to use a SoftwareSerial in your library?

The DFPlayerMini_Fast class accepts a stream class as an argument when calling .begin(). Here is the relevant code from my library:

class DFPlayerMini_Fast
   Stream* _serial;
   void begin(Stream& stream);

Therefore, you just pass the name of your instantiated softwareSerial class to the .begin() method. Can you post your code?

#include "Arduino.h"
#include "SoftwareSerial.h"
#include <DFPlayerMini_Fast.h>
DFPlayerMini_Fast myDFPlayer;

void setup()
  SoftwareSerial mySoftwareSerial(0,1); // RX, TX
  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!"));
    myDFPlayer.volume(8);  //Set volume value. From 0 to 30
    SPI.begin();                // Init SPI bus

I also tried passing the adress (&) of mySoftwareSerial, but it didnt work with the passed pointer either.
[EDIT:] I tried using a SoftwareSerial the same way in your example.ino and it compiled without an error, yet didn’t really work apart from the printing stuff… I’m confused.
SoftwareSerial mySoftwareSerial(5,6); //instead of Serial1, changed wires accordingly
are the only lines of code I changed in example.ino

1.) This shouldn't matter a whole lot, but you should have it as

#include "DFPlayerMini_Fast.h"

since the library isn't "pre-compiled"

2.) Simplify the project temporarily by only focusing on getting the DFPlayer working. Delete/comment out the code for the SPI device and we'll revisit it once the MP3 player is working.

3.) You never called mySoftwareSerial.begin(9600) - nothing will work on this port without such a call

4.) You don't need to include Arduino.h

Okay, thanks, 3) and looking at your .h again fixed my problems!
Found out your begin() method returns nothing while that of the standard librarys begin() returns a bool (pointing out if it was successful) and
if (!myDFPlayer.begin(mySoftwareSerial))
is dependant on that return.

Thanks for all those tips and help and the new library!

Glad to help!

Found out your begin() method returns nothing while that of the standard librarys begin() returns a bool

That's a really good point - Imma change my library tonight to have it return a bool because of this 8)