SKU: OT4011 Artikelnummer: NA087 EAN: 8720618827739
De DFPlayer Mini (clone) är en kompakt och kraftfull MP3-spelarmodul, idealisk för ljudapplikationer i projekt som Arduino eller andra mikrokontroller. Denna modul kan spela upp MP3-filer direkt från ett microSD-kort eller USB-minne, utan att någon extra hårdvara behövs.
Viktigaste egenskaper:
DFPlayer Mini är en mångsidig lösning för alla dina ljudrelaterade projekt, oavsett om du vill lägga till ljudeffekter i din design eller bygga ett komplett ljudsystem!
OBS: Detta är inte det ursprungliga YX5200-chipet. Befintlig kod för YX5200-chipet kan behöva anpassas för korrekt funktion.
Så här kopplar du DFPlayer Mini (clone) MP3-modul med MicroSD-kortplats till en Arduino UNO eller ESP32, med ett exempelsketch som du kan ladda upp direkt.
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.
/*
* ==================================================================
* 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
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.
/*
* ==================================================================
* 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