Project #16: Sound – DFPlayer Pro – Mk30

——

#DonLucElectronics #DonLuc #DFPlayerPro #ArduinoUNO #IoT #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

DFPlayer Pro

——

DFPlayer Pro

——

DFPlayer Pro

——

DFPlayer Pro MP3 Player Module

The DFPlayer Pro MP3 player module offers high-quality dual channel audio with 128MB storage, 24-bit DAC output, and a UART interface. It supports multiple control modes, including Arduino, AT command, on-board buttons, and ADKEY. With USB connectivity, It allows easy music copying and supports various audio formats, including MP3, WAV, WMA, FLAC (Free Lossless Audio Codec), and APE (Monkey’s Audio) for high-fidelity lossless audio experiences. Compatible with Arduino and Raspberry Pi, the DFPlayer Pro is ideal for self-service devices, ATM voice prompt systems, medical diagnostic equipment, in-car high-fidelity voice navigation, public address systems, and voice alarm systems.

DL2608Mk01

1 x Arduino UNO R3
1 x Fermion: DFPlayer Pro MP3 Player Module
2 x Stereo Enclosed Speaker – 3W 8Ohm
1 x Gravity: Analog ADKeyboard Module V2
1 x ProtoScrew Shield
1 x USB Battery Pack
1 x USB Mini-B Cable

DL2608Mk01p

DL2608Mk01p.ino

/****** Don Luc Electronics © ******
Software Version Information
Project #16: Sound – DFPlayer Pro – Mk29
16-30
DL2608Mk01p.ino
DL2608Mk01p
1 x Arduino UNO R3
1 x Fermion: DFPlayer Pro MP3 Player Module
2 x Stereo Enclosed Speaker - 3W 8Ohm
1 x Gravity: Analog ADKeyboard Module V2
1 x ProtoScrew Shield
1 x USB Battery Pack
1 x USB Mini-B Cable
*/

// Include the Library Code
// DFRobot DF1201S
#include <DFRobot_DF1201S.h>
// Software Serial
#include "SoftwareSerial.h"

// RX  TX
SoftwareSerial DF1201SSerial(2, 3);

// DFRobot DF1201S
DFRobot_DF1201S DF1201S;

// AD Switch
//int iADSwitch = A3;
// Val
int adc_key_val[5] ={600,650, 700,  800, 900 };
// Nun Keys
int NUM_KEYS = 5;
// In
int adc_key_in;
// Kay
int key = -1;
// Old Key
int oldkey=-1; 

// Software Version Information
String sver = "16-30";

void loop() {
  
  //  AD Switch
   isADSwitch();
  
}

getADSwitch.ino

//  AD Switch
void isADSwitch(){

  // Read the value from the sensor
  adc_key_in = analogRead(0);

  // Convert into position
  key = get_key(adc_key_in);

  // If keypress is detected
  if (key != oldkey) 
   {
    
    // Wait for debounce time
    delay(50);

    // Read the value from the sensor
    adc_key_in = analogRead(0); 

    // Convert into key press
    key = get_key(adc_key_in);

    if (key != oldkey)
    {
      
      oldkey = key;
      if (key >=0){
        
        switch(key)
        {
           case 0:
  
             /*Pause*/
             Serial.println("Pause");
             DF1201S.pause();
            
                  break;
           case 1:
             
             // isPlayer
             Serial.println("Play");
             isPlayer();
           
                  break;
           case 2:
             
             /*Play the next song*/
             Serial.println("Next");
             DF1201S.next();
           
                  break;
           case 3:
             
             /*Play the previous song*/
             Serial.println("Previous");
             DF1201S.last();
           
            break;
           case 4:
           
           //Total File
           Serial.print("File number: ");
           // Get file number
           Serial.println(DF1201S.getCurFileNumber());

           break;
        }
      }
    }
  }
  delay(100);

}
// Convert ADC value to key number
int get_key(unsigned int input)
{
    int k;
    for (k = 0; k < NUM_KEYS; k++)
    {
      if (input < adc_key_val[k])
     {
            return k;
        }
   }
       if (k >= NUM_KEYS)k = -1;  // No valid key pressed
       return k;
}

getMP3Player.ino

// DFPlayer Pro MP3 Player Module
// isPlayer
void isPlayer(){
  
  /*Start playing*/
  DF1201S.start();

}

setup.ino

// Setup
void setup()
{
 
  // Serial
  Serial.begin(115200);
  
  // Delay
  delay( 100 );

  // DFRobot DF1201S
  DF1201SSerial.begin(115200);

  while (!DF1201S.begin(DF1201SSerial)) {
    
    Serial.println("Init failed, please check the wire connection!");
    delay(1000);
    
  }

  /*Set volume to 20*/
  DF1201S.setVol(20);

  /*Enter music mode*/
  DF1201S.switchFunction(DF1201S.MUSIC);

  /*Wait for the end of the prompt tone */
  delay(2000);

  /*Set playback mode to "repeat all"*/
  DF1201S.setPlayMode(DF1201S.ALLCYCLE);

  /*Get playback mode*/
  Serial.println(DF1201S.getPlayMode());

  // Delay
  delay( 100 );

}

——

People can contact us: https://www.donluc.com/?page_id=1927

Consultant, R&D, Electronics, IoT, Teacher and Instructor

  • Programming Language
  • Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc…)
  • IoT
  • Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
  • Robotics
  • Automation
  • Camera and Video Capture Receiver Stationary, Wheel/Tank , Underwater and UAV Vehicle
  • Unmanned Vehicles Terrestrial, Marine and UAV
  • Machine Learning
  • Artificial Intelligence (AI)
  • RTOS
  • Sensors, eHealth Sensors, Biosensor, and Biometric
  • Research & Development (R & D)
  • Consulting

Follow Us

Luc Paquin – Curriculum Vitae – 2026
https://www.donluc.com/luc/LucPaquinCVEng2026Mk01.pdf
https://www.donluc.com/luc/

Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
DFRobot: https://learn.dfrobot.com/user-10186.html
TikTok: https://www.tiktok.com/@luc.paquin8
Hackster: https://www.hackster.io/luc-paquin
LinkedIn: https://www.linkedin.com/in/jlucpaquin/

Don Luc