所有分类
主题 主题
平台 平台
我的工作台
userHead
注册时间 [[userInfo.create_time]]
创造力 [[userInfo.creativity]]
[[userInfo.remark]]
[[d.project_title]]
articleThumb
[[d.material_name]]
timelineThumb
进入工作台
折叠
所有分类 我的工作台
展开
AI智能垃圾分类箱
hockel hockel 2021-03-22 17:34:13
9
0
简单
projectImage
步骤1 步骤1
前言

       感谢DF的粒子邮寄过来的人工智能三剑客中的两剑客:中英文语音合成模块I2C语音识别模块。于是做什么项目呢?

      上海在2019年7月1号起已经开始实行强制垃圾分类,实行了垃圾分类的政策,主要原因是随着人们生活水平的提高,各类消费增加,产生了大量的垃圾,如果不能够合理处理这些垃圾,将严重污染环境,为了解决这个问题,响应国家提出的垃圾分类政策,保护我们赖以生存的家园。用掌控板结合中英文语音合成模块I2C语音识别模块来做一个AI智能垃圾分类箱!

材料清单 材料清单
1x
掌控板
1x
掌控宝
1x
I2C语音识别模块
1x
中英文语音合成模块
4x
9G 舵机
1x
激光切割键若干
步骤2 步骤2
硬件介绍
projectImage

2.1语音识别模块 

该模块采用由 ICRoute 公司设计的 LD3320 “语音识别”专用芯片,只需要在程序中设定好要识别的关键词语列表并下载进主控的MCU中,语音识别模块就可以对用户说出的关键词语进行识别,并根据程序进行相应的处理。本品不需要用户事先训练和录音就可以完成非特定人语音识别,识别准确率高达95%。

详细资料可以看一下产品wiki

projectImage

2.2语音合成模块

支持中文、英文和中英文混合合成、自带喇叭、Gravity I2C/UART双通讯、支持多种主控板,arduino、micro:bit、掌控板等。语音合成功能支持多种文本控制标记,可以满足用户对语音合成发音人、音量、语速、语调等的设置。更新详细说明可以查看产品wiki

步骤3 步骤3
电路连接
projectImage

注:在使用舵机时,为了对称本来使用的P5硬件来驱动一个舵机,单独调试运行的时候发现不能驱动。于是换了P0,P3,P6,P7,P11都不行,有时引脚设置后会导致原本正常的引脚BUG。可能是引脚占用的原因。于是就换成了P14引脚。

步骤4 步骤4
程序设计

打开mind+ 在‘上传模式’下,点击“扩展”选择掌控板后,然后添加用户库搜索ext 然后选择中英文语音合成模块I2C语音识别模块。

projectImage

然后开始对项目进行编写。

projectImage
代码 代码
	                    					/*!
 * MindPlus
 * mpython
 *
 */
#include <MPython.h>
#include<DFRobot_ASR.h>
#include <DFRobot_Servo.h>
#include<DFRobot_SpeechSynthesis.h>

// 动态变量
volatile float mind_n_msg;
// 静态常量
const uint8_t imageMatrix[][1024] = {
	{0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf8,0x3,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc0,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x0,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0x0,0x1f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0x80,0x0,0xf,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfc,0x0,0x3,0x8f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfd,0x0,0x4,0xc7,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfa,0xf,0x4,0x47,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfa,0x9,0x86,0x83,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0x8,0x83,0x3,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf4,0xd,0x82,0x3,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf4,0xe,0xc6,0x3,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf4,0x8,0x64,0x3,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf4,0x8,0x3c,0x3,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf4,0xf0,0x36,0x3,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe8,0x88,0x22,0x7,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc0,0x88,0x26,0x7,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xd0,0xf0,0x1c,0xf,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc0,0x20,0x0,0xf,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe0,0x0,0x0,0x1f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe0,0x0,0x0,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe0,0x0,0x0,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0x0,0x0,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0x0,0x0,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0x0,0x0,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0x0,0x0,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0x0,0x0,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfc,0xc0,0x0,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc0,0x0,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc0,0x0,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfc,0xf8,0xf8,0xc0,0x3c,0x71,0xf3,0x19,0xe0,0xc1,0xff,0xff,0xff,0xff,0xfe,0x3f,0x18,0x40,0x18,0xc0,0x38,0xf0,0xe1,0x0,0xc0,0x81,0xff,0xff,0xff,0xff,0xfc,0x1f,0x18,0x3f,0x10,0x46,0x71,0xf8,0xc0,0x0,0xcc,0x99,0xff,0xff,0xff,0xff,0xfc,0x1f,0x18,0x67,0x38,0xc6,0x71,0xfc,0x73,0x19,0xf3,0xff,0xff,0xff,0xff,0xff,0xf8,0x8f,0x1c,0x67,0x38,0xc4,0x3f,0xff,0xe3,0x19,0xc0,0x1,0xff,0xff,0xff,0xff,0xf8,0x8f,0x1c,0x67,0x38,0xc6,0x30,0x0,0x63,0x18,0xf1,0x11,0xff,0xff,0xff,0xff,0xf9,0xcf,0x1c,0x66,0x38,0xc2,0x38,0x78,0x67,0x1c,0xc1,0x1,0xff,0xff,0xff,0xff,0xf0,0x7,0x1c,0x66,0x38,0xc0,0x78,0xf8,0x7c,0x3f,0xd1,0x11,0xff,0xff,0xff,0xff,0xf1,0xc7,0x1c,0x66,0x38,0xcc,0x78,0xf8,0x40,0x0,0xd1,0x11,0xff,0xff,0xff,0xff,0xf3,0xe7,0x1c,0x66,0x38,0xcc,0x70,0xf8,0x70,0xe1,0xd1,0x1,0xff,0xff,0xff,0xff,0xe3,0xe3,0x1c,0x62,0x38,0xcc,0x31,0xf8,0x70,0xf1,0xd1,0x19,0xff,0xff,0xff,0xff,0xe7,0xe3,0x18,0x63,0xf0,0x8c,0x31,0xf8,0x61,0xf0,0xd1,0x11,0xff,0xff,0xff,0xff,0xff,0xff,0xf8,0x0,0x10,0xc,0xf1,0xc0,0x63,0xf8,0xd1,0x1,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
	{0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xf0,0x0,0x0,0x0,0x0,0xff,0xf0,0xff,0xe0,0x0,0x0,0x0,0x0,0x7f,0xf0,0xff,0x80,0x0,0x0,0x0,0x0,0x3f,0xf0,0xff,0x87,0xff,0xff,0xff,0xfe,0x1f,0xf0,0xff,0xf,0xff,0xff,0xff,0xff,0xf,0xf0,0xff,0x1f,0xff,0xff,0xff,0xff,0x8f,0xf0,0xff,0x1f,0xff,0xff,0xff,0xff,0x8f,0xf0,0xff,0x1f,0xff,0xff,0xff,0xff,0x8f,0xf0,0xfe,0x1f,0x0,0x6,0x0,0x1f,0x8f,0xf0,0xfe,0x1f,0x0,0x6,0x0,0x1f,0x8f,0xf0,0xfe,0x1f,0x80,0x6,0x0,0x1f,0x8f,0xf0,0xfe,0x1f,0xff,0xce,0x7f,0x9f,0x8f,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ff,0x87,0xff,0xff,0xff,0xfe,0x1f,0xf0,0xff,0x80,0x0,0x0,0x0,0x0,0x3f,0xf0,0xff,0xe0,0x0,0x0,0x0,0x0,0x7f,0xf0,0xff,0xf0,0x0,0x0,0x0,0x0,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0},
	{0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xfc,0x0,0x0,0x0,0x3,0xff,0xf0,0xff,0xf0,0x0,0x0,0x0,0x0,0xff,0xf0,0xff,0xf0,0x0,0x0,0x0,0x0,0xff,0xf0,0xff,0xc0,0x0,0x0,0x0,0x0,0x3f,0xf0,0xff,0x3,0xff,0xff,0xff,0xfc,0xf,0xf0,0xff,0x3,0xff,0xff,0xff,0xfc,0xf,0xf0,0xff,0x0,0xff,0xff,0xff,0xf0,0xf,0xf0,0xfe,0x18,0xff,0xff,0xff,0xf1,0x87,0xf0,0xfe,0x18,0xff,0xff,0xff,0xf1,0x87,0xf0,0xfe,0x1f,0xf1,0xff,0xf3,0xff,0x87,0xf0,0xfe,0x1f,0x80,0x6,0x0,0x1f,0x87,0xf0,0xfe,0x1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0xff,0x0,0xff,0xff,0xff,0xf0,0xf,0xf0,0xff,0x3,0xff,0xff,0xff,0xfc,0xf,0xf0,0xff,0x3,0xff,0xff,0xff,0xfc,0xf,0xf0,0xff,0xc0,0x0,0x0,0x0,0x0,0x3f,0xf0,0xff,0xe0,0x0,0x0,0x0,0x0,0x7f,0xf0,0xff,0xe0,0x0,0x0,0x0,0x0,0x7f,0xf0,0xff,0xf8,0x0,0x0,0x0,0x1,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0},
	{0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xf0,0x0,0x0,0x0,0x0,0xff,0xf0,0xff,0xe0,0x0,0x0,0x0,0x0,0x7f,0xf0,0xff,0xc0,0x0,0x0,0x0,0x0,0x3f,0xf0,0xff,0x87,0xff,0xff,0xff,0xfe,0x1f,0xf0,0xff,0xf,0xff,0xff,0xff,0xff,0xf,0xf0,0xff,0x1f,0xff,0xff,0xff,0xff,0x8f,0xf0,0xff,0x1f,0xff,0xff,0xff,0xff,0x8f,0xf0,0xff,0x1f,0xf8,0x0,0x1,0xff,0x8f,0xf0,0xff,0x1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e,0x3,0xff,0x8f,0xf0,0xff,0x1f,0xff,0x7,0x8b,0xff,0x8f,0xf0,0xff,0x1f,0xff,0xff,0xff,0xff,0x8f,0xf0,0xff,0xf,0xff,0xff,0xff,0xff,0xf,0xf0,0xff,0x87,0xff,0xff,0xff,0xfe,0x1f,0xf0,0xff,0xc0,0x0,0x0,0x0,0x0,0x1f,0xf0,0xff,0xc0,0x0,0x0,0x0,0x0,0x7f,0xf0,0xff,0xf0,0x0,0x0,0x0,0x0,0xff,0xf0,0xff,0xff,0x0,0x0,0x0,0xf,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0},
	{0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xf0,0x0,0x0,0x0,0x0,0xff,0xf0,0xff,0xe0,0x0,0x0,0x0,0x0,0x7f,0xf0,0xff,0xc0,0x0,0x0,0x0,0x0,0x3f,0xf0,0xff,0x87,0xff,0xff,0xff,0xfe,0x1f,0xf0,0xff,0xf,0xff,0xff,0xff,0xff,0xf,0xf0,0xff,0x1f,0xff,0xff,0xff,0xff,0x8f,0xf0,0xff,0x1f,0xf9,0xc0,0x0,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0x4b,0xff,0x8f,0xf0,0xff,0x1f,0xfc,0x8f,0x47,0xff,0x8f,0xf0,0xff,0x1f,0xfc,0x4e,0x3,0xff,0x8f,0xf0,0xff,0x1f,0xff,0x7,0x8b,0xff,0x8f,0xf0,0xff,0x1f,0xff,0xff,0xff,0xff,0x8f,0xf0,0xff,0xf,0xff,0xff,0xff,0xff,0xf,0xf0,0xff,0x87,0xff,0xff,0xff,0xfe,0x1f,0xf0,0xff,0xc0,0x0,0x0,0x0,0x0,0x1f,0xf0,0xff,0xc0,0x0,0x0,0x0,0x0,0x7f,0xf0,0xff,0xf0,0x0,0x0,0x0,0x0,0xff,0xf0,0xff,0xff,0x0,0x0,0x0,0xf,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0}
};
// 创建对象
DFRobot_ASR                 asr;
DFRobot_SpeechSynthesis_I2C sstts;
Servo                       servo_P13;
Servo                       servo_P15;
Servo                       servo_P1;
Servo                       servo_P5;


// 主程序开始
void setup() {
	mPython.begin();
	asr.begin(LOOP,MIC);
	asr.addCommand("bao zhi",1);
	asr.addCommand("yi la guan",2);
	asr.addCommand("yin liao ping",3);
	asr.addCommand("shu ben",4);
	asr.addCommand("dian chi",5);
	asr.addCommand("sha chong ji",6);
	asr.addCommand("you qi",7);
	asr.addCommand("wen du ji",8);
	asr.addCommand("shi zhi jing",9);
	asr.addCommand("hai mian ",10);
	asr.addCommand("yan di",11);
	asr.addCommand("hai mian",12);
	asr.addCommand("mian bao",13);
	asr.addCommand("cai ye",14);
	asr.addCommand("bing gan",15);
	asr.addCommand("nai cha",16);
	asr.start();
	sstts.begin();
	sstts.setVolume(8);
	sstts.setSpeed(5);
	sstts.setSoundType(sstts.MALE1);
	sstts.setTone(5);
	sstts.setEnglishPron(sstts.ALPHABET);
	servo_P13.attach(P13);
	servo_P15.attach(P15);
	servo_P1.attach(P1);
	servo_P5.attach(P5);
	servo_P13.angle(abs(90));
	servo_P15.angle(abs(90));
	servo_P1.angle(abs(90));
	servo_P5.angle(abs(90));
	display.drawImage(0, 0, 128, 64, imageMatrix[0]);
}
void loop() {
	mind_n_msg = (asr.read());
	if ((mind_n_msg>-1)) {
		if ((mind_n_msg<=4)) {
			servo_P13.angle(abs(180));
			display.fillScreen(1);
			display.drawImage(39, 1, 60, 60, imageMatrix[1]);
			sstts.speak("可回收垃圾");
			delay(2000);
			servo_P13.angle(abs(90));
		}
		else if ((mind_n_msg<=8)) {
			servo_P15.angle(abs(180));
			display.fillScreen(1);
			display.drawImage(39, 1, 60, 60, imageMatrix[2]);
			sstts.speak("有害垃圾");
			delay(2000);
			servo_P15.angle(abs(90));
		}
		else if ((mind_n_msg<=12)) {
			servo_P1.angle(abs(180));
			display.fillScreen(1);
			display.drawImage(39, 1, 60, 60, imageMatrix[3]);
			sstts.speak("[i1]gan1la1ji1");
			delay(2000);
			servo_P1.angle(abs(90));
		}
		else {
			servo_P5.angle(abs(180));
			display.fillScreen(1);
			display.drawImage(39, 1, 60, 60, imageMatrix[4]);
			sstts.speak("湿垃圾");
			delay(2000);
			servo_P5.angle(abs(90));
		}
	}
	else {
		display.fillScreen(1);
		display.drawImage(0, 0, 128, 64, imageMatrix[0]);
		delay(1000);
	}
}

	                    				

注:语音合成的干垃圾会读成第四声,于是查看了一下资料如何改变声调。

projectImage

这里我一开始用的是:干[=gan1]垃圾。没有效果。后来用了对汉语拼音识别[i1]gan1垃圾。能发正确的音不过会有停顿。后来只能将所有文字替代成拼音。eg:[i1]gan1la1ji1。还有一种方法:就是用多音节来代替:肝垃圾。这样也能达到我们想要的效果。

步骤5 步骤5
总结

这样子我们可以用df的离线语音识别模块和语音合成模块来实现一个AI智能垃圾分类箱啦。屏幕前的读者学会了没?总之,三剑客中的两剑客还是很容易上手的,期待你们的作品。更多教程欢迎访问个人博客:www.hockel.club

附件 附件
Makelog作者原创文章,未经授权禁止转载。
9
0
评论
[[c.user_name]] [[c.create_time]]
[[c.parent_comment.count]]
[[c.comment_content]]