Hi,
I want to connect mp3 player module to Arduino nano. So, there are no buttons or anything like that, I want it to play music directly when it is connected to some sort of power. (This is a part of a bigger project, but for now I just need to make it play one song).
I have connected:
Both MP3 players GNDs to one GND of an Arduino
VCC to 5V
TX to pin 11, RX to pin 10
and ofc speaker to spk_1 and spk_2
Here is the code: #include "SoftwareSerial.h" #include "DFRobotDFPlayerMini.h"
Please edit your post, select all code and click the <CODE/> button; next save your post. This makes it easier to read and copy and the forum software will display it correctly. Please read How to get the best out of this forum (and pay attention to the mention of code tags).
It looks like you connected TX of Arduino to TX of MP3 player and RX to RX?
It is not correct.
You must connect it as TX - Rx and RX - Tx, since the "TX" means transmitter and "RX" - receiver.
The transmitter on the one board should be connected to receiver on the another, and viceversa.
Hi,
I want to connect mp3 player module to Arduino nano. So, there are no buttons or anything like that, I want it to play music directly when it is connected to some sort of power. (This is a part of a bigger project, but for now I just need to make it play one song).
But but bu, for some reason it does not work. It prints "Connecting to DFPlayer Mini failed!", but everything is connected as it should be. So if anyone knows what is wrong?
I have connected:
Your two topics on the same subject have been merged. Please do not cross post as it wastes peoples time. Please read How to get the best out of this forum (again).
In your first thread you wrote that you connect Arduino and MP3 module as RX -RX TX-TX. Then you created a second thread where described your connection as RX-TX TX-RX.
Which of the two options corresponds to the actual module connection ?
So assuming you now do have Rx & Tx correctly connected (with the required 1k resistor), then the cause could be your file organisation. Are your files named and organised on the mini-SD card as specified in DFR's documentation?
After checking if the OP had been back (no), I tried the sketch under discussion again with the different DFR Player module now on my breadboard (with Mega 2560 R3). The results reinforced my experience that trial/error often proves necessary with these modules, at least with my clone versions.
Commented code below for others who might end up here when apparently simple examples don't work.
/* Works after making the Rx/Tx corrections
AND moving the playing until AFTER the initialisation
AND after trial/error on delays; that last one seems to vary
between DFR modules.
*/
#include "SoftwareSerial.h"
#include "DFRobotDFPlayerMini.h"
// static const uint8_t PIN_MP3_TX = 10; // WRONG
// static const uint8_t PIN_MP3_RX = 11; // WRONG
static const uint8_t PIN_MP3_RX = 10;
static const uint8_t PIN_MP3_TX = 11;
SoftwareSerial softwareSerial(PIN_MP3_RX, PIN_MP3_TX);
DFRobotDFPlayerMini player;
void setup()
{
// Serial.begin(9600);
Serial.begin(9600);
softwareSerial.begin(9600);
delay(200); // If removed (or < 200) then vol command would
// not take effect (vol would be max, 30).
if (player.begin(softwareSerial))
{
Serial.println("OK");
}
else
{
Serial.println("Connecting to DFPlayer Mini failed!");
}
delay(800); // 500 was too short
player.volume(15); // Moved these AFTER the initialisation
player.play(1);
}
void loop()
{
}