Commandé avant 14h00 un jour ouvrable = expédié le jour même 30 jours de délai de rétractation Garantie d’un an
← Retour à l’aperçu

La lecture charge la vidéo depuis YouTube.

Schéma de câblage et exemple de code

Voici comment connecter le Module MP3 DFPlayer Mini (clone) avec emplacement pour carte MicroSD à un Arduino UNO ou à un ESP32, avec un exemple de sketch que tu peux téléverser directement.

Démo du lecteur MP3 DFPlayer Mini

Ce projet montre comment lire des fichiers audio MP3 avec le module DFPlayer Mini et Arduino Uno. Assurez-vous que votre carte microSD est formatée en FAT32 et qu’un fichier MP3 se trouve dans un dossier 'mp3' (ou à la racine nommé 0001.mp3). À la mise sous tension, Arduino initialise le lecteur, règle le volume de lecture et commence à lire le premier morceau audio.

Schéma de câblage : Module MP3 DFPlayer Mini (clone) avec emplacement pour carte MicroSD sur un Arduino UNO
Schéma de câblage · Cliquez pour agrandir
Tableau de câblage : Module MP3 DFPlayer Mini (clone) avec emplacement pour carte MicroSD sur un Arduino UNO
Tableau de câblage · Cliquez pour agrandir
DFPlayer_Mini_MP3_Player_Demo.ino · compilé et testé
/*
 * ==================================================================
 *  Generated by Codey.online  —  https://www.codey.online
 * ==================================================================
 *  Project   : DFPlayer Mini MP3 Player Demo
 *  Board     : Arduino UNO (arduino:avr:uno)
 *  Parts     : DF Player Mini
 *  Libraries : DFRobotDFPlayerMini 1.0.6
 *
 *  Codey Online is an AI-powered browser IDE for Arduino and ESP32.
 *  Describe your project and Codey writes the code, draws the wiring
 *  diagram and uploads it to your board, straight from the browser.
 *  This code is free to use, modify and share, without warranty.
 * ==================================================================
 */

#include <SoftwareSerial.h>
#include <DFRobotDFPlayerMini.h>

// Arduino pin 10 connects to DFPlayer TX, pin 11 connects to DFPlayer RX
SoftwareSerial dfSerial(10, 11);
DFRobotDFPlayerMini myDFPlayer;

void setup() {
  Serial.begin(115200);
  dfSerial.begin(9600);

  Serial.println(F("Initializing DFPlayer Mini..."));

  if (!myDFPlayer.begin(dfSerial)) {
    Serial.println(F("Unable to begin DFPlayer Mini:"));
    Serial.println(F("1. Recheck wiring"));
    Serial.println(F("2. Insert formatted micro SD card with MP3 files"));
    while (true) {
      delay(100);
    }
  }

  Serial.println(F("DFPlayer Mini online."));
  
  // Set volume (0 to 30)
  myDFPlayer.volume(20);
  
  // Play the first MP3 file on the micro SD card
  myDFPlayer.play(1);
  Serial.println(F("Playing track 1..."));
}

void loop() {
  // Print status messages if received from the player
  if (myDFPlayer.available()) {
    uint8_t type = myDFPlayer.readType();
    int value = myDFPlayer.read();
    
    if (type == DFPlayerPlayFinished) {
      Serial.print(F("Track finished: "));
      Serial.println(value);
    }
  }
}

Bibliothèques nécessaires : DFRobotDFPlayerMini 1.0.6

Wiring diagram and example code generated by Codey.online — https://www.codey.online

ESP32 DFPlayer Mini MP3 Player Demo

Ce projet relie un ESP32 à un module DFPlayer Mini MP3 pour lire des pistes audio depuis une carte micro SD via un haut-parleur connecté. Le DFPlayer Mini est alimenté en 3.3V, et l'ESP32 communique avec lui via Serial2 matériel sur GPIO 16 (RX2) et GPIO 17 (TX2). Formatez votre carte micro SD en FAT32 et placez les fichiers audio dans un dossier 'mp3' (par exemple 0001.mp3) pour lancer la lecture.

Schéma de câblage : Module MP3 DFPlayer Mini (clone) avec emplacement pour carte MicroSD sur un ESP32 DevKit V1
Schéma de câblage · Cliquez pour agrandir
Tableau de câblage : Module MP3 DFPlayer Mini (clone) avec emplacement pour carte MicroSD sur un ESP32 DevKit V1
Tableau de câblage · Cliquez pour agrandir
ESP32_DFPlayer_Mini_MP3_Player_Demo.ino · compilé et testé
/*
 * ==================================================================
 *  Generated by Codey.online  —  https://www.codey.online
 * ==================================================================
 *  Project   : ESP32 DFPlayer Mini MP3 Player Demo
 *  Board     : ESP32 DEVKIT V1 (esp32:esp32:esp32doit-devkit-v1)
 *  Parts     : DF Player Mini
 *  Libraries : DFRobotDFPlayerMini 1.0.6
 *
 *  Codey Online is an AI-powered browser IDE for Arduino and ESP32.
 *  Describe your project and Codey writes the code, draws the wiring
 *  diagram and uploads it to your board, straight from the browser.
 *  This code is free to use, modify and share, without warranty.
 * ==================================================================
 */

#include <DFRobotDFPlayerMini.h>

DFRobotDFPlayerMini myDFPlayer;

void setup() {
  Serial.begin(115200);
  // Serial2: RX on GPIO 16, TX on GPIO 17
  Serial2.begin(9600, SERIAL_8N1, 16, 17);

  Serial.println(F("Initializing DFPlayer Mini..."));

  if (!myDFPlayer.begin(Serial2)) {
    Serial.println(F("Unable to begin. Check SD card and wiring!"));
    while (true) {
      delay(500);
    }
  }

  Serial.println(F("DFPlayer Mini online."));
  myDFPlayer.volume(20);  // Set volume (0 to 30)
  myDFPlayer.play(1);      // Play track 0001.mp3
}

void loop() {
  // Play next track every 10 seconds
  delay(10000);
  Serial.println(F("Playing next track..."));
  myDFPlayer.next();
}

Bibliothèques nécessaires : DFRobotDFPlayerMini 1.0.6

Wiring diagram and example code generated by Codey.online — https://www.codey.online