Playing music tracks with DF Robot MP3 Player Module

Need to play some music tracks quick with minimal hustle? Getting a MP3 Player module may be a solution one can look into! In this mini project, DF Robot MP3 Player Module is interfaced with an ATtiny85 USB Development board. (Or just say, a Digispark clone)

Overview

The MP3 Player module is able to play music tracks by itself with only a speaker as it comes preconfigured with the standard functions of a MP3 player. But for this project, I would instead control the MP3 Player module with a microcontroller.

As mentioned earlier, the DF Robot MP3 Player module was interfaced with an ATtiny85, where it will control when to play the next music track. (As we do not need to use so many IO pins, an ATtiny85 was used) A 0.96″ OLED Display is used to display the countdown to the next track, and the speaker is to output (play) the music track.

 

Goals

  • Use a micro-controller (ATtiny85) to:
    • Control the MP3 Player Module
    • Display the current track
    • Play the next music track after a specified duration

 

Parts list

  • ATtiny 85 USB Development Board (Digispark Clone)
  • DF Robot MP3 Player Module
  • 0.96″ OLED Display (B/W)
  • Speaker (0.25W)

 

DF Robot MP3 Player Module

[This section contains more information on the DF Robot’s MP3 Player Module]

mp3player_pin_map

 

Specifications

  • 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
  • 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
  • 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
  • Music format/extensions: MP3 & WAV
  • MicroSD card slot

 

Playing the tracks

The MP3 player module will only play the music track with a specific naming convention. The music tracks have to be place under the /mp3 folder, and the tracks have to be named in a XXXX.mp3 format, though the tracks can have other name after the first four numbers (For example, 0001.mp3, 0002_test_1.mp3, etc.)

(Note: When you rename the music track or place new ones in the microSD card, the MP3 Player does not seem to detect them. Therefore, copy the entire mp3 directory into your Desktop first, followed by formatting the microSD, and then placing the file back into the microSD.)

More information can be found here: https://www.dfrobot.com/wiki/index.php/DFPlayer_Mini_SKU:DFR0299

 

Code

Instead of using the provided DFPlayer library V2.0, I decided to control the MP3 Module with the low level instructions as the library will contain unnecessary/unused functions that consumes the memory space. (The ATtiny has limited memory space for sketches…)

The Digispark OLED library was used to interface with the 0.96″ Display, available here: https://github.com/digistump/DigistumpArduino

And here is the font header file (font8x16.h) required to display the text:

 

References:

Share this post:

You may also like...

Leave a Reply