Example5: Kitchen sink example showing setting of volume, equalizer, get song name, get song count, get
firmware version, etc.
Example6: Change the I C address of the MP3 Trigger. Allows multiple Triggers to live on the same I C
bus.
Example7: Shows how to start the library using a different Wire port (for example Wire1).
Example8: Demonstrates how to check for the end-of-song interrupt and begin playing the song again.
Command Set
The SparkFun Qwiic MP3 Trigger library takes care of all these commands for you. However, if you want to
implement your own interface, the following commands are available (see list below). The Qwiic MP3 Trigger uses
standard I C communication to receive commands and send responses. By default, the unshifted I C address of
the Qwiic MP3 Trigger is 0x37 . The write byte is 0x6E and the read byte is 0x6F .
Here is an example I C transaction showing how to set the volume level to 10:
Here is an example I C transaction showing how to read the device ID (0x39):
The following commands are available:
STOP 0x00 - Stops any currently playing track
PLAY_TRACK 0x01 [TRACKNUMBER] - Play a given track number. For example 0x01 0x0A will play the 10th
MP3 file in the root directory.
PLAY_FILENUMBER 0x02 [FILENUMBER] - Play a file # from the root directory. For example 0x02 0x03 will
play F003.mp3.
PAUSE 0x03 - Pause if playing, or starting playing if paused
PLAY_NEXT 0x04 - Play the next file (next track) located in the root directory
PLAY_PREVIOUS 0x05 - Play the previous file (previous track) located in the root directory
SET_EQ 0x06 [EQ_SETTING] - Set the equalization level to one of 6 settings: 0 = Normal, 1 = Pop, 2 =
Rock, 3 = Jazz, 4 = Classical, 5 = Bass. Setting is stored to NVM and is loaded at each power-on.
SET_VOLUME 0x07 [VOLUME_LEVEL] - Set volume level to one of 32 settings: 0 = Off, 31 = Max volume.
Setting is stored to NVM and is loaded at each power-on.
GET_SONG_COUNT 0x08 - Returns one byte representing the number of MP3s found on the microSD
card. 255 max. Note: Song count is established at power-on. After loading files on the SD card via USB be
sure to power-cycle the board to update this value.
GET_SONG_NAME 0x09 - Returns the first 8 characters of the file currently being played. Once the
command is issued the MP3 Trigger must be given 50ms to acquire the song name before it can be queried
with an I C read.
GET_PLAY_STATUS 0x0A - Returns a byte indicating MP3 player status. 0 = OK, 1 = Fail, 2 = No such
file, 5 = SD Error.
GET_CARD_STATUS 0x0B - Returns a byte indicating card status. 0 = OK, 5 = SD Error. Once the
command is issued the MP3 Trigger must be given 50ms to acquire the card status before it can be queried
with an I C read.
GET_VERSION 0x0C - Returns two bytes indicating Major and Minor firmware version.
CLEAR_INTERRUPTS 0x0D - Clears the interrupt bit.
2 2
22
2
2
2
2