SKU: OT4011 Numero articolo: NA087 EAN: 8720618827739
Il DFPlayer Mini (clone) è un modulo lettore MP3 compatto e potente, ideale per applicazioni audio in progetti come Arduino o altri microcontrollori. Questo modulo può riprodurre direttamente file MP3 da una scheda microSD o da una chiavetta USB, senza bisogno di hardware aggiuntivo.
Caratteristiche principali:
Il DFPlayer Mini è una soluzione versatile per tutti i tuoi progetti legati all'audio, sia che tu voglia aggiungere effetti sonori al tuo design o costruire un sistema audio completo!
ATTENZIONE: Questo non è il chip YX5200 originale. Il codice esistente per il chip YX5200 potrebbe dover essere adattato per il corretto funzionamento.
Ecco come collegare il Modulo MP3 DFPlayer Mini (clone) con slot per scheda MicroSD a un Arduino UNO o ESP32, con uno sketch di esempio che puoi caricare subito.
Questo progetto mostra come riprodurre file audio MP3 utilizzando il modulo DFPlayer Mini e Arduino Uno. Assicurati che la tua scheda microSD sia formattata in FAT32 e che un file MP3 sia inserito in una cartella 'mp3' (oppure nella root con nome 0001.mp3). Quando viene alimentato, Arduino inizializza il player, imposta il volume di riproduzione e avvia la riproduzione della prima traccia audio.
/*
* ==================================================================
* 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);
}
}
}
Librerie necessarie: DFRobotDFPlayerMini 1.0.6
Wiring diagram and example code generated by Codey.online — https://www.codey.online
Questo progetto collega un ESP32 a un modulo DFPlayer Mini MP3 per riprodurre tracce audio da una scheda micro SD tramite un altoparlante collegato. Il DFPlayer Mini è alimentato a 3.3V e l'ESP32 comunica con esso tramite Serial2 hardware su GPIO 16 (RX2) e GPIO 17 (TX2). Formatta la tua scheda micro SD in FAT32 e inserisci i file audio in una cartella 'mp3' (ad es. 0001.mp3) per avviare la riproduzione.
/*
* ==================================================================
* 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();
}
Librerie necessarie: DFRobotDFPlayerMini 1.0.6
Wiring diagram and example code generated by Codey.online — https://www.codey.online