Op werkdagen vóór 14:00 uur besteld = dezelfde dag verzonden en in 98% van de gevallen de volgende dag in huis. Gratis retourneren 30 dagen bedenktijd 1 jaar garantie
← Tillbaka till översikten

Vid uppspelning laddas videon från YouTube.

Kopplingsschema och kodexempel

Så här kopplar du DFPlayer Mini (clone) MP3-modul med MicroSD-kortplats till en Arduino UNO eller ESP32, med ett exempel­sketch som du kan ladda upp direkt.

DFPlayer Mini MP3 Player Demo

This project demonstrates how to play MP3 audio files using the DFPlayer Mini module and Arduino Uno. Ensure your microSD card is formatted in FAT32 with an MP3 file placed in an 'mp3' folder (or root named 0001.mp3). When powered, the Arduino initializes the player, sets the playback volume, and starts playing the first audio track.

Kopplingsschema: DFPlayer Mini (clone) MP3-modul med MicroSD-kortplats på en Arduino UNO
Kopplingsschema · Klicka för att förstora
Kopplingstabell: DFPlayer Mini (clone) MP3-modul med MicroSD-kortplats på en Arduino UNO
Kopplingstabell · Klicka för att förstora
DFPlayer_Mini_MP3_Player_Demo.ino · kompilerad och testad
/*
 * ==================================================================
 *  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);
    }
  }
}

Nödvändiga bibliotek: DFRobotDFPlayerMini 1.0.6

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

ESP32 DFPlayer Mini MP3 Player Demo

This project connects an ESP32 to a DFPlayer Mini MP3 module to play audio tracks from a micro SD card through a connected speaker. The DFPlayer Mini is powered from 3.3V, and the ESP32 communicates with it using hardware Serial2 on GPIO 16 (RX2) and GPIO 17 (TX2). Format your micro SD card with FAT32 and place audio files in an 'mp3' folder (e.g. 0001.mp3) to begin playback.

Kopplingsschema: DFPlayer Mini (clone) MP3-modul med MicroSD-kortplats på en ESP32 DevKit V1
Kopplingsschema · Klicka för att förstora
Kopplingstabell: DFPlayer Mini (clone) MP3-modul med MicroSD-kortplats på en ESP32 DevKit V1
Kopplingstabell · Klicka för att förstora
ESP32_DFPlayer_Mini_MP3_Player_Demo.ino · kompilerad och testad
/*
 * ==================================================================
 *  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();
}

Nödvändiga bibliotek: DFRobotDFPlayerMini 1.0.6

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

Tidigare visade

TCRT5000 Reflekterande Optisk Sensor

TCRT5000 Reflekterande Optisk Sensor

€ 0,55