YX5300 MP3 Music Player Module: Versatile Audio Control
Enhance your projects with the YX5300 MP3 Music Player Module. This versatile module offers high-quality MP3 audio playback and supports various file formats (8kHz-48kHz). Easily control playback functions (songs, volume, mode) using UART commands from your MCU (Arduino, AVR, ARM, PIC). The built-in TF card slot allows for convenient audio file storage.
Features:
- Support sampling frequency (kHz): 8 / 11.025 / 12 / 16 / 22.05 / 24 / 32 / 44.1 / 48
- Support file format: MP3 / WAV
- Support Micro SD card, Micro SDHC Card
- 30 class adjustable volume
- UART TTL serial control playback mode, baud rate is 9600bps
- Power supply can be 3.2 ~ 5.2VDC
Instructions/ helpful Code:
Save mp3 files in sd card and here is test code
send + to arduino from serial terminal of arduino for next song and – for previous song.
// 11-25-2016 test code for mp3 module
#include
SoftwareSerial mp3 ( 5 , 6 ) ;//5=rx , 6=tx
static uint8_t cmdbuf[8] = {0};
char serial_byte=0;
char song_no=1;
void command(int8_t cmd, int16_t dat)
{
delay(20);
cmdbuf [ 0 ] = 0x7e ; // byte start
cmdbuf [ 1 ] = 0xFF ; // Version
cmdbuf [ 2 ] = 0x06 ; // number of bytes command
cmdbuf [ 3 ] = cmd ; // command
cmdbuf[4] = 0x00; // 0x00 = no feedback, 0x01 = feedback
cmdbuf [ 5 ] = ( int8_t ) ( dat >> 8 ) ; // PARAMETR DAT1
cmdbuf [ 6 ] = ( int8_t ) ( dat ) ; // PARAMETR DAT2
cmdbuf [ 7 ] = 0xef ; // Bajt konczacy
for (uint8_t i = 0; i < 8; i++)
{
mp3.write(cmdbuf[i]);
}
}
void setup()
{
Serial.begin(9600);
mp3.begin(9600);
delay ( 500 ) ; // We look forward to 500ms initialization
command ( 0x09 , 0x0002 ) ; // Select SD card as a source
delay ( 200 ) ; // Czekamu 200ms for initialization
command ( 0x06 , 0x0064 ) ; // Set the volume to 30
command ( 0x03 , song_no );
}
void loop() {
if(serial_byte==’+’)
{if(song_no<11) {serial_byte=0;song_no++;command ( 0x03 , song_no );}}
else if (serial_byte==’-‘)
{if(song_no>1) {serial_byte=0;song_no–;command ( 0x03 , song_no );}}
}
void serialEvent() {
if (Serial.available()) {
serial_byte = (char)Serial.read();
if (Serial.available())
char i= Serial.read();
}
}
Package includes:
- 1x MP3 Music Player UART Control Serial Module