SU-03T语音识别控制模块为用户提供便捷便宜的串口离线语音识别方案,可广泛且快速应用于智能家居,各类智能小家电,86盒,玩具,灯具等需要语音操控的产品。 语音识别采用了离线语音识别芯片。通过串口通信的方式实现与主机的交互,最多支持150条语音指令,可在用户平台上自主定制语音指令和固件,命令词可任意修改,开发简单,不需要写代码。自带固件下载芯片,只需数据线即可完成固件下载。支持语音调节音量、学习唤醒词,识别灵敏且准确率高。
引脚名称 | 描述 |
---|---|
VCC | VCC(电源输入正极) |
GND | GND(电源输入负极) |
TX | 信号发送引脚 |
RX | 信号接收引脚 |
供电电压:3.3V / 5V
连接方式:PH2.0 4P端子线
安装方式:双螺丝固定/乐高搭建
库文件:点击下载
烧录文件:点击下载
第一步:下载文件
第二步:打开烧录程序
第三步:添加要烧录的文件进入程序,点击烧录
第四步:按下模块复位按键
按下后观察到app开始加载进度
下载完成后模块有语音提示。之后可以用UNO开发板控制语音模块了。
Arduino UNO 图形化示例程序:
volatile int yuyin; #include <SoftwareSerial.h> // 串口发送消息最大长度 #define UART_SEND_MAX 32 #define UART_MSG_HEAD_LEN 2 #define UART_MSG_FOOT_LEN 2 // 串口发送消息号 #define U_MSG_bozhensgshu 1 #define U_MSG_boxiaoshu 2 #define U_MSG_bobao1 3 #define U_MSG_bobao2 4 #define U_MSG_bobao3 5 #define U_MSG_bobao4 6 #define U_MSG_bobao5 7 #define U_MSG_bobao6 8 #define U_MSG_bobao7 9 #define U_MSG_bobao8 10 #define U_MSG_bobao9 11 #define U_MSG_bobao10 12 #define U_MSG_bobao11 13 #define U_MSG_bobao12 14 #define U_MSG_bobao13 15 #define U_MSG_bobao14 16 #define U_MSG_bobao15 17 #define U_MSG_bobao16 18 #define U_MSG_bobao17 19 #define U_MSG_bobao18 20 #define U_MSG_bobao19 21 #define U_MSG_bobao20 22 #define U_MSG_bobao21 23 #define U_MSG_bobao22 24 #define U_MSG_bobao23 25 #define U_MSG_bobao24 26 #define U_MSG_bobao25 27 #define U_MSG_bobao26 28 #define U_MSG_bobao27 29 #define U_MSG_bobao28 30 #define U_MSG_bobao29 31 #define U_MSG_bobao30 32 #define U_MSG_bobao31 33 #define U_MSG_bobao32 34 #define U_MSG_bobao33 35 #define U_MSG_bobao34 36 // 串口消息参数类型 typedef union { double d_double; int d_int; unsigned char d_ucs[8]; char d_char; unsigned char d_uchar; unsigned long d_long; short d_short; float d_float;}uart_param_t; SoftwareSerial mySerial(5,6); // 串口发送函数实现 void _uart_send_impl(unsigned char* buff, int len) { // TODO: 调用项目实际的串口发送函数 for(int i=0;i<len;i++) { mySerial.write (*buff++); } } // 串口通信消息尾 const unsigned char g_uart_send_foot[] = { 0x55, 0xaa }; // 十六位整数转32位整数 void _int16_to_int32(uart_param_t* param) { if (sizeof(int) >= 4) return; unsigned long value = param->d_long; unsigned long sign = (value >> 15) & 1; unsigned long v = value; if (sign) v = 0xFFFF0000 | value; uart_param_t p; p.d_long = v; param->d_ucs[0] = p.d_ucs[0]; param->d_ucs[1] = p.d_ucs[1]; param->d_ucs[2] = p.d_ucs[2]; param->d_ucs[3] = p.d_ucs[3]; } // 浮点数转双精度 void _float_to_double(uart_param_t* param) { if (sizeof(int) >= 4) return; unsigned long value = param->d_long; unsigned long sign = value >> 31; unsigned long M = value & 0x007FFFFF; unsigned long e = ((value >> 23 ) & 0xFF) - 127 + 1023; uart_param_t p0, p1; p1.d_long = ((sign & 1) << 31) | ((e & 0x7FF) << 20) | (M >> 3); param->d_ucs[0] = p0.d_ucs[0]; param->d_ucs[1] = p0.d_ucs[1]; param->d_ucs[2] = p0.d_ucs[2]; param->d_ucs[3] = p0.d_ucs[3]; param->d_ucs[4] = p1.d_ucs[0]; param->d_ucs[5] = p1.d_ucs[1]; param->d_ucs[6] = p1.d_ucs[2]; param->d_ucs[7] = p1.d_ucs[3]; } // 串口通信消息头 const unsigned char g_uart_send_head[] = { 0xaa, 0x55 }; void setup(){ Serial.begin(9600); pinMode(13, OUTPUT); digitalWrite(13,LOW); mySerial.begin(9600); yuyin = 0; Serial.begin(9600); } void loop(){ //你好小爱唤醒语音识别模块 //语音识别模块RX引脚接uno开发D5引脚,TX引脚接uno开发D6引脚 if (mySerial.available() > 0) { yuyin = mySerial.read(); Serial.println(yuyin,HEX); } if (yuyin == 1) { yuyin = 0; Serial.println("开灯"); digitalWrite(13,HIGH); } else if (yuyin == 2) { yuyin = 0; Serial.println("关灯 "); digitalWrite(13,LOW); } }
ESP32 Python 示例(适用于Mixly IDE /米思齐)
(开发板选择 Python ESP32 【ESP32 Generic(4MB)】切换为代码模式上传 ):
import machine import time uart1=machine.UART(1, tx=17, rx=16, baudrate=9600) pin2 = machine.Pin(2, machine.Pin.OUT) while True: if uart1.any(): data = uart1.read() if data == b'\x01': pin2.value(1) print('111', 'Mixly') time.sleep_ms(100) elif data == b'\x02': pin2.value(0) print('nnnn', 'Mixly') time.sleep_ms(100)
Arduino UNO 图形化示例程序:点击下载
ESP32 Python图形化示例程序:点击下载
Arduino UNO 测试环境搭建
准备配件:
UNO - R3 开发板 *1
HS-UNO EXP1 扩展板 *1
USB type-c 数据线 *1
LED灯模块 *1
SU-03T 语音识别控制模块(HS-S57-L)*1
PH2.0 4P端子转杜邦线 *1 或 PH2.0 4P双头端子线 *1
电路接线图:
ESP32 Python 测试环境搭建
器件连接好线之后,将上述程序烧录到开发板之后,即可跟SU-03T 语音识别控制模块对话。
全部参考资料:点击下载