Arduino Sound Machine –

I am still receiving many requests to post an Arduino Sound Machine project. I think now is the right time to prepare a primer for beginners. First, keep your expectations low, as I don’t have anything new to share here. I just want to help you build a little voice generator project based on Arduino – that is all. Okay, let us get started!

The MP3-TF-16P Module

My project presented here is based on the old but still available serial MP3 mini module MP3-TF-16P which is an inexpensive MP3 module with an amplified monaural loudspeaker output. The module can be used as a standalone module with attached battery, speaker and push buttons or used in combination with an Arduino or any other microcontroller with serial communication (UART) capabilities. According to datasheets, this easy to use, stable, and reliable module provides perfect integrated MP3, and WMV hardware decoding.

The minuscule module has an SD Card port and reads the MP3 files from the SD Card. Moreover, this module has TX and RX pin used to communicate with a microcontroller. It also has DAC and USB Functions.

Key Features (copied from datasheet):

  • Supported sampling rates (kHz): 8/11.025/12/16/22.05/24/32/44.1/48
  • 24 -bit DAC output, support for dynamic range 90dB, SNR support 85dB
  • Fully supports FAT16, FAT32 file systems, maximum support 32G of the TF card, supports 32G of U disk, 64M bytes NORFLASH
  • A variety of control modes, I/O control mode, serial mode, AD button control mode
  • Advertising sound waiting function, the music can be suspended. when advertising is over in the music continue to play
  • Audio data sorted by folder, supports up to 100 folders, every folder can hold up to 255 songs
  • 30 level adjustable volume, 6-level EQ adjustable
  • Decodes MP3, WAV, WMA

Following is the pin out of the MP3-TF-16P module built around YX5200-24SS (core) and 8002 (audio) ICs. As you can see in the pin out data, the little MP3 module also provides two-channel (stereo) audio output under software volume control (DAC_R, DAC_L).

There are three modes for MP3-TF-16P module operation – Serial mode, AD Key mode, and I/O mode. The Serial mode supports asynchronous serial communication – UART.

  • Communication Standard: 9600 bps
  • Data bits:1
  • Checkout: None
  • Flow Control: None

You should pay attention to level conversion while in serial communication mode because the module’s external interfaces are tailored for the 3.3V TTL level. If the proposed microcontroller for your project is a 5V type – like the Arduino Uno/Nano, then it’s recommended to include a 1K resistor in series with the RX pin of the module. Recommended input voltage (Vcc) for the module is DC3.2V to 5.0V (4.2V typical). The onboard ‘bridge’ audio amplifier can drive a standard 3W rated loudspeaker (refer datasheet to learn more about the loudspeaker selection).

Related Web Links:

Arduino Integration

To use with an Arduino board, you’ll need only VCC, GND, SP+, SP-, TX and RX pins of the module (other pins are optional). The entire wiring is quite straightforward. The module serially communicates via its pins marked TX and RX with the Arduino Uno. In the current setup, pins D10 and D11 of the Uno act as programmable TX and RX under the Software Serial library. The loudspeaker output pins (SPK_1 and SPK_2) of the module are routed to a small loudspeaker. After copying some MP3 files to the SD card and uploading the Arduino Sketch, you can see that the red LED on the module starts blinking during the playback operation.

Note that you can only use a micro SD card with the module (1GB is enough for a quick start). Most micro SD cards work right out of the box, but there is a chance that a previously used card cannot be read by the setup. If so, try formatting the memory card using a micro SD card adapter/reader and your computer. The setup supports the FAT16 and FAT32 file systems. Plug the micro SD card in your computer, go to My Computer, right click on the SD card, and select Format…

Next, make a new folder named MP3 on that Micro SD card and copy your mp3 files there. The MP3 files should have the names “0001 Name.mp3″,”0002 Name.mp3” and so on. Remember, the order you copy the MP3 files into micro SD card will affect the playback order, ie play (1) function in the Arduino Sketch used here will play the first MP3 file copied into the micro SD card.

Below you can see the quick test Arduino Sketch used by me with the aforesaid hardware setup. Frankly, this Arduino Sketch is an adapted version of a code acquired from web. The Arduino Sketch needs three libraries – “Arduino h”, “SoftwareSerial h” and “DFRobotDFPlayerMini.h”.

After downloading & installing the third library, simply copy and paste the Arduino Sketch and Upload it (library download link


#include "Arduino.h"

#include "SoftwareSerial.h"

#include "DFRobotDFPlayerMini.h" // Requisite Library

SoftwareSerial mySoftwareSerial(10, 11); // RX, TX

DFRobotDFPlayerMini myDFPlayer;

void printDetail(uint8_t type, int value);

void setup()





  Serial.println(F("MP3 TF 16P Module Test"));

  Serial.println(F("Initializing MP3 TF 16P >>> (May take a couple of seconds)"));

  if (!myDFPlayer.begin(mySoftwareSerial)) { 

    Serial.println(F("Unable to begin:"));

    Serial.println(F("1.Please recheck the connection!"));

    Serial.println(F("2.Please insert the SD card!"));



  Serial.println(F("MP3 TF 16P Module Active!"));

  myDFPlayer.volume(30);  //Set volume value to 30;  //Play the first mp3


void loop()


  static unsigned long timer = millis();

  if (millis() - timer > 5000) {

    timer = millis();

   //;  //Play next mp3 every 5 seconds


  if (myDFPlayer.available()) {


    /*Print the detail message from MP3 TF 16P Module to handle different errors and states*/



void printDetail(uint8_t type, int value){

  switch (type) {

    case TimeOut:

      Serial.println(F("Time Out!"));


    case WrongStack:

      Serial.println(F("Stack Wrong!"));


    case DFPlayerCardInserted:

      Serial.println(F("Card Inserted!"));


    case DFPlayerCardRemoved:

      Serial.println(F("Card Removed!"));


    case DFPlayerCardOnline:

      Serial.println(F("Card Online!"));


    case DFPlayerPlayFinished:



      Serial.println(F(" Play Finished!"));


    case DFPlayerError:


      switch (value) {

        case Busy:

          Serial.println(F("Card not found"));


        case Sleeping:



        case SerialWrongStack:

          Serial.println(F("Get Wrong Stack"));


        case CheckSumNotMatch:

          Serial.println(F("Check Sum Not Match"));


        case FileIndexOut:

          Serial.println(F("File Index Out of Bound"));


        case FileMismatch:

          Serial.println(F("Cannot Find File"));


        case Advertise:

          Serial.println(F("In Advertise"));











This is the Serial Monitor window of the above Arduino Sketch:

And this is my quick test setup:

Honestly, I detested the tinny monaural MP3 output from my little mylar loudspeaker. So, I looked for an easy way to get a stereophonic output and found a great trick! I hooked the output pins DAC_R and DAC_L of the MP3-TF-16P module to a somewhat ‘hacked’ PC multimedia speaker’s signal input points L and R through 100Ω resistors, while its common signal input point (G) is connected to GND. And then, the existing monophonic loudspeaker output pins (SPK_1 and SPK_2) of the module are wired to a 2-pin screw terminal as an optional monophonic sound outlet. Relax, the revised setup plays well!

This is the PC multimedia speaker system used by me. Luckily, it has its own USB power supply.

What’s Next?

The original DFPlayer module (from DFRobotics) is a great little MP3 player module at a fantastic price. The performance of this cheap MP3-TF-16P Module is also quite good. Schematic of this MP3-TF-16P module is basically a near-replica of the official reference design depicted by the YX5200-24SS MP3 player chip vendor (look below) but it employs a bogus class AB (not D) 8-pin 8002 audio amplifier chip in BTL (bridge tied load) mode.

Let it be! You just learned how to connect a MP3-TF-16P mini MP3 player module to an Arduino Uno and how to start the play. Obviously, interfacing a micro SD card-based MP3 player module to an Arduino overcomes opens a new world of real digital audio. You can edit this basic idea to use in many projects that need customized voice-based annunciators.

Final Words

The Mini MP3 Player module introduced here is a small and cheap one with a direct output for one loudspeaker. The module can also be used as a standalone module with attached battery, speaker, and push buttons. It is worth noting that there are so many variants of this super cute module, including fakes. I observed those fakes did not support all the features of the latest DFR library (the fakes work but only in limited form). Furthermore, if you hear very loud noises during playback, you will need to separate the module power from Arduino power and/or simply put down the module’s Vcc to 4.2VDC. This is a useful link to the DFPlayerMini cheat sheet

By the way, I have not tried yet but here is another simple (adapted) Arduino Sketch based on an example code acquired from the original vendor’s website. I think the library included in this code is the precursor of the most recent DFRobot library!



void setup() {

Serial.begin (9600);

mp3_set_serial (Serial); // TX0 and RX1

mp3_set_volume (15);


void loop() {

mp3_play (1); //play 0001.mp3

delay (10000); //10 sec time delay to finish playing

mp3_play (2);

delay (5000);

 mp3_play (3);
 delay (3000);

 mp3_play (12); //play 0012.mp3
 delay (8000);

 mp3_play (16); //play 0016.mp3
 delay (6000);

 mp3_play (30); //play 0030.mp3
 delay (9000);


Thanks for reading! Next time I will come up with a real-world do it yourself project based on a standardized MP3 player module. The best way to learn something is to create a project with it. So, stay tuned!

Leave a Comment