[Huadiao Handmade] ASRPRO-Plus Voice Recognition (09) --- DTH11 Digital Temperature and Humidity Sensor

DHT11
is a temperature and humidity composite sensor with calibrated digital signal output. It applies dedicated digital module acquisition technology and temperature and humidity sensing technology to ensure that the product has extremely high reliability and excellent long-term stability. The sensor includes a resistive humidity sensing element and an NTC temperature measuring element, and is connected to a high-performance 8-bit microcontroller. Therefore, this product has the advantages of excellent quality, ultra-fast response, strong anti-interference ability, and extremely cost-effective. Each DHT11 sensor is calibrated in an extremely accurate humidity calibration chamber. The calibration coefficients are stored in the OTP memory in the form of a program, and these calibration coefficients are called inside the sensor during the processing of the detection signal. The single-wire serial interface makes system integration easy and fast. The ultra-small size, extremely low power consumption, and signal transmission distance can reach more than 20 meters, making it the best choice for various applications and even the most demanding applications. The product is a 4-pin single row pin package. Easy to connect, special packaging forms can be provided according to user needs.

Insert image description here
Electrical schematic diagram

Insert image description here

Insert image description here
Insert image description here
Insert image description here
Insert image description here
Insert image description here

[Huadiao Hands-on] Experiment 14: Read the temperature and humidity values ​​​​of the DTH11 sensor respectively

Experiment with open source code

#include "asr.h"
extern "C"{
    
     void * __dso_handle = 0 ;}
#include "setup.h"
#include "myLib/asr_dhtxx.h"
#include "myLib/asr_event.h"

uint32_t snid;
uint8_t temp;
uint8_t hum;

//{ID:250,keyword:"命令词",ASR:"最大音量",ASRTO:"音量调整到最大"}
//{ID:251,keyword:"命令词",ASR:"中等音量",ASRTO:"音量调整到中等"}
//{ID:252,keyword:"命令词",ASR:"最小音量",ASRTO:"音量调整到最小"}
DHTxx asr_dht_20(20, DHT11);
void ASR_CODE()
{
    
    
  //{ID:500,keyword:"唤醒词",ASR:"智能管家",ASRTO:"我在"}
  if(snid == 500){
    
    
    digital_write((4),0);
  }
  //{ID:501,keyword:"命令词",ASR:"当前温度",ASRTO:""}
  if(snid == 501){
    
    
    // 回复可以为空
    temp = asr_dht_20.read_temperature(0);
    //{ID:502,keyword:"命令词",ASR:"耍接官",ASRTO:"摄氏"}
    play_audio(502);
    play_num((int64_t)(temp * 100), 1);
    //{ID:503,keyword:"命令词",ASR:"接耍官",ASRTO:"度"}
    play_audio(503);
  }
  //{ID:504,keyword:"命令词",ASR:"当前湿度",ASRTO:""}
  if(snid == 504){
    
    
    // 回复可以为空
    hum = asr_dht_20.readHumidity();
    //{ID:505,keyword:"命令词",ASR:"官耍接",ASRTO:"百分之"}
    play_audio(505);
    play_num((int64_t)(hum * 100), 1);
  }
}

void setup()
{
    
    
  //{speak:小鹿-甜美女声,vol:20,speed:10,platform:baidu}
  //{playid:10001,voice:欢迎使用人工智能AI语音助手,用智能管家唤醒我}
  //{playid:10002,voice:我要退下了,用智能管家唤醒我}
  asr_dht_20.init();
  digital_write((4),1);

  //{ID:84,keyword:"命令词",ASR:"条耍改",ASRTO:"零"}
  //{ID:85,keyword:"命令词",ASR:"官接思",ASRTO:"一"}
  //{ID:86,keyword:"命令词",ASR:"痛官松",ASRTO:"二"}
  //{ID:87,keyword:"命令词",ASR:"削丝误",ASRTO:"三"}
  //{ID:88,keyword:"命令词",ASR:"景粮载",ASRTO:"四"}
  //{ID:89,keyword:"命令词",ASR:"博菌避",ASRTO:"五"}
  //{ID:90,keyword:"命令词",ASR:"裁纯碉",ASRTO:"六"}
  //{ID:91,keyword:"命令词",ASR:"插趣悟",ASRTO:"七"}
  //{ID:92,keyword:"命令词",ASR:"辞暖慌",ASRTO:"八"}
  //{ID:93,keyword:"命令词",ASR:"纵猛淡",ASRTO:"九"}
  //{ID:94,keyword:"命令词",ASR:"锦耗暂",ASRTO:"十"}
  //{ID:95,keyword:"命令词",ASR:"燃智截",ASRTO:"百"}
  //{ID:96,keyword:"命令词",ASR:"佛驻延",ASRTO:"千"}
  //{ID:97,keyword:"命令词",ASR:"隔枪绍",ASRTO:"万"}
  //{ID:98,keyword:"命令词",ASR:"惨愤昂",ASRTO:"亿"}
  //{ID:99,keyword:"命令词",ASR:"丙迈扯",ASRTO:"负"}
  //{ID:100,keyword:"命令词",ASR:"铸猜隆",ASRTO:"点"}
}

Tianwen Block (standard mode) training model and compilation and burning

Insert image description here
Insert image description here

Experiment record video

https://www.bilibili.com/video/BV1p64y1V7fT/?share_source=copy_web&vd_source=371a292a55e5ca9be994cbb4a86cc987

[Huadiao Hands-on] Experiment 14: Read the temperature and humidity of the DTH11 sensor respectively

Guess you like

Origin blog.csdn.net/weixin_41659040/article/details/135022999