MP3 Trigger Hookup Guide V24
Serial Control Protocol
The MP3 Trigger comes with a full duplex 3.3-5V serial TTL interface that allows for control of all the MP3 tracks (up to 256) on the microSD card as well as volume, and for monitoring input trigger activity. You can use an FTDI Basic or connect to any serial interface that uses the format: 8-bits, 1-start, 1-stop, no parity, flow control = none. The serial port baud rate defaults to 38.4kbps (i.e. 38400 baud), but can be changed using the initialization file. All commands to the MP3 Trigger are 1 or 2 bytes in length.
1-byte commands are upper case ASCII characters. 2-byte commands start with an ASCII character. Those starting with an upper case character use an ASCII value (โ0โโโ9โ) as the second byte. (These commands can be typed on a keyboard.) 2-byte commands starting with a lower case character require a binary value (0 โ 255) as the second byte.
Bytes sent to the MP3 Trigger are not echoed. If echoing is required, set your terminal program to echo locally.
Command Summary
Command: Navigation โ Start/Stop
Number of bytes: 1
Command byte: โOโ
Data byte: none
Comments: This command performs the same function as pushing the on-board nav switch center position. If the current track is playing, it stops. If the current track is stopped, it will restart from the beginning.
Command: Navigation โ Forward
Number of bytes: 1
Command byte: โFโ
Data byte: none
Comments: This command performs the same function as pushing the on-board nav switch right position. The next
MP3 track in the directory will be started.
Command: Navigation โ Reverse
Number of bytes: 1
Command byte: โRโ
Data byte: none
Comments: This command performs the same function as pushing the on-board nav switch left position. The
previous MP3 track in the directory will be started.
Command: Trigger (ASCII)
Number of bytes: 2
Command byte: โTโ
Data byte: N = ASCII โ1โ through โ9โ
Comments: If it exists, the track with the filename โ00Nxxxx.MP3โ will be started, where N is the data byte.
xxxx can be any valid filename characters of any length.
Command: Trigger (binary)
Number of bytes: 2
Command byte: โtโ
Data byte: n = 1 to 255
Comments: If it exists, the track with the filename โNNNxxxx.MP3โ will be started, where NNN is the ASCII equivalent of the data byte 'n' with leading 0s. xxxx can be any valid filename characters of any length.
Command: Play (binary)
Number of bytes: 2
Command byte: โpโ
Data byte: n = 0 to 255
Comments: If it exists, the nth track in the directory will be played. The total number of available tracks in the directory can be retrieved using Status Request command below.
- "009 SOMETHING.MP3"
- "005 START.MP3"
- "001 SPARK.MP3"
- "002 FUN.MP3"
You decide to send the hex representation of the command byte and data byte. The Play command 'p' as
0x160
with data byte '1' as 0x1
are sent to the MP3 trigger. The MP3 trigger will begin playing in the order that it was saved to the microSD card. As opposed to playing the track number associated with the number 1, it will begin playing "009 SOMETHING.MP3". To play "001 SPARK.MP3", you would need to send the play command as 0x160
with data byte '3' as 0x3
since it was the 3rd track to be saved in the directory.The Trigger command plays by the track based on the file name. Using the Trigger command 'T' as
0x124
with data byte '1' as 0x61
, the board will play "001 SPARK.MP3". Remember, the upper case ASCII character requires an ASCII value between '1' through '9' as the second data byte. Using the Trigger command 't' as 0x160
with data byte '1' as 0x1
, the board will play "001 SPARK.MP3". As noted earlier, the lower case ASCII character requires a binary value between 0 to 255 as the second data byte.
Command: Set Volume (binary)
Number of bytes: 2
Command byte: โvโ
Data byte: n = 0 to 255
Comments: The VS1053 volume will be set to the value n. Per the VS1053 datasheet, maximum volume is 0x00, and
values much above 0x40 are too low to be audible.
Command: Status Request (ASCII)
Number of bytes: 2
Command byte: โSโ
Data byte: N = ASCII โ0โ through โ1โ
Comments: If N = โ0โ, the MP3 Trigger will respond with a version string. If N = โ1โ, the MP3 Trigger
will respond with the total number of tracks on the installed microSD card, in ASCII. Both responses will be preceded by the โ=โ character.
Command: Quiet Mode (ASCII)
Number of bytes: 2
Command byte: โQโ
Data byte: N = ASCII โ0โ or โ1โ
Comments: If N=โ1โ, Quiet mode is turned on. If N=โ0โ, Quiet mode is turned off. Default state is off.
MP3 Trigger Outgoing Message Summary
The MP3 Trigger sends the following ASCII messages:
- โXโ: When the currently playing track finishes.
- โxโ: When the currently playing track is cancelled by a new command.
- โEโ: When a requested track doesnโt exist (error).
In response to a Status Request Command, data byte = โ0โ, the MP3 Trigger sends an 18-byte version string: e.g. โ=MP3 Trigger v2.50โ. In response to a Status Request Command, data byte = โ1โ, the MP3 Trigger sends the number of MP3 tracks on the currently installed microSD card: e.g. โ=14โ.
In Quiet Mode only, when one or more trigger inputs are activated, the MP3 Trigger sends โMโ followed by a 3-byte bit mask indicating which triggers were activated:
- Data byte 0: TRIG01 through TRIG08
- Data byte 1: TRIG09 through TRIG16
- Data byte 2: TRIG17 and TRIG18
A value of 1 in a bit position indicates that the corresponding trigger input was activated.