Simple to use Arduino library to interface to JQ8400 (JQ8400-FL, JQ8400-TF) Mp3 Player Modules
How to find Tx Rx and Gnd serial pinout for routers using multimeter WiFi Marketing Solutions. Find Tx Rx and solder serial console for TP-LINK WDR4300ND WiFi router - Duration: 4:48.
Table of Contents
- Connecting To Your Arduino
- For a SoftwareSerial Connection
- For a built in additional hardware serial connection (eg ESP32)
JQ8400-TF | JQ8400-FL |
---|
Download, Install and Example
- Download: http://sparks.gogo.co.nz/JQ8400_Serial.zip
- Open the Arduino IDE (1.6+)
- Select the menu item Sketch > Import Library > Add Library
- Choose to install the JQ8400_Serial.zip file you downloaded
- Now you can choose File > Examples > JQ8400_Serial > HelloWorld
Connecting To Your Arduino
The JQ8400_Serial library can be configured to talk through any 'Serial' port, including 'SoftwareSerial', anything that is a Stream.
Most commonly you will use a SoftwareSerial with typical 'AVR' based Arduinos that only have one hardware seral port. For Arduino's (and related, like ESP32) that have more than one hardware serial port you will typically want to use one of those instead of SoftwareSerial.
The most important consideration is that if your Arduino is 5 volt, you will want to put a 1k resistor on the RX pin of the JQ8400 and the Arduino's appropriate TX pin you are using.
Below are some examples to help you.
For a SoftwareSerial Connection
This is the typical setup where you have an Arduino Uno or Nano etc which only has one 'Hardware' serial port and you use that to upload and communicate to the Arduino yourself, therefore we use a SoftwareSerial connection to communicate between the Arduino and the JQ8400 Module.
SoftwareSerial 5v Arduino, connect as follows.
JQ8400 Module | Arduino |
---|---|
RX | through a 1K Resistor then to pin 9 |
TX | pin 8 |
GND (any of) | GND |
VCC (any of) | VCC |
SoftwareSerial 3v3 Arduino, connect as follows...
JQ8400 Module | Arduino |
---|---|
RX | pin 9 |
TX | pin 8 |
GND (any of) | GND |
VCC (any of) | VCC |
You can use pins other than 9 and 8 if you wish, simply set them in your code, which looks something like this...
For a built in additional hardware serial connection (eg ESP32)
This is a typical setup where your Arduino environment has more than one 'Serial', and you want to use one of those to communicate to the JQ8400, leaving the normal 'Serial' free for uploading, communication to the Arduino etc...
Built In Additional Serial on 5v Arduino, connect as follows.
JQ8400 Module | Arduino |
---|---|
RX | through a 1K Resistor then to appropriate TX pin |
TX | RX pin |
GND (any of) | GND |
VCC (any of) | VCC |
Built In Additional Serial on 3v3 Arduino, connect as follows.
JQ8400 Module | Arduino |
---|---|
RX | appropriate TX pin |
TX | appropriate RX pin |
GND (any of) | GND |
VCC (any of) | VCC |
Example for ESP32 using Built In Serial2
JQ8400 Module | ESP32 |
---|---|
RX | GPIO17 |
TX | GPIO16 |
GND (any of) | GND |
VCC (any of) | VCC |
Example Code For 'Serial2'
Troubleshooting
People have problems in about this order...
- Incorrectly wired, make sure that TX/RX crossover and that you have GND shared
- Insufficient power supply. The power demands are not insignificant, USB from a computer... likely not good enough. Use external power.
- Trying to upload to JQ8400 while it is still connected to the Arduino. Best to unplug the JQ8400 from your project and just have it plugged into a USB cable when you want to change the files on it.
- MP3 file problem. Try re-encoding your MP3 files.
Further Documentation and Library Reference
- JQ8400_Serial Library Methods Reference (with thanks to githack.com)
JQ6500 to JQ8400 Breaking Changes
This section is for users of previous JQ6500 devices and the JQ6500_Serial library who are transitioning to a JQ8400 with JQ8400_Serial library.
As much as possible the JQ8400_Serial library should follow the same 'api', with some additions, however there are some 'breaking changes' you should be aware of...
- The initialisation has changed so that you can (must) point the JQ8400 library to a specific serial connection to the JQ8400 player, you can use SoftwareSerial, or any of your other serial ports (or any Stream). This enables you to use devices that do not support SoftwareSerial.
Example for software serial on pins 8 and 9...
Example over microcontroller's default hardware serial port...
Example over microcontroller's other hardware serial port...
- JQ8400 does not support
countFolders()
at all (AFAIK) therefore this method is not available.. - JQ8400 is not given a source for
countFiles
- that is usemp3.countFiles()
notmp3.countFiles(MP3_SRC_SDCARD)
, usemp3.setSource(MP3_SRC_SDCARD)
to change the source before counting if you are not already on that source. - JQ8400 does not support MP3_EQ_BASS