Hello good people,
I am making a sounder circuit for a friend using a DFPlayer Mini MP3 Module.
It's a simple design.
A Nano, a DFPlayer Mini and some momentary push buttons which I have mocked up on Breadboard. I am also using the DFPlayer Arduino Library btw.
The circuit works and I am just mocking up the first button which has a simple action:
Push button momentarily and MP3 will play uninterrupted til the end of the track.
But I'm getting issues with clicking whenever the Nano communicates with the DFPlayer over Serial to check that the MP3 is still playing.
This is the code I found to play an MP3 until the end of the track
//----DFPlayer State Checking Function
void dfPlayerStateCheck(){
int playerState = 0;
delay(100); //Delay after call to play mp3 function in main program loop
while(playerState != 512) {
delay(2000); // prevents clicks and static during playback - increase if necessary.
playerState = myDFPlayer.readState();
} //--END WHILE LOOP
}
If I remove that function and just use a play() function call followed by a delay, the song plays for the duration of the delay without clicks so it's definitely the serial calls to check the player state causing it.
- I have ruled out insufficient power supply problems by running the project off one shared 7805 Regulator and then powering the Nano and DFPlayer with their own separate 7805 regulators. No change.
- I have also played around with the delay value to prevent clicks but they are still there whenever the Nano talks to the DFPlayer over serial while audio is playing.
- I have 1K resistors in the Serial TX/RX lines and I've tried with, without, one with, one without and various combinations but nothing helps.
- I have also played around with the "prevents clicks" delay in that function but it doesn't help. Increasing the value lessens the frequency of the clicks but they're still there. And decreasing the value obviously makes it worse with more clicks per second.
Does anyone have any other ideas please??
Thank you!