MP3 Trigger Hookup Guide V24

Pages
Contributors: Joel_E_B, robertsonics
Favorited Favorite 5

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.

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.