(1) There is a two-way serial connection using the Rx and Tx pins. This is the most robust way with many options analogous to the DFPlayer serial connection. Unfortunately, the serial commands are different from the DFPlayer, and I'm not aware of an existing Arduino library. Fortunately, the JQ8900 seems to be based on the JQ8400. The JQ8400 does have an Arduino library, but I have not personally used it. Both the JQ8900 and the JQ8400 have manuals that have been translated into English and have good information.
With the JQ8900, I'm partial to using the serial commands directly. "AA 06 00 B0" will play the next file. I've included below some example code that will every 5 seconds play the next file in sequence.
(2) There is a single wire input mode available using the VPP pin. I haven't personally used this, but there are many examples online (unfortunately for me, mostly in Chinese)
(3) The JQ8900 has 7 trigger pins. These are great. When the IO1 pin is connected to ground the JQ8900 will play the file named 00001.mp3 (and so on). This works well for manual buttons as well as microcontrollers. With this board, I used an ATTINY85 sending a signal to an NPN transistor to connect IO1 to ground.
Audio output is either speaker output (appears to be a 3W amplifier) or line level output via DAC and ground. For both outputs, the JQ8900 collapses the right and left channels into a single mono channel. This is a disadvantage as compared to the DFPlayer, which has mono output for the speaker, but stereo ouput for line level. If you need stereo output, the JQ8900 may not be the board for you.
Links
JQ8900 Manual - English version
JQ8400 Manual - English version
excellent collection of links [Chinese] The JQ8900-16P voice module hardware usage _ Lin Zhong Qiyuan's blog - CSDN blog _jq8900
//include libraries
#include "Arduino.h"
#include "SoftwareSerial.h"
SoftwareSerial mySoftwareSerial(15, 14); // RX, TX
void setup(){
randomSeed(analogRead(0));
delay(1000);
mySoftwareSerial.begin(9600);
pinMode(4, INPUT);
}
void loop()
{
byte playnext[] = {0xAA, 0x06, 0x00, 0xB0 };
int trig = digitalRead(4);
if (trig == HIGH) {
mySoftwareSerial.write(playnext, sizeof(playnext));
delay(5000);
}
delay(100);
}
Thanks for your work!
ReplyDelete