SKU_SEN0539-EN_Gravity_Voice_Recognition_Module_I2C_UART-DFRobot (2023)

This DFRobot voice recognition module is built around an offline voice recognition chip, which can be directly used without an internet connection. It comes with 121 built-in fixed command words and supports the addition of 17 custom command words. Any sound could be trained as a command, such as whistling, snapping, or even cat meows, which brings great flexibility to interactive audio projects.
The module features a dual microphone design with better noise resistance and longer recognition distance, making it relatively accurate and reliable even in noisy environments. It comes with a built-in speaker and an external speaker interface for real-time voice feedback of recognition results. The module uses both I2C and UART communication methods and supports various 3.3V or 5V controllers, including Arduino UNO, Arduino Leonardo, Arduino MEGA, FireBeetle series, and more.This voice recognition module provides a reliable and flexible voice interaction solution for makers and electronics enthusiasts, and can be applied to any applications where voice control or interaction is desirable, such as all kinds of smart home appliances, toys, lamps, and robotics projects.

What is voice recognition?

Voice recognition is a computer technology that recognizes and converts speech signals into editable text or operational commands through analysis. It allows people to interact with computers by speaking without using a mouse, keyboard, or other input devices. Voice recognition technology has been widely used in applications such as voice assistants, smart homes, voice search, and voice recognition notebooks.

Features

  • Self-learning function: Control the module to learn command words by the voice, and any audio can be used as a command.
  • I2C and UART, with a Gravity interface
  • Compatible with 3.3V/5V
  • Built-in with 121 commonly used fixed command words
  • The module has a built-in speaker and an interface for an external speaker, which can provide real-time voice feedback on recognition results
  • Equipped with power indicator (red) and recognition status indicator (blue)
  • Dual microphones provide better noise resistance and longer recognition distance
  • Compatible with Arduino controllers: Arduino UNO, Arduino Leonardo, Arduino MEGA, FireBeetle series controllers, Raspberry Pi, ESP32

Specification

  • Operating voltage: 3.3 - 5V
  • Maximum operating current: ≤370 mA (5V)
  • Communication method: I2C/UART
  • I2C address: 0x64
  • Fixed command words: 121
  • Fixed wake-up words: 1
  • User-defined command words: 17
  • Learning wake-up words: 1
  • Onboard microphone sensitivity: -28db
  • Module size: 49 * 32 mm

SKU_SEN0539-EN_Gravity_Voice_Recognition_Module_I2C_UART-DFRobot (2)

Board Overview

SKU_SEN0539-EN_Gravity_Voice_Recognition_Module_I2C_UART-DFRobot (3)

Command Words

Wake-up word

Wake-up word refers to the word that switches a product from standby mode to working mode, which is the first point of contact between users and voice interactive products.

Learning wake-up word:

First, wake up the voice assistant with the default wake word, then say "Hello robot" and follow the prompts to learn the wake word (before learning a new wake word, delete the previous one, please refer to "Delete Wake-up Words and Command Words").

  • Prompt: Learning now, be quiet, please say the wake word to be learned!
  • The wake word to be learned: hello, there
  • Prompt: Learning successful, please say it again!
  • The wake-up word to be learned: hello, there
  • Prompt: Learning successful, please say it again!
  • The wake-up word to be learned: hello, there
  • Prompt: Ok, learning completed!

You can now use the learned wake word to wake up the voice assistant!

Fixed command words:

Command words refer to the words that users use to give certain instructions to voice interactive products and communicate with them.

Learning command words:

Wake up the voice assistant with the wake word (default or already learned), then say "Learning command word" and follow the prompts to learn the command words (before learning a new command word, delete the previous one, please refer to "Delete Wake Words and Command Words").

  • Prompt: Learning now, be quiet, please learn the command word according to the prompt! Please say the first command to be learned!
  • Example of command word to be learned: Turn on red light
  • Prompt: Learning successful, please say it again!
  • The command word to be learned: Turn on red light
  • Prompt: Learning successful, please say it again!
  • The command word to be learned: Turn on red light
  • Prompt: OK, learned the first command successfully! Please say the second command to be learned!

... (Continue learning)

Or use "Exit learning" to exit the current learning state.

After learning, an ID will be generated, please refer to the "Command Word/Wake Word ID Table" below to control the program.

Delete Wake Words and Command Words:

Wake up the voice assistant with the wake word (default or already learned), then say "I want to delete" and follow the prompts to learn the command words.

  • Prompt: Do you want to delete the learned wake word or command word?
  • Delete command word: delete the learned command word.
  • Delete wake word: delete the learned wake word.
  • Delete all: delete all learned wake words and command words.
  • Exit deleting.

Tutorial

Requirements

  • Hardware
    • DFRduino UNO R3 (or similar) x 1
    • SEN0539 Gravity: Voice Recognition Module x I2C & UART
    • Gravity: Digital RED LED Light Module

Connection Diagram - I2C

SKU_SEN0539-EN_Gravity_Voice_Recognition_Module_I2C_UART-DFRobot (4)

Sample Code

Please switch the communication mode switch to the I2C and download the required library file DFRobot_DF2301Q library for the code.

/*! * @file i2c.ino * @brief Control the voice recognition module via I2C * @n Get the recognized command ID and play the corresponding reply audio according to the ID; * @n Get and set the wake-up state duration * @copyright Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com) * @licence The MIT License (MIT) * @author [qsjhyy](yihuan.huang@dfrobot.com) * @version V1.0 * @date 2022-04-02 * @url https://github.com/DFRobot/DFRobot_DF2301Q */#include "DFRobot_DF2301Q.h"#define Led 8//I2C communicationDFRobot_DF2301Q_I2C asr;void setup() { Serial.begin(115200); pinMode(Led, OUTPUT); //Init LED pin to output mode digitalWrite(Led, LOW); //Set LED pin to low // Init the sensor while (!(asr.begin())) { Serial.println("Communication with device failed, please check connection"); delay(3000); } Serial.println("Begin ok!"); /** * @brief Set voice volume * @param voc - Volume value(1~7) */ asr.setVolume(4); /** @brief Set mute mode @param mode - Mute mode; set value 1: mute, 0: unmute */ asr.setMuteMode(0); /** @brief Set wake-up duration @param wakeTime - Wake-up duration (0-255) */ asr.setWakeTime(20); /** @brief Get wake-up duration @return The currently-set wake-up period */ uint8_t wakeTime = 0; wakeTime = asr.getWakeTime(); Serial.print("wakeTime = "); Serial.println(wakeTime); // asr.playByCMDID(1); // Wake-up command /** @brief Play the corresponding reply audio according to the ID @param CMDID - command word ID */ //asr.playByCMDID(23); // Command word ID}void loop() { /** @brief Get the ID corresponding to the command word @return Return the obtained command word ID, returning 0 means no valid ID is obtained */ uint8_t CMDID = asr.getCMDID(); switch (CMDID) { case 103: //If the command is “Turn on the light” digitalWrite(Led, HIGH); //Turn on the LED Serial.println("received'Turn on the light',command flag'103'"); //Serial transmits "received"Turn on the light",command flag"103 break; case 104: //If the command is “Turn off the light” digitalWrite(Led, LOW); //Turn off the LED Serial.println("received'Turn off the light',command flag'104'"); //The serial transmits "received"Turn off the light",command flag"104"" break; default: if (CMDID != 0) { Serial.print("CMDID = "); //Printing command ID Serial.println(CMDID); } } delay(300);}

Expected Results

Use a fixed or learned wake-up word to activate the speech recognition module, then speak out "Turn on the light" or "Turn off the light" to control the illumination module.

SKU_SEN0539-EN_Gravity_Voice_Recognition_Module_I2C_UART-DFRobot (5)

Connection Diagram - UART

SKU_SEN0539-EN_Gravity_Voice_Recognition_Module_I2C_UART-DFRobot (6)

Sample Code

Please switch the communication mode switch to the UART and download the required library file DFRobot_DF2301Q library for the code.

/*! * @file uart.ino * @brief Control the voice recognition module via UART * @n Get the recognized command ID and play the corresponding reply audio according to the ID; * @n Set the wake-up state duration, set mute mode, set volume, enter the wake-up state, and reset the module * @copyright Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com) * @licence The MIT License (MIT) * @author [qsjhyy](yihuan.huang@dfrobot.com) * @version V1.0 * @date 2022-04-02 * @url https://github.com/DFRobot/DFRobot_DF2301Q */#include "DFRobot_DF2301Q.h"#define Led 8/** @brief DFRobot_URM13_RTU constructor @param serial - serial ports for communication, supporting hard and soft serial ports @param rx - UART The pin for receiving data @param tx - UART The pin for transmitting data*/#if (defined(ARDUINO_AVR_UNO) || defined(ESP8266)) // Use software serialSoftwareSerial softSerial(/*rx =*/4, /*tx =*/5);DFRobot_DF2301Q_UART asr(/*softSerial =*/&softSerial);#elif defined(ESP32) // Use the hardware serial with remappable pin: Serial1DFRobot_DF2301Q_UART asr(/*hardSerial =*/&Serial1, /*rx =*/D3, /*tx =*/D2);#else // Use hardware serial: Serial1DFRobot_DF2301Q_UART asr(/*hardSerial =*/&Serial1);#endifvoid setup() { Serial.begin(115200); pinMode(Led, OUTPUT); //Init LED pin to output mode digitalWrite(Led, LOW); //Set LED pin to low // Init the sensor while (!(asr.begin())) { Serial.println("Communication with device failed, please check connection"); delay(3000); } Serial.println("Begin ok!"); /** @brief Reset module */ // asr.resetModule(); /** @brief Set commands of the module @param setType - Set type @n DF2301Q_UART_MSG_CMD_SET_VOLUME: Set volume, the set value range 1-7 @n DF2301Q_UART_MSG_CMD_SET_ENTERWAKEUP: Enter wake-up state; set value 0 @n DF2301Q_UART_MSG_CMD_SET_MUTE Mute mode; set value 1: mute, 0: unmute @n DF2301Q_UART_MSG_CMD_SET_WAKE_TIME ; Wake-up duration; the set value range 0-255s @param setValue - Set value, refer to the set type above for the range */ asr.settingCMD(DF2301Q_UART_MSG_CMD_SET_MUTE, 0); asr.settingCMD(DF2301Q_UART_MSG_CMD_SET_VOLUME, 7); asr.settingCMD(DF2301Q_UART_MSG_CMD_SET_WAKE_TIME, 20); //asr.settingCMD(DF2301Q_UART_MSG_CMD_SET_ENTERWAKEUP, 0); /** @brief Play the corresponding reply audio according to the command word ID @param CMDID - Command word ID */ asr.playByCMDID(23);}void loop() { /** @brief Get the ID corresponding to the command word @return Return the obtained command word ID, returning 0 means no valid ID is obtained */ uint8_t CMDID = asr.getCMDID(); switch (CMDID) { case 103: //If the command is “Turn on the light” digitalWrite(Led, HIGH); //Turn on the LED Serial.println("received'Turn on the light',command flag'103'"); //Serial transmits "received"Turn on the light",command flag"103"" break; case 104: //If the command is “Turn off the light” digitalWrite(Led, LOW); //Turn off the LED Serial.println("received'Turn off the light',command flag'104'"); //The serial transmits "received"Turn off the light",command flag"104"" break; default: if (CMDID != 0) { Serial.print("CMDID = "); //Print command ID Serial.println(CMDID); } } delay(300);}

Expected Result

Use a fixed or learned wake-up word to activate the speech recognition module, then speak out "Turn on the light" or "Turn off the light" to control the illumination module.

SKU_SEN0539-EN_Gravity_Voice_Recognition_Module_I2C_UART-DFRobot (7)

Command Words/Wake-up Words & ID Table

Wake-up wordsID
Wake-up words for learning1
Hello robot2
Commands for learningIDCommands for learningIDCommands for learningID
The first custom command5The second custom command6The third custom command7
The fourth custom command8The fifth custom command9The sixth custom command10
The seventh custom command11The eighth custom command12The ninth custom command13
The tenth custom command14The eleventh custom command15The twelfth custom command16
The thirteenth custom command17The fourteenth custom command18The fifteenth custom command19
The sixteenth custom command20The seventeenth custom command21
Fixed Command WordsIDFixed Command WordsIDFixed Command WordsID
Go forward22Retreat23Park a car24
Turn left ninety degrees25Turn left forty-five degrees26Turn left thirty degrees27
Turn right forty-five degrees29Turn right thirty degrees30Shift down a gear31
Line tracking mode32Light tracking mode33Bluetooth mode34
Obstacle avoidance mode35Face recognition36Object tracking37
Object recognition38Line tracking39Color recognition40
Tag recognition41Object sorting42Qr code recognition43
General settings44Clear screen45Learn once46
Forget47Load model48Save model49
Take photos and save them50Save and return51Display number zero52
Display number one53Display number two54Display number three55
Display number four56Display number five57Display number six58
Display number seven59Display number eight60Display number nine61
Display smiley face62Display crying face63Display heart64
Turn off dot matrix65Read current posture66Read ambient light67
Read compass68Read temperature69Read acceleration70
Reading sound intensity71Calibrate electronic gyroscope72Turn on the camera73
Turn off the camera74Turn on the fan75Turn off the fan76
Turn fan speed to gear one77Turn fan speed to gear two78Turn fan speed to gear three79
Start oscillating80Stop oscillating81Reset82
Set servo to ten degrees83Set servo to thirty degrees84Set servo to forty-five degrees85
Set servo to sixty degrees86Set servo to ninety degrees87Turn on the buzzer88
Turn off the buzzer89Turn on the speaker90Turn off the speaker91
Play music92Stop playing93The last track94
The next track95Repeat this track96Volume up97
Volume down98Change volume to maximum99Change volume to minimum100
Change volume to medium101Play poem102Turn on the light103
Turn off the light104Brighten the light105Dim the light106
Adjust brightness to maximum107Adjust brightness to minimum108Increase color temperature109
Decrease color temperature110Adjust color temperature to maximum111Adjust color temperature to minimum112
Daylight mode113Moonlight mode114Color mode115
Set to red116Set to orange117Set to yellow118
Set to green119Set to cyan120Set to blue121
Set to purple122Set to white123Turn on ac124
Turn off ac125Increase temperature126Decrease temperature127
Cool mode128Heat mode129Auto mode130
Dry mode131Fan mode132Enable blowing up & down133
Disable blowing up & down134Enable blowing right & left135Disable blowing right & left136
Open the window137Close the window138Open curtain139
Close curtain140Open the door141Close the door142
Learning-related commandsIDLearning-related commandsIDLearning-related commandsID
Learning wake word200Learning command word201Re-learn202
Exit learning203I want to delete204Delete wake word205
Delete command word206Exit deleting207Delete all208

FAQ

For any questions, advice or cool ideas to share, please visit the DFRobot Forum.

More Documents

SKU_SEN0539-EN_Gravity_Voice_Recognition_Module_I2C_UART-DFRobot (8) Get from DFRobot Store or DFRobot Distributor.

Turn to the Top

References

Top Articles
Latest Posts
Article information

Author: Margart Wisoky

Last Updated: 19/05/2023

Views: 6776

Rating: 4.8 / 5 (78 voted)

Reviews: 93% of readers found this page helpful

Author information

Name: Margart Wisoky

Birthday: 1993-05-13

Address: 2113 Abernathy Knoll, New Tamerafurt, CT 66893-2169

Phone: +25815234346805

Job: Central Developer

Hobby: Machining, Pottery, Rafting, Cosplaying, Jogging, Taekwondo, Scouting

Introduction: My name is Margart Wisoky, I am a gorgeous, shiny, successful, beautiful, adventurous, excited, pleasant person who loves writing and wants to share my knowledge and understanding with you.