0

members

Easy Basics: Project 051a Serial MP3 player module by Catalex

of Acoptex.com in UNO

Basics: Project 051a

Project name: Serial MP3 player module by Catalex

Tags: Arduino Uno, Serial MP3 player module, MP3 player, Serial, module, UART Control, MP3 Music Player Module for Arduino, AVR, ARM, PIC, 3W Amplifier, UART, Catalex, Micro SD card with adapter, MP3 audio chip YX5300, YX5300

Attachments: sketch1, sketch2

In this project, you needed these parts (Dear visitors. You can support our project buy clicking on the links of parts and buying them or donate us to keep this website alive. Thank you):

1.Arduino Uno R3 (you can also use the other version of Arduino)

2. Serial MP3 player module by Catalex 1pc

3.Arduino IDE ( you can download it from here  )

4.Jumper cables F-M, M-M

5. Micro SD card with adapter 1 pc

6. USB to TTL serial converter 1 pc

General

We will learn how to connect Serial MP3 player module to Arduino board and use it.

Understanding the USB to TTL converter

You can read more about them here.

Understanding the Serial MP3 player module

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.

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

Specification:

  • Dimensions 1.93 in x 0.98 in x 0.35 in (4.9 cm x 2.5 cm x 0.9 cm)
  • Weight 0.17 oz (4.8 g)

Control interface: It is UART TTL interface. A total of four pins (GND, VCC, TX, RX), GND to ground, VCC is the power supply, TX is the TX pin of the MP3 chip, RX is the RX pin of the MP3 chip.

TF card socket: The micro sd card can be plugged in it.

Playbck indicator: Green light. If it is ready to play or it is paused, it keeps lighting. If playing, it blinks.

Headphone jack: It can be connected with the headphone or external amplifier.

Mounting holes: 4 screw mounting holes whose diameter is 2.2mm, so that the module is easy to install, easy to combine with other modules.

You can find the datasheet of YX5300 chip (Chinese) here. You can read the manual (English) of Serial MP3 player v1.0 here.

Signals and connections of the Serial MP3 player module

RX - receive pin. Connected to Arduino board TX pin.

TX - transmit pin. Connected to Arduino board RX pin.

VCC - power supply. Can be connected to +5VDC or +3.3VDC pin of Arduino board.

GND - ground. Connected to Arduino board GND pin.

Wiring

The following picture shows the needed connections with the Arduino Uno 

1. Using USB to TTL serial converter

2. Using Arduino board

Step by Step instruction

1. Using USB to TTL serial converter

  1.  You can use Micro SD card(<=2G) or Mirco SDHC card (<=32G) with this module.
  2. Most SD cards work right out of the box, but it's possible you have one that was used in a computer or camera and it cannot be read by the SD library. Formatting the card will create a file system that the Arduino can read and write to. It's not desirable to format SD cards frequently, as it shortens their life span. You’ll need a SD card reader or micro SD card adapter and computer to format your card. The library supports the FAT16 and FAT32 filesystems, but use FAT16 when possible. See additional info here.
  3. Format the SD card as FAT16 or FAT32. Insert the SD card in your computer. Go to My Computer and right click on the SD card. Select Format...  
  4. A new window pops up. Select FAT32, press Start to initialize the formatting process and follow the onscreen instructions.
  5. Copy music files to the micro SD card.The Mp3 chip reads the .mp3 or .wav alphabetically indexed, so if you need to make folders with the names 01, 02, 03... and songs must be with the names, for example - 001xxxxx.mp3, 002xxxx.mp3. 
  6. Insert the formatted micro SD card with audio tracks in the TF card socket on the back of Serial MP3 player module.
  7. Do wiring.
  8. Install the driver for your USB to TTL serial converter in your PC. You can find out more about it here.
  9. Plug in your USB to TTL serial converter to USB port of your PC.
  10. Download the sscom32E.zip. Unzip it and open sscom32E.exe file. There is also new version available here.
  11. Press the EXT button. 
  12. Select the baud rate in BaudRa field list. It should be 9600. 
  13. Tick the HEX and HexData boxes. The Serial MP3 Player module will receive a command and you can see the feedback information in the left part of the program window.
  14. Select the COM port in ComNum field list.
  15. Press the Open Com button to open communication.
  16. You can send commands now. The list of specific commands is in section 4.1 of Serial MP3 player manual.
  17. Enter the command [Select device] in Set multi char tab DATA field - "7E FF 06 09 00 00 02 EF" first. Serial MP3 Player supports micro SD card only. Press the button 1 in SEND filed to send the command to module.
  18. Enter the command [Play with index] in Set multi char tab DATA field- "7E FF 06 03 00 00 01 EF" to play the first song. Press the button 2 in SEND field to send the command to module.
  19. You can enter other commands the same way to control Serial MP3 playe module. Do not forget to tick the HEX box too.
  20. Enjoy the music from your Micro SD card.

2.Using Arduino board

  1. You can use Micro SD card(<=2G) or Mirco SDHC card (<=32G) with this module.
  2. Most SD cards work right out of the box, but it's possible you have one that was used in a computer or camera and it cannot be read by the SD library. Formatting the card will create a file system that the Arduino can read and write to. It's not desirable to format SD cards frequently, as it shortens their life span. You’ll need a SD card reader or micro SD card adapter and computer to format your card. The library supports the FAT16 and FAT32 filesystems, but use FAT16 when possible. See additional info here.
  3. Format the SD card as FAT16 or FAT32. Insert the SD card in your computer. Go to My Computer and right click on the SD card. Select Format...  
  4. A new window pops up. Select FAT32, press Start to initialize the formatting process and follow the onscreen instructions.
  5. Copy music files to the micro SD card.The Mp3 chip reads the .mp3 or .wav alphabetically indexed, so if you need to make folders with the names 01, 02, 03... and songs must be with the names, for example - 001xxxxx.mp3, 002xxxx.mp3. 
  6. Insert the formatted micro SD card with audio tracks in the TF card socket on the back of Serial MP3 player module.
  7. Do wiring.
  8. Open Arduino IDE.
  9. Plug your Adruino Uno board into your PC and select the correct board and com port
  10. Modify the sketch.
  11. Verify and upload the the sketch to your Adruino Uno
  12. Enjoy the music from your Micro SD card.

Code

1.Sketch1

Include library code. Choose which Arduino pins are going to be attached to the mp3 player and initialize the serial protocol.All the commands needed are in the manual. 

The MP3 chip undestands orders made of int array[8] with this format:

0x7E FF aa bb 00 xx yy EF 

Where:

the first and the last int are fixed with 0x7E and 0xEF values

aa is the version number, just put 0x06;

bb is the actual control command listed in the previous point

xx is first b int of data

yy is second int of data

And this is the actual function which builds the array. We just need to choose one of the #defined commands and put the value of the data.

Into the setup function we need to select the proper device for TF and give it time to settle (asynchronous process magic).In the loop, a simple play of the song labeled as 001 set.

2. Sketch2.

It's very well commented and easy to understand.

Summary

We learnt how to connect Serial MP3 player module to Arduino board and use it.

Library

  • We used SoftwareSerial library. It's installed with Arduino IDE. 
    The library has the following known limitations:
    If using multiple software serial ports, only one can receive data at a time.
    Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69).
    Not all pins on the Leonardo and Micro support change interrupts, so only the following can be used for RX: 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI).
    On Arduino or Genuino 101 the current maximum RX speed is 57600bps
    On Arduino or Genuino 101 RX doesn't work on Pin 13
    The library has the following known limitations: If using multiple software serial ports, only one can receive data at a time;Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69);Not all pins on the Leonardo and Micro support change interrupts, so only the following can be used for RX: 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI);On Arduino or Genuino 101 the current maximum RX speed is 57600bps; On Arduino or Genuino 101 RX doesn't work on Pin 13

Sketch

  • See attachment on the begining of this project


Other projects of Acoptex.com
Easy Merry Xmas to everyone of Acoptex.com, Not selected 24-12-2019

« Go back to category
Is this project fake? Report it!   
Recommend to a friend
Published at 07-12-2017
Viewed: 7181 times