#8331
Hello, I connect 1k resistors between the arduino module and MP3 rx/tx, but noise (murmur) is going on.
I cheked 4 differnt dfplayer mini and have the same problem. Any ideas about solve this problem?
Q 1. When Arduino send command to DFPlayer mini, the speaker will murmur, seems like noise, how to deal with it?
A: Plz connect a 1k resistor between the module and MP3 on TX-RX and RX-TX.Because DFPlayer Mini Module operating voltage is 3.3V.
#8628
Hello, sorry for long time answer
Image

Image

Image

Code: Select all
#include <SoftwareSerial.h>
#include <DFPlayer_Mini_Mp3.h>

#define INIT_PORT 11 //порт инициализации
#define OPEN_PORT 10 //порт принудительного открытия
#define STATUS_PORT 12 //порт состояния

#define touch1_1 2
#define touch1_2 3
#define touch2_1 4
#define touch2_2 5

#define MP3_RX 8
#define MP3_TX 9

#define pinA 6  // Connected to CLK on KY-040
#define pinB 7  // Connected to DT on KY-040

#define MP3_BUSY 13

 int volume = 8;
 int oldvolume=0;
 int pinALast; 
 int aVal;
 boolean bCW;
 int audio_on=0; //временно 1 потом поставить =0
  SoftwareSerial mp3_serial = SoftwareSerial(9, 8); // RX, TX порты управления mp3

void setup() {
  pinMode(9, INPUT_PULLUP); digitalWrite(9,LOW);
  pinMode(8, OUTPUT);

  pinMode(touch1_1,INPUT);
  pinMode(touch1_2,INPUT);
  pinMode(touch2_1,INPUT);
  pinMode(touch2_2,INPUT);

pinMode(MP3_BUSY,INPUT_PULLUP); digitalWrite(MP3_BUSY,HIGH);
  //Serial.begin(9600);

  mp3_serial.begin(9600);
  mp3_set_serial(mp3_serial);
  delay(1);
  mp3_set_volume(volume);
  delay(1);

   pinMode (pinA,INPUT); // Connected to CLK on KY-040
   pinMode (pinB,INPUT); // Connected to DT on KY-040
   pinALast = digitalRead(pinA);
}

unsigned long t_vol=0;

void loop() {
 if(audio_on==0 /*&&
    digitalRead(touch1_1) == HIGH &&
    digitalRead(touch1_2) == HIGH &&
    digitalRead(touch2_1) == HIGH &&
    digitalRead(touch2_2) == HIGH */
    )
  {
    //Serial.println(1);
       audio_on=1;
       mp3_play(800);
       delay(100);
  }

 if(audio_on==1){
  if(digitalRead(MP3_BUSY)==LOW){
   aVal = digitalRead(pinA);
   if (aVal != pinALast){ // если произошло вращение
     if (digitalRead(pinB) != aVal) {  // Means pin A Changed first - We're Rotating Clockwise
       if(millis()-t_vol>130 && volume>0) {
        volume --;
        t_vol=millis();   
       }
     } else {// Otherwise B changed first and we're moving CCW
       if(millis()-t_vol>130 && volume<30){
        volume ++;
        t_vol=millis();
       }
     }
    if(oldvolume!=volume) { mp3_set_volume(volume); delay(1);}
   }
   pinALast = aVal;
  } else {
    audio_on=0;
    //mp3_play(800);//временно
  }
 }
}
#8636
Hi bam,

What's your controller? If this cards operation voltage is
* 3.3V, no risister needed
* 5V, 1K risistance is ok

If it is not the problem related with the risistance, then how is it when you upload another MP3 player sample code?
#8641
Hello Leff,

Operating voltage is 4.6 - 5V
I use 1K resistance at TX and RX pins, but I listen "murmur" at low volume or where volume is "0".

I tried to use different arduino modules (nano, mega, uno, original\chines) and different DFPlayer mini modules with next code:
Code: Select all
#include <DFPlayer_Mini_Mp3.h>

#define MP3_RX 8
#define MP3_TX 9

SoftwareSerial mp3_serial = SoftwareSerial(MP3_TX, MP3_RX); // RX, TX mp3

void setup() {
  mp3_serial.begin(9600);
  mp3_set_serial(mp3_serial);
  delay(100);
  mp3_set_volume(10);
  delay(100);
  mp3_play(800); // or mp3_next();
  delay(100);
}

void loop() {
 
}

, but result is same.

P.s. Sorry for my bad english.
#8650
Hey, my English is not my mother tongue either, yours is very good!

I tried it on Uno/leonardo without any problem, and only added one 1K to Rx.

But I remeber there was a time that I would here the murmue when the module is out of control, but once I upload an available code to play some music and stop it, no noise would be heared anymore.

Sorry I don't know what to suggest so far... If I got some idea, I will tell you.
#8662
Hello Leff,

I have "solved" a problem. I connect the MP3 module to other power supply unit - other than Arduino power supply unit, and the sound becomes pure, but I can't control MP3_BUSY pin.
Any Ideas how to use one power supply?
If I use one "ground", "murmur" is come back.

Image
Image
#8673
Hi,

Good to hear that, I attached your answer to wiki>FAQ, Q1, hope you don't mind.

I didn't get you about "how to use one power supply", do you mean once you connct MP3 group to Arduino, murmur will come back? But the power adapter-arduino- mp3, they should be in the same ground, or serial signal won't work.

For the BUSY pin, if I didn't understand wrong, it can't be controlled. It represents the player's playing state, play/pause will set the pin HIGH/LOW.
#8681
Hi Leff,

It is very strange, but serial work without same ground. I found the same solve of this problem at another website: http://stonez56.blogspot.ru/2015/03/arduino-dfplayer-mini-mp3-module.html

But, without same ground Arduino can't read right status of Busy pin and this is big problem for my task. In cpp library i found function mp3_get_state (). I think that after call of this function mp3 module write answer to global variable recv_buf[], but there this no anything in this variable.

BAM
#8718
Hi Bam,

I tested it today, two findings:

1) When I used Arduino 3.3V as power source to PM3 module, even without the resistor, no noise came out, but with 5V from Arduino, it needs a 1k resistor. Besides, I also used an external power 5V as the linkyou attached, just as you said, it was ok, but I also tried to make them co-ground, no noise came out.

2) I tried to send the command mp3_get_state (); , and read from the serial port, but only got some strange characters(I think they were the state of the player, but I have to analyze them), but in the library, I found this:

(24.98 KiB) Downloaded 2412 times


Only the writer define a variable called recv_buf[], but did nothing about it, that's why it was empty after you send the command.

You could try to read serial data into the variable recv_buf[].