Hello,
I have an arduino nano and i am trying to wire up and code the dfplayer to play sounds. I am trying to use the rx and tx inputs/outputs from the dfplayer mini to the rx and tx on the arduino nano but i am having issues. I can not get any sound to play at all. If it is not possible to wire them using the tx an rx could it be wired without using the pwm pins?
Give us more details
- code you have (using code tags)
- drawing of ALL the connexions including USB if connected to a computer
- links to the board you have
casualgamer24:
Hello,
I have an arduino nano and i am trying to wire up and code the dfplayer to play sounds. I am trying to use the rx and tx inputs/outputs from the dfplayer mini to the rx and tx on the arduino nano but i am having issues. I can not get any sound to play at all. If it is not possible to wire them using the tx an rx could it be wired without using the pwm pins?
If you are also using Serial monitor, then I'd recommend that you use SoftwareSerial and move the TX/RX to two other pins like 3 and 4, for example.
that module works well at 9600 baud using SoftwareSerial.
thats the problem im not sure which code to use and all my pwm pins are used up already. So ill have to use non pwm pins or the tx and rx pins.
casualgamer24:
thats the problem im not sure which code to use and all my pwm pins are used up already. So ill have to use non pwm pins or the tx and rx pins.
using SoftwareSerial, you can use any two pins that are not your TX/RX, even the analog pins...
I think that in that case a full schematic (photo/scan of a hand-drawn one is fine) as well as a full description of your project will be useful.
I'm not sure if SoftwareSerial works on analog pins (I think it does) but you are aware that analog ins can be used as digital IO? Maybe a solution.
oh ok i was trying some thing like this Weekend project with Stonez56: Arduino - DFPlayer Mini MP3 Module but no sound was coming out.
pin 4 is tx and pin 7 is rx
#include <DFPlayer_Mini_Mp3.h>
#include <SoftwareSerial.h>
void setup () {
Serial.begin (9600);
mp3_set_serial (Serial); //set Serial for DFPlayer-mini mp3 module
mp3_set_volume (20);
}
void loop () {
mp3_play (1); //play 0001.mp3
delay (10000); //10 sec, time delay to allow 0001.mp3 to finish playing
mp3_play (2);
delay (5000);
}
I have no experience with the dfplayer but it does not help to include SoftwareSerial and not use it ![]()
Maybe start with some reading; SoftwareSerial Library.
casualgamer24:
pin 4 is tx and pin 7 is rx
then maybe like this:
#include <DFPlayer_Mini_Mp3.h>
#include <SoftwareSerial.h>
SoftwareSerial dfPlayer(7, 4); // RX, TX
void setup () {
Serial.begin (9600);
dfPlayer.begin(9600);
mp3_set_serial (dfPlayer); //set SoftwareSerial for DFPlayer-mini mp3 module
mp3_set_volume (20);
}
it gives me an error for no matching function to 'mp3_set_serial(int, int)'
yes it uploads but the mp3 player still wont play anything. Nothing happens..
casualgamer24:
yes it uploads but the mp3 player still wont play anything. Nothing happens..
time to post your complete code
I am not sure what i am doing wrong, ive tested the dfplayer without the arduino and it works.
#include <DFPlayer_Mini_Mp3.h>
#include <SoftwareSerial.h>
SoftwareSerial dfPlayer(7, 4); // RX, TX
void setup () {
Serial.begin (9600);
dfPlayer.begin(9600);
mp3_set_serial (dfPlayer); //set SoftwareSerial for DFPlayer-mini mp3 module
mp3_set_volume (80);
}
void loop () {
mp3_play (1); //play 0001.mp3
delay (10000); //10 sec, time delay to allow 0001.mp3 to finish playing
mp3_play (2);
delay (5000);
}
casualgamer24:
I am not sure what i am doing wrong, ive tested the dfplayer without the arduino and it works.
how did you test it? what did you use to test the serial commands?
are you certain that the files are in the right directory:
mp3/0001.mp3
I hooked the dfplayer to the speaker and battery then I jumped the IO_1 to ground and it played through the mp3 in a loop.
BulldogLowell:
Are you certain that the files are in the right directory:mp3/0001.mp3
- you have it connected correctly? TX<->RX and RX<->TX
- common ground?
Post a photo...
What is actually happening? does the communication LED lite up when the command is sent from Arduino?
yea its in the right directory and the tx-rx and rx-tx
I got it working, looks like it was my soldering job..
Now Ive run into another problem with the mp3 sounds.. when i press a button i want 0001.mp3 to play only once and 0003.mp3 to play in a loop after and when i press the button again the sounds turn off. Does anyone know how to do this?