10

members

Easy Basics: Project 065a MP3-TF-16P mini MP3 player module

of Acoptex.com in UNO

Basics: Project 065a

Project name: MP3-TF-16P Mini MP3 Player Module

Tags: Arduino Uno, Arduino, voice playback module, Mini MP3 Player Module, Simplified Output Speaker, MP3-TF-16P, DFPlayer, DFPlayer Mini SKU, DFR0299

Attachments:  sketch1, sketch2, library1

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.  MP3-TF-16P mini MP3 player module 1 pc

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

4.Jumper cables M-M

5. Breadboard 1 pc

6. Momentary switch (button) 4-20pcs

7. Micro SD card with adapter 1 pc

8. Resistor 2 pcs (2pcs 2 KOhm)

General

We will learn how to connect  MP3-TF-16P mini MP3 player module to Arduino board and use it.

Understanding the MP3-TF-16P mini MP3 player module

MP3-TF-16P (DFPlayer Mini SKU:DFR0299)  Mini MP3 Player For Arduino is a small and low price MP3 module with an simplified output directly to the speaker. The module can be used as a stand alone module with attached battery, speaker and push buttons or used in combination with an Arduino UNO or any other with RX/TX capabilities. Decodes MP3, WAV, WMA. 

Specification:

  • 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 system, maximum support 32G of the TF card, support 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

Application:

  • Car navigation voice broadcast;
  • Road transport inspectors, toll stations voice prompts;
  • Railway station, bus safety inspection voice prompts;
  • Electricity, communications, financial business hall voice prompts;
  • Vehicle into and out of the channel verify that the voice prompts;
  • The public security border control channel voice prompts;
  • Multi-channel voice alarm or equipment operating guide voice;
  • The electric tourist car safe driving voice notices;
  • Electromechanical equipment failure alarm;
  • Fire alarm voice prompts;
  • The automatic broadcast equipment, regular broadcast.

You can find datasheet of audio power amplifier 8002A here. You can find the specification of YX5200-24SS IC here. Specification of the MP3-TF-16P mini MP3 player module is here.

There are three work modes of MP3-TF-16P mini MP3 player module operation:

1) Serial mode

  • Support for asynchronous serial communication mode via PC serial sending commands 
  • Communication Standard:9600 bps 
  • Data bits :1 
  • Checkout :none 
  • Flow Control :none 

 

 

Serial Control Cmd

Serial Query Cmd

2) AD KEY Mode

We use the AD module keys, instead of the traditional method of matrix keyboard connection, it is to take advantage of increasingly powerful MCU AD functionality, Our module default configuration 2 AD port, 20 key resistance distribution.

3) I/O Mode

The most simple way to use this module. 

Signals and connections of the MP3-TF-16P mini MP3 player module

VCC - power supply 3.2 - 5V DC. Connected to Arduino Uno 5V pin.

GND - ground. Connected to Arduino Uno ground pin.

RX - UART serial input (receive pin)

TX - UART serial output (transmit pin)

DAC_R - stereo audio output right channel. drive earphone and amplifier

DAC_I - stereo audio output left channel. drive earphone and amplifier

SPK_1 - mono speaker+. drive speaker less than 3W

SPK_2 - mono speaker-. drive speaker less than 3W

BUSY - playing status. LOW means playing, HIGH means not playing

USB- - USB-DM. USB port

USB+ - USB+DP. USB port

ADKEY_2 - AD port 2, trigger plays fifth segment

ADKEY_1 - AD port 1. trigger plays first segment

IO_2 - trigger port 2. short press to play next, long press to increase volume

IO_1 - trigger port 1. short press to play previous, long press to decrease volume

Wiring

1) Serial mode

Note: if you find the noise is quite loud, then you could attach an 1KOhm resistor between Arduino Uno Tx pin and MP3-TF-16P mini MP3 player module Rx pin; 1KOhm resistor between Arduino Uno Rx pin and MP3-TF-16P mini MP3 player module Tx pin. 

2) AD KEY Mode

3) I/O Mode

Note: short time press means selection of previous/next and long time press means selection of vol- / vol + 

Step by Step instruction

  1.  You can use Micro SD card(<=2G) or Mirco SDHC card (<=32G) with this module.
    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.
    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. 
    You can use Micro SD card with this module only.
  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.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. 
  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. Make a folder named MP3 on Micro SD card and copy your mp3 files there. MP3 files should have the names "0001.mp3","0002.mp3" and so on. Songs can be also named like 0001Name.mp3. NOTE: The order you copy the mp3 into micro SD card will affect the order mp3 played, which means play (1) function will play the first mp3 copied into micro SD card. For Mac User - NOTE: If you are using Mac OS X to copy the mp3, the file system will automatically add hidden files like: "._0001.mp3" for index, which this module will handle as valid mp3 files. It is really annoying. So you can run following command in terminal to eliminate those files: dot_clean /Volumes/. Please replace the to the volume name of your SD card.
  6. Insert the TF card which stores your mp3 files into the TF card slot.
  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. Verify and upload the sketch to your Adruino Uno.
  11. Open Serial monitor with 115200 baudrate. 

Code

We have attached two different sketches:

  1. GetStartedsketch switching to next song every 3 seconds
  2. FullFunctionsketch  including all the functions

Summary

We learnt how to connect MP3-TF-16P mini MP3 player module to Arduino board and use it.

Library

  • All libraries attached on the begining of the project description
  • DFRobotDFPlayerMini library. Download, unzip  and add to libraries in our PC, for example C:\Users\toshiba\Documents\Arduino\libraries. This link you can find in Preferences of Adruino IDE program which installed in your PC. You can read about it here.  
  • SoftwareSerial library included in 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 57600bpsOn 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. You can read about it here.

Sketch

  • See attachments on the begining of this project


Other projects of Acoptex.com
Medium Basics: Project 083w Sipeed Maixduino board - Using PlatformIO IDE of Acoptex.com in Sipeed Maixduino 08-08-2019
Medium Basics: Project 083e Sipeed Maixduino board - Uploading MaixPy of Acoptex.com in Sipeed Maixduino 04-08-2019
Medium Basics: Project 083f Sipeed Maixduino board - Using MycroPython of Acoptex.com in Sipeed Maixduino 04-08-2019

Published at 19-03-2018
Viewed: 20684 times