Embedded MP3 module. Part 2 - Configuration of the module, Software
Part 1 - Schematic
In the mode Pin-to-Pin (mode 1) to perform a song you have to select the track number using binary inputs IN1, IN2, IN3, IN4, IN5 and IN6 and then run the selected file simply giving a ground pulse on the PLAY line. Applying logical zero on the lines VOL_UP and VOL_DOWN, you can respectively increase or decrease the volume.
In serial mode (mode 0) commands are very similar to the Pin-to-Pin, except for the choice of the MP3 file, which must take place in several stages within a time limit fixed in the configuration file. The special command # allow to insert the name of the track and the second special command * and the input.
For example, to play the file 65.mp3 you must perform the following steps:
Mixed mode (Mode 2) allows to give orders both serial and pin-to-digital input pin. In this case the number of inputs usable is 4, for a total of 16 tracks addressable with Pin-to-Pin mode.
The names of MP3 files must be a number from 0 to 65535 followed by the extension .mp3 (for example, 0.mp3, 1.mp3, 2.mp3, 3.mp3 16.mp3 … … 65535.mp3).
The configuration of the module is made with a file (config.txt) saved on the memory card. The firmware of the MP3 player is able to recognize a new memory card and create the configuration file with default parameters, this is accomplished even when the configuration file has been damaged in some part. The generated file will be written to the root of the micro SD. The file consists of two parts: the first introductory to the project and useful to recall the description of the pins and some important notes, a second corresponding to the configuration section. In particular, all lines marked with the symbol “#” correspond to comments, the other concerning the configuration parameters.
The configuration parameters are as follows:
Mode: lets you choose the mode of operation.
0 for the serial mode;
Parameters for Serial Mode or Mixed:
Baud rate: indicates the communication speed of serial port (allowed values are: 1,200, 2,400, 9,600 (default), 19,200 and 115,200 bps).
Parameters for Pin-to-Pin and Mixed mode:
Time Wait Play and Time Wait Vol: are similar and the value assigned corresponds to the time that elapses before the next state change is detected, and their value can vary between 1 and 5,000 ms (the default is 100).
Play: If set to 0 the change of state of the input pins Play (with a running track) is the pause function as long as the track number with the selected input pin (IN1, IN2, IN3, IN4 , IN5 and IN6) is not changed, if the value of the track changes, play action corresponds to the stop function. If the parameter is set to 1, the associated action at play when it is running a song is always and only stop.
Mixed mode-specific parameters (for enabling and disabling the action of the input pin):
0: Ignore the action
Source code and HEX-file - download
PCB Pricing: https://jlcpcb.com/quote
News on theme: