Getting started with serial mp3 player

Introduction

The module is a kind of simple MP3 player device which is based on a high-quality MP3 audio chip YX5300. It can support 8kHz ~ 48kHz 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.

Hardware Overview

MP3 Decoder Chip:

  • Typically uses a VS1053 or similar MP3 decoder chip.
  • Capable of decoding MP3, WAV, WMA, and other audio formats.

MicroSD Card Slot:

  • Supports microSD cards for storing audio files.
  • Allows hot-swapping of cards.

Audio Output Status LED:

  • Provides stereo audio output.
  • Can connect to speakers or headphones via a 3.5mm audio jack or through line-out pins.
  • Indicate power and playback status.

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 (<=2G), Micro SDHC Card (<=16G)
⦁ 30 class adjustable volume
⦁ UART TTL serial control playback mode, baud rate is 9600bps
⦁ Power supply can be 3.2 ~ 5.2VDC
⦁ File system format: FAT16 / FAT32

Pinout

  • VCC: Power supply input.
  • Typical Voltage: 3.3V or 5V.
  • GND: Ground connection.
  • TX: Serial data transmit pin (sends data to Arduino).
  • RX: Serial data receive pin (receives commands from Arduino).

Circuit Diagram

MP3 PIN Arduino PIN
VCC5 V
GNDGND
TXD 11
RXD 10

Programming the Serial MP3

Step 1: Open Arduino IDE

Launch the Arduino IDE software on your computer.

Step 2: Set Up the Board and Port

  • Go to Tools > Board and select your Arduino model (e.g., Arduino Uno).
  • Go to Tools > Port and select the port your Arduino is connected to.

Step 3: Upload the Code

Click the upload button (right arrow icon) in the Arduino IDE to compile and upload the code to your Arduino.

Example Code:

#include <SoftwareSerial.h>

#define MP3_RX 10
#define MP3_TX 11

SoftwareSerial mp3(MP3_RX, MP3_TX);

void setup() {
  Serial.begin(9600);
  mp3.begin(9600);
  delay(1000);
  playTrack(1);
}

void loop() {
  // Main loop
}

void playTrack(int trackNumber) {
  uint8_t command[] = {0x7E, 0xFF, 0x06, 0x03, 0x00, 0x00, trackNumber, 0xEF};
  mp3.write(command, sizeof(command));
}

Step 4: Test the Setup

After uploading the code, the MP3 player should play the first track if everything is connected properly.

    Leave a Reply

    Your email address will not be published.

    Need Help?