先上视频:
esp32+1.3寸屏幕语音交互
资料提供
百度网盘
链接:https://pan.baidu.com/s/14NO9VFD0rBgw6YYv1eYk3w?pwd=psbn
提取码:psbn
准备材料:
nodemcu开发板一个
1.3寸IPS模块一个
继电器一个
舵机俩个+舵机云台
LU-ASR01鹿小班智能语音识别模块 离线识别
购买需要选择带喇叭的
杜邦线 一样买点 都会用得到
温湿度模块 DHT11
12V小灯泡
连接方式:
esp32S 屏幕
GND GND
3.3V VCC
14 SCL
15 SDA
33 RES
27 DC
esp32S 语音模块
16 IO8
P17 IO7
继电器 语音模块
信号线 IO1
舵机信号线 语音模块
舵机1 I02
舵机2 IO3
温湿度DHT11 语音模块
信号线 DHT
具体实物图连接方式如下:
语音交互表情制作
制作链接:http://tomeko.net/online_tools/file_to_hex.php?lang=en
将240x240大小的图片添加进去,会生成一个数组文件,将数组文件添加到esp266+1.3寸屏幕语音交互\语音模块与1.3寸屏幕交互\esp32_101\img\face.h文件里面
注意这里的数组名需要在语音模块和esp32中对应位置同时进行修改
ESP32代码部分
1.主函数
// UDP时间服务初始化
void UDPTimeInit(){
Serial.println("Starting UDP"); //连接时间服务器
Udp.begin(localPort);
Serial.print("Local port: ");
// Serial.println(Udp.localPort());
Serial.println("waiting for sync");
setSyncProvider(getNtpTime);
setSyncInterval(300); //时间校准间隔
}
time_t getNtpTime() //获取NTP时间
{
IPAddress ntpServerIP; //NTP服务器的IP地址
while (Udp.parsePacket() > 0) ; //之前的数据没有处理的话一直等待 discard any previously received packets
WiFi.hostByName(ntpServerName, ntpServerIP); //从网站名获取IP地址
sendNTPpacket(ntpServerIP); //发送数据包
uint32_t beginWait = millis();
while (millis() - beginWait < 1500) {
int size = Udp.parsePacket(); //接收数据
if (size >= NTP_PACKET_SIZE) {
Serial.println("Receive NTP Response");
Udp.read(packetBuffer, NTP_PACKET_SIZE); //从缓冲区读取数据
unsigned long secsSince1900;
secsSince1900 = (unsigned long)packetBuffer[40] << 24;
secsSince1900 |= (unsigned long)pack