شحن مجاني للأوردرات فوق
1000 ج
رمضان كريم
Compact Audio Playback Solution for Arduino and Microcontroller Projects
The MP3-TF-16P module is a low-cost, high-quality audio playback solution that supports MP3 and WAV files from micro SD cards. Featuring a built-in DAC and amplifier, this module provides simple serial control and requires minimal external components.

Supports MP3 and WAV files (8-320kbps)
Micro SD card slot (up to 32GB supported)
UART serial control (9600 baud default)
3W output (requires 5V power)
| Model | MP3-TF-16P |
|---|---|
| Control Interface | UART Serial (TTL level) |
| Audio Output | Mono 3W (8Ω speaker) |
| Operating Voltage | 3.2-5V (5V recommended) |
| Supported Cards | Micro SD (FAT16/FAT32) |
| Standby Current | <20mA |

| Pin | Label | Description | Connection |
|---|---|---|---|
| 1 | VCC | Power (5V recommended) | 5V |
| 2 | RX | Serial Receive | Arduino TX |
| 3 | TX | Serial Transmit | Arduino RX |
| 4 | DAC_R | Right Audio (not used) | – |
| 5 | DAC_L | Left Audio Output | Speaker+ |
| 6 | GND | Ground | GND |
| 7 | SPK1 | Amplifier Output+ | Speaker+ |
| 8 | SPK2 | Amplifier Output- | Speaker- |
| 9 | IO1 | GPIO (optional) | – |
| 10 | IO2 | GPIO (optional) | – |
| 11 | ADKEY1 | Analog Key 1 | – |
| 12 | ADKEY2 | Analog Key 2 | – |
| 13 | BUSY | Playback Status | Digital Input |
| 14 | RESET | Active Low Reset | – |
| 15 | GND | Ground | GND |
| 16 | GND | Ground | GND |

// Basic Connections: // MP3 Module VCC → Arduino 5V // MP3 Module GND → Arduino GND // MP3 Module RX → Arduino TX (Pin 11) // MP3 Module TX → Arduino RX (Pin 10) // Speaker+ → SPK1 or DAC_L // Speaker- → SPK2 or GND
#include "SoftwareSerial.h" #include "DFRobotDFPlayerMini.h"
SoftwareSerial mySoftwareSerial(10, 11); // RX, TX DFRobotDFPlayerMini myDFPlayer;
#include "SoftwareSerial.h"
#include "DFRobotDFPlayerMini.h"
//Inicia a serial por software nos pinos 10 e 11
SoftwareSerial mySoftwareSerial(10, 11); // RX, TX
DFRobotDFPlayerMini myDFPlayer;
char command;
int pausa = 0;
void setup()
{
delay (2000);
//Comunicacao serial com o modulo
mySoftwareSerial.begin(9600);
//Inicializa a serial do Arduino
Serial.begin(115200);
//Verifica se o modulo esta respondendo e se o
//cartao SD foi encontrado
Serial.println();
Serial.println(F("DFRobot DFPlayer Mini"));
Serial.println(F("Initializing DFPlayer module ... Wait!"));
if (!myDFPlayer.begin(mySoftwareSerial))
{
Serial.println(F("Not initialized:"));
Serial.println(F("1. Check the DFPlayer Mini connections"));
Serial.println(F("2. Insert an SD card"));
while (true);
}
Serial.println();
Serial.println(F("DFPlayer Mini module initialized!"));
//Definicoes iniciais
myDFPlayer.setTimeOut(500); //Timeout serial 500ms
myDFPlayer.volume(5); //Volume 5
myDFPlayer.EQ(0); //Equalizacao normal
menu_opcoes();
}
void loop()
{
//Waits for data entry via serial
while (Serial.available() > 0)
{
command = Serial.read();
if ((command >= '1') && (command <= '9'))
{
Serial.print("Music reproduction");
Serial.println(command);
command = command - 48;
myDFPlayer.play(command);
menu_opcoes();
}
//Reproduction
//Stop
if (command == 's')
{
myDFPlayer.stop();
Serial.println("Music Stopped!");
menu_opcoes();
}
//Pausa/Continua a music
if (command == 'p')
{
pausa = !pausa;
if (pausa == 0)
{
Serial.println("Continue...");
myDFPlayer.start();
}
if (pausa == 1)
{
Serial.println("Music Paused!");
myDFPlayer.pause();
}
menu_opcoes();
}
//Increases volume
if (command == '+')
{
myDFPlayer.volumeUp();
Serial.print("Current volume:");
Serial.println(myDFPlayer.readVolume());
menu_opcoes();
}
if (command == '<')
{
myDFPlayer.previous();
Serial.println("Previous:");
Serial.print("Current track:");
Serial.println(myDFPlayer.readCurrentFileNumber()-1);
menu_opcoes();
}
if (command == '>')
{
myDFPlayer.next();
Serial.println("next:");
Serial.print("Current track:");
Serial.println(myDFPlayer.readCurrentFileNumber()+1);
menu_opcoes();
}
//Decreases volume
if (command == '-')
{
myDFPlayer.volumeDown();
Serial.print("Current Volume:");
Serial.println(myDFPlayer.readVolume());
menu_opcoes();
}
}
}
void menu_opcoes()
{
Serial.println();
Serial.println(F("=================================================================================================================================="));
Serial.println(F("Commands:"));
Serial.println(F(" [1-3] To select the MP3 file"));
Serial.println(F(" [s] stopping reproduction"));
Serial.println(F(" [p] pause/continue music"));
Serial.println(F(" [+ or -] increases or decreases the volume"));
Serial.println(F(" [< or >] forwards or backwards the track"));
Serial.println();
Serial.println(F("================================================================================================================================="));
}
myDFPlayer.volume(10); // 0-30 myDFPlayer.volumeUp(); // Increase myDFPlayer.volumeDown();// Decrease
myDFPlayer.play(1); // Play specific track myDFPlayer.next(); // Next track myDFPlayer.previous(); // Previous track myDFPlayer.pause(); // Pause playback myDFPlayer.start(); // Resume playback
// Available presets: // Normal, Pop, Rock, Jazz, Classic, Bass myDFPlayer.EQ(DFPLAYER_EQ_BASS);
uint16_t track = myDFPlayer.readCurrentFileNumber(); uint16_t volume = myDFPlayer.readVolume(); uint16_t state = myDFPlayer.readState();
No account yet?
Create an Account
Recent Comments