Hi I am testing the DF player mini module by playing a mp3 file. The DF player receives the commands as the indicator LED lights up and sound is played albeit at a very low volume; I have to have the speaker touching my ear to be able to hear anything. I tried adding a 1000uF capacitor between Vcc and GND and the volume then became as expected. But when I powered off the project and turned the power back on, the audio returned to being played at a low volume,. I have provided my code, although I doubt it is the issue as sound is being produced. I have attached the schematic of my circuit. The power supply is capable of providing 2A (lab bench power supply). The arduino nano is powered by USB.
# define Start_Byte 0x7E
# define Version_Byte 0xFF
# define Command_Length 0x06
# define End_Byte 0xEF
# define Acknowledge 0x00 //Returns info with command 0x41 [0x01: info, 0x00: no info]
#define c_play_file 0x0F
#define c_set_volume 0x06
#define c_stop_track 0x16
#define c_play 0x0D
#define c_pause 0x0E
#define c_setvolume 0x06
#define c_initialize 0x3F
#define c_repeat_track 0x08
#define c_stop 0x16
#define c_equalizer 0x07
void setup_DF();
void DF_initialize();
void DF_playfile(byte folder_num, byte file_num);
void DF_repeat(byte track_number);
void DF_pause();
void DF_stop();
void DF_play();
void DF_setVolume(int vol);
void DF_execute_CMD(byte CMD, byte Par1, byte Par2);
void setup() {
setup_DF();
}
void loop() {
}
void setup_DF()
{
Serial.begin(9600);
DF_initialize();
DF_setVolume(25);
DF_playfile(1,1);
}
void DF_initialize()
{
DF_execute_CMD(c_initialize, 0, 0);
delay(30);
}
void DF_playfile(byte folder_num, byte file_num)
{
DF_execute_CMD(c_play_file,folder_num,file_num);
delay(30);
}
void DF_repeat(byte track_number)
{
DF_execute_CMD(c_repeat_track,0,track_number);
}
void DF_pause()
{
DF_execute_CMD(c_pause,0,0);
delay(30);
}
void DF_stop()
{
DF_execute_CMD(c_stop,0,0);
}
void DF_play()
{
DF_execute_CMD(c_play,0,1);
delay(30);
}
void DF_setVolume(int vol)
{
DF_execute_CMD(c_setvolume, 0, vol); // Set the volume (0x00~0x30)
delay(30);
}
void DF_execute_CMD(byte CMD, byte Par1, byte Par2)
// Excecute the command and parameters
{
// Calculate the checksum (2 bytes)
word checksum = -(Version_Byte + Command_Length + CMD + Acknowledge + Par1 + Par2);
// Build the command line
byte Command_line[10] = { Start_Byte, Version_Byte, Command_Length, CMD, Acknowledge,
Par1, Par2, highByte(checksum), lowByte(checksum), End_Byte};
//Send the command line to the module
for (byte k=0; k<10; k++)
{
Serial.write(Command_line[k]);
}
}