当前位置:网站首页>Arduino uno connected to jq8900-16p voice broadcast module

Arduino uno connected to jq8900-16p voice broadcast module

2022-06-11 02:53:00 Three stinky ginger

Arduino Uno Pick up JQ8900-16p Voice broadcast module

Preface

​ Record an easy-to-use voice broadcast module JQ8900, This module is cheap ( You can buy it for a dozen dollars ), Easy to use .

​ Besides , This module also has the following advantages :

​ ① Equipped with supporting software, it can support text to voice , Generate mp3 File format , Can be like U Copy to the module like a disk , And choose to play a... In the code mp3 file ;

​ ② There are many voices to choose from , Adjustable volume 、 Tone and speed of sound .

One 、 Required materials and wiring

Main materials required :

1.Arduino Uno Development board ;

2.JQ8900-16p Voice broadcast module ( Including horn ) One ;

3. There are several DuPont lines

The voice broadcast module is shown in the figure below :
 Insert picture description here

take mp3 The file copy enters the memory connection of the module : Find a suitable data cable , End to end JQ8900 modular , The other end is connected to the computer USB mouth , Just copy the file directly .
 Insert picture description here

Arduino control JQ8900 Module wiring :

Arduino UnoJQ8900-16p
3VPP
GNDGND
5VDC-5V
JQ8900-16p horn
SPK- Positive pole
SPK+ Negative pole

 Insert picture description here
( The white one is the horn )

Two 、 Code

Select the corresponding... Through serial port control mp3 File playback :

/*  Integrate system functions : 1. Voice prompt - A serial port choice mp3 Play  */

char val="";// Receive the value sent from the serial port 

int pin = 3;// Pick up vpp Pin 

void setup()
{
    
    pinMode(pin,OUTPUT);
    Serial.begin(9600);// set baud rate 
    Serial.println(" Please input the data you want to send :");// Prompt character 
}
 
void loop()
{
    
  while(Serial.available()>0){
    // Check whether there is data in the serial port buffer , Return if any 1, No is 0.
    val = char(Serial.read());//Serial.read() Read data from the serial port buffer bit by bit 
    delay(10);

  if(val=='S')
    Sys_start();
  if(val=='T')
    Say_thanks();
  }

}

// System started - Voice prompt 
void Sys_start()
{
    
    // Set the volume to 20
    SendData(0x0a);    // Clear numbers 
    SendData(0x02);    // The volume 20
    SendData(0x00);
    SendData(0x0c);    // set volume 
    delay(2000);    // Time delay 
    
    // Select a track 1 Play 
    SendData(0x0a);// Clear numbers 
    SendData(0x01);// Track number , Corresponding 00001.mp3
    SendData(0x0b);// Music selection and playback 
    delay(2000);
    
    // Start playing 
    //SendData(0x11);// Start playing 
    //delay(2000);
}

// Thank you for using. - Voice prompt 
void Say_thanks()
{
    
    // Set the volume to 20
    SendData(0x0a);    // Clear numbers 
    SendData(0x02);    // The volume 20
    SendData(0x00);
    SendData(0x0c);    // set volume 
    delay(2000);    // Time delay 
    
    // Select a track 2 Play 
    SendData(0x0a);// Clear numbers 
    SendData(0x02);// Track number , Corresponding 00002.mp3
    SendData(0x0b);// Music selection and playback 
    delay(2000);
    
    // Start playing 
    //SendData(0x11);// Start playing , This part can be without 
    //delay(2000);
}

void SendData (char addr )// Sending function 
{
    
    digitalWrite(pin,HIGH); /* Start pulling up */
    delayMicroseconds ( 1000 );
    digitalWrite(pin,LOW); /* Start boot code */
    delayMicroseconds ( 3200 );/* The delay here should be at least greater than 2ms*/
    for (int i = 0; i < 8; i++ ) /* in total 8 Bit data  */
    {
    
        digitalWrite(pin,HIGH);
        if ( addr & 0x01 ) /*3:1 Represents a data bit 1, Each bit is represented by two pulses  */
        {
    
            delayMicroseconds ( 600 );
            digitalWrite(pin,LOW);
            delayMicroseconds ( 200 );
        }
        else        /*1:3 Represents a data bit 0 , Each bit is represented by two pulses  */
        {
    
            delayMicroseconds (200);
            digitalWrite(pin,LOW);
            delayMicroseconds ( 600 );
        }
        addr >>= 1;
    }
    digitalWrite(pin,HIGH);
}

The effect is to input different values through the serial port to select different mp3 Play .

Related information

Speech synthesis software and materials related to the speech broadcast module :

link :https://pan.baidu.com/s/1q0tWEnxipMKokLdAQdNoUQ?pwd=sv4m
Extraction code :sv4m
– From Baidu network disk super member V5 The share of

原网站

版权声明
本文为[Three stinky ginger]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/162/202206110227100946.html