The JQ6500 MP3 Player modules can be controlled over a Serial (UART) communications protocol.
If you are using an Arduino, save yourself the trouble and just grab the library already written for you – Arduino JQ6500 MP3 Player Library – the library handles everything on this page for you, so you don’t need to understand any of this.
Voltage Level
Communications is UART to UART at 3.3v = HIGH.
If you are communicating from a 5v device, it is sufficient to put a 1k resistor in series between the TX on your 5v device and the RX on the JQ6500, the JQ6500 TX can be connected directly to your 5v RX, no other level conversion is necessary.
General Form Of Communication
The device (appears to) accepts commands at any time. Commands consist of 4 or more bytes,
- Each command starts with byte 0x7E
- Followed by a byte indicating the number of bytes which follow including the terminating byte (including termination)
- Followed by a byte indicating the command to execute
- Followed by an optional first argument byte
- Followed by an optional second argument byte
- Followed by the byte 0xEF as the termination byte
for example, the command ”PLAY” (0x0D) is constructed with the following 4 bytes
- 0x7E – Start Byte
- 0x02 – 2 Bytes Follow
- 0x0D – Command Byte
- 0xEF – Termination Byte
and the command to play a specific file (0x012) has two arguments (folder number and file number) so it looks like this
- 0x7E – Start
- 0x04 – 4 Bytes Follow
- 0x12 – Command
- 0x02 – 1st Argument (in this case, “Folder 02”)
- 0x03 – 2nd Argument (in this case, “File 003”)
- 0xEF – Termination Byte
Please note that you are not sending ASCII characters here, but those raw bytes (ie 0x7E is 8 bits, not 4 characters!).
Normal commands provide potential response of two ascii characters “OK” and maybe “ERROR”, but generally ignore responses to normal commands (it’s best to clear your serial buffer before and after issuing a normal command).
Query commands return an unsigned integer as hexadecimal characters (ie if the response is the integer 1234, then the response is the 4 ASCII characters “04D2”, so yes, the commands are sent as raw bytes, and the response is ASCII).
Control Commands
- 0x0D – Play, No Arguments
- 0x0E – Pause, No Arguments
- 0x01 – Next, No Arguments
- 0x02 – Prev, No Arguments
- 0x03 – Play file by index number, 2 Arguments. The index number being the index in the FAT table, or upload order. Argument 1 = high 8 bits of index number, Argument 2 = low 8 bits of index number.
- 0x0F – Change folder. 1 Argument. Argument 1 = 0x01 for Next Folder, 0x00 for Previous Folder.
- 0x12 – Play file by folder and name, 2 Arguments. This applies to SD Card only where you have folders named 01 through 99, and files in those folders named 001.mp3 through 999.mp3. Argument 1 = folder number, Argument 2 = file number. Note that arguments are a single byte, so effectively I think you can only access up to file 255.mp3 in any folder.
- 0x04 – Vol Up, No Arguments
- 0x05 – Vol Dn, No Arguments
- 0x06 – Set Volume, 1 Argument. Argument 1 = byte value from 0 to 30
- 0x07 – Set Equalizer Mode, 1 Argument. Argument 1 = byte value 0/1/2/3/4/5 for Normal/Pop/Rock/Jazz/Classic/Bass (actually “Base” in the datasheet but I think they mean Bass)
- 0x11 – Set Loop Mode, 1 Argument. Argument 1 = byte value 0/1/2/3/4 for All/Folder/One/Ram/One_Stop – I don’t know what “Ram” is, it’s not Random, it seems the same as “One”.
- 0x09 – Set the source, 1 Argument. Argument 1 = 0x01 for SDCard and 0x04 for the on board flash memory.
- 0x0A – Sleep mode, No Arguments. Supposedly a low power mode.
- 0x0C – Reset, No Arguments. It’s advisable to wait 500mS or so after issuing this.
Query Commands
None of the query commands have arguments.
- 0x42 – Get Status. Response integer (as hexadecimal ascii characters) 0/1/2 for Stopped/Playing/Paused. Note that built in memory never “Stops”, it only “Pauses” after playing a track. And when playing you occasionally seem to get the odd erroneous “Paused” response, it may be power issues, but in the Arduino library I sample this command several times to get a “consensus” of results!
- 0x43 – Get Volume. Response integer (as hexadecimal ascii characters) from 0 to 30.
- 0x44 – Get Equalizer. Response integer (as hexadecimal ascii characters) from 0 to 5 (see set equalizer above for definitions).
- 0x45 – Get Loop. Response integer (as hexadecimal ascii characters) from 0 to 4 (see set loop above for definitions).
- 0x46 – Get Version. Response appears to be an integer (as hexadecimal ascii characters).
- 0x47 – Count files on SD Card. Response integer (as hexadecimal ascii characters).
- 0x49 – Count files in on board flash memory. Response integer (as hexadecimal ascii characters).
- 0x53 – Count folders on SD Card. Response integer (as hexadecimal ascii characters).
- 0x4B – Get the index number (FAT table) of the current file on the SD Card. Response integer (as hexadecimal ascii characters).
- 0x4D – Get the index number MINUS ONE (!!) of the current file on the on board memory. Response integer (as hexadecimal ascii characters).
- 0x50 – Get the position in seconds of the current playing file. Response integer (as hexadecimal ascii characters).
- 0x51 – Get the total length in seconds of the current playing file. Response integer (as hexadecimal ascii characters).
- 0x52 – Get the name of the current file on the SD Card. Response ASCII characters. Note that this will return a name even if the file is not playing, even if a file from the on board memory is playing, even if the SD Card has been removed… ! It’s also not really the file name, it lacks the file extenstion separator for a start (.), and is probably 8[nodot]3 max length.