This modules is a simple MP3 player device which is based on a high-quality MP3 audio chip. 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 in the micro SD card that stores audio files. MP3 Playback can be controlled via a Microcontroller such as an Arduino by sending commands to the module via serial UART port, e.g. switch songs, change the volume, play mode and so on. It is compatible with most Microcontrollers capable of serial communication at 9600 BAUD (Arduino / AVR / ARM / PIC). The module also includes a 3 Watt amplifier and comes complete with a 1 Watt speaker.
For Arduino users we have created an exclusive library (HCMP3) which can be downloaded from the software section of our support forum (see link below).
- Product code: HCMODU0138
- Compatible with Arduino UNO / Leonardo / Mega2560 / DUE
- Supports sampling frequency (kHz): 8 / 11.025 / 12 / 16 / 22.05 / 24 / 32 / 44.1 / 48
- Supports file formats: MP3 / WAV
- Support Micro SD card, Micro SDHC Card
- On-board 3-watt mono amplifier
- On-board speaker interface XH2.54-2P, can connect to external speakers such as 8 ohm 1 to 3-watt
- 30 class adjustable volume
- UART TTL serial control playback mode, baud rate is 9600bps
- Serial communication format: 8N1
- Control logic interface can be 3.3V / 5V TTL
- Working voltage: 3.7 - 5.25VDC
- On-board headphone jack for connection to headphones or external amplifier
- On-board TF card connector
Return bytes from a command status query are preceded with the original status command. For Example:
To get the current play status send the command: 7E 02 10 EF
If the module is currently playing a file it will return: 7E 02 00 EF 7E 03 10 01 EF
If the module is currently paused it will return: 7E 02 00 EF 7E 03 10 02 EF
Example Arduino Sketch Using HCMP3 Library:
/* FILE: HCMP3_Example.cpp
AUTHOR: Andrew Davies
09/05/19 version 1.0: Original version
This example sketch demonstrates how to use the HCMP3 library to control
an audio playback device.
Currently this library supports the following module:
Serial MP3 playback module with 1W speaker (SKU: HCARDU0138)
Connect the above module as follows:
Within the HCMP3 library folder you will find a folder called 'MP3_Files'
Copy the contents of this folder to the root directory of your flash card.
This library is provided free to support the open source community.
We spend most of our time creating free content like this because we genuinely
want to support the open source community. PLEASE SUPPORT US so that we can
continue to create free content by purchasing products from our store -
You may copy, alter and reuse this code in any way you like, but please leave
reference to HobbyComponents.com in your comments if you redistribute this code.
This software may not be used directly for the purpose of selling products that
directly compete with Hobby Components Ltd's own range of products.
THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES,
INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY
/* Include the library */
/* Digital pins used for serial communication */
#define RX_PIN 2
#define TX_PIN 3
/* Create an instance of the library */
HCMP3 HCMP3(TX_PIN, RX_PIN);
/* Get the current status of the module */
/* Change the volume level */
Serial.print("Setting volume level to....");
/* Play the first file */
Serial.println("Playing first file on card");
/* Play the next file */
Serial.println("Playing next file");
/* Play the previous file */
Serial.println("Playing previous file");
/* Play the first file in folder 1 */
Serial.println("Playing file 1 in folder 1");
/* Pause playback */
/* Resume playback */
/* Turn the volume down in increments */
for(byte i = 0; i < 20; i++)
/* Turn the volume up in increments */
for(byte i = 0; i < 20; i++)
/* Stop the playback */
/* Prints out the current playback state */
/* Prints out the current flash card state */
The HCMP3 Arduino library for the above sketch can be downloaded from the software section of our support forum here:
http://forum.hobbycomponents.com/viewto ... =58&t=2884
Disclaimer: Libraries, example code, and diagrams within this forum thread are provided as an additional free service by Hobby Components and are not sold as part of any product. We do not provide any guarantees or warranties as to their accuracy or fitness for purpose.
Descriptions and diagrams on this page are copyright Hobby Components Ltd and may not be reproduced without permission.