YX5300 UART Control Serial MP3 Music Player Module For Arduino/AVR/ARM/PIC. The module is a kind of simple MP3 player device which is based on a high-quality MP3 audio chip—YX5300. It can support 8k Hz~ 48k Hz sampling frequency MP3 and WAV file formats. There is a TF card socket on board, so you can plug the micro SD card that stores audio files. MCU can control the MP3 playback state by sending commands to the module via UART port, such as switch songs, change the volume and play mode and so on. You can also debug the module via USB to UART module. It is compatible with Arduino/AVR/ARM/PIC.
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
Based on 0 reviews
Only logged in customers who have purchased this product may leave a review.
There are no reviews yet.