dfplayer wiring to arduino nano using rx and tx and code issue

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...

You don't need any PWM pins. You need a serial interface. If you're using the one hardware serial to upload and talk to serial monitor then you need software serial to talk to your module. Any pins can be used for software serial.

I've used a bunch of words that if you don't know what I'm talking about Professor Google can probably help a lot.

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.

SoftwareSerial will work on any digital pins, even the ones that double as analog inputs. Remember, they're digital pins first and the analog thing is something extra they can do.

oh ok i was trying some thing like this Stonez56: Family, Life, Kids, Work, Arduino: Arduino - DFPlayer Mini MP3 Module but no sound was coming out.

OK. Post your schematic. What you actually have, not what you tried to copy from. Post your code. There is very very little that anyone can do to help you without being able to see what you did. Does that make sense to you?

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 :wink:

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)'

You must not have copied what @Bulldog wrote properly because his call to mp3_set_serial doesn't pass two ints. His code might give an error, but it wouldn't get that particular error. Post your code.

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.