基于STM32大棚DHT11温湿度监测protues仿真设计

描述

本设计

基于‍STM32大棚DHT11温湿度监测protues仿真设计

资料包含:程序+仿真+原理图+PCB+讲解视频(具体看下文资料清单)

原理图:Altium Designer

仿真图:protues 8.9

程序编译器:keil 5

编程语言:C语言

设计编号:C0032 

主要功能:

1.LCD1602液晶实时显示DHT11温度和湿度值;

2.具有温湿度超上限阈值报警功能;

3.温湿度上限值阈值可通过按键调节。

仿真图(提供源文件):

仿真设计

电路图(提供源文件):

仿真设计

PCB(提供源文件):

仿真设计

程序(提供源文件源码):

仿真设计

以下为部分程序,完整程序可在下载链接获取:

 

int main(void)
{
  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();
  /* Configure the system clock */
  SystemClock_Config();
  delay_init(10);                   //初始化延时函数
  TIM3_Init(2400-1, 72-1); // 10ms


  Key_Init();
  Beep_Init();
  LCD_Init();
  DHT11_Init();


  while(1)
  {
    if(DHT11_Read_TempAndHumidity(&DHT11_Data) == SUCCESS)
    {
      temp_table[3] = DHT11_Data.temp_int / 10 + 0x30;
      temp_table[4] = DHT11_Data.temp_int % 10 + 0x30;
      temp_table[5] = 'c';


      humi_table[3] = DHT11_Data.humi_int / 10 + 0x30;
      humi_table[4] = DHT11_Data.humi_int % 10 + 0x30;




      tMax_table[3] = temp_max / 10 + 0x30;
      tMax_table[4] = temp_max % 10 + 0x30;
      tMax_table[5] = 'c';


      hMax_table[3] = humi_max / 10 + 0x30;
      hMax_table[4] = humi_max % 10 + 0x30;




      LCD_write_string(0,  0, (char*)temp_table);
      LCD_write_string(8,  0, (char*)humi_table);


      LCD_write_string(0,  1, (char*)tMax_table);
      LCD_write_string(8,  1, (char*)hMax_table);
    }
    if(DHT11_Data.temp_int >= temp_max || DHT11_Data.humi_int >= humi_max)
    {
      LED2_ON();
      BEEP_ON();
    }    
    else
    {
      LED2_OF();
      BEEP_OF();
    }    
    delay_ms(500);


  }
}

 

  审核编辑:汤梓红

打开APP阅读更多精彩内容
声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉
评论(0)
发评论
jf_06701828 2023-09-12
0 回复 举报
下载链接呢,为什么网页上看没有链接 收起回复

全部0条评论

快来发表一下你的评论吧 !

×
20
完善资料,
赚取积分