当前位置:首页 > 科学研究 > 电子编程 > 正文内容

Arduino Project 036 - DTH Temperature and Humid Sensor

RonWang3周前 (11-30)电子编程66

The DHT11 Temperature and Humidity Sensor senses, measures and regularly reports the relative humidity in the air. It measures both moisture and air temperature. The warmer the air is, the more moisture it can hold, so relative humidity changes with fluctuations in the temperature.

Humidity sensors detect the relative humidity of immediate environments in which they are placed. They measure both moisture and temperature in the air and express relative humidity as a percentage of the ratio of moisture in the air to the maximum amount that can be held in the air at the current temperature. As the air becomes hotter, it holds more moisture, so the relative humidity changes with the temperature.

The DHT11 sensor operates by utilizing a thermistor to measure temperature and a humidity-sensitive capacitor to gauge the relative humidity in the surrounding environment. When connected to an Arduino board, the sensor sends digital signals that can be interpreted to obtain accurate readings of both temperature and humidity levels.

Inside the DHT11, changes in temperature cause resistance in the thermistor to vary, affecting the voltage drop across it. This change is then converted into a digital signal for processing. Similarly, fluctuations in humidity lead to alterations in capacitance within the sensor’s circuitry, which are also translated into digital data for analysis.

Project 36 DTH Temperature and Humid Sensor

/* Coding Ron Wang
   Nov.28th 2024
   Autaba provides Hardware support for the project
   © Schematic Design Fritzing By Ron Wang 2024 NY
   © Circuit Design Fritzing By Ron Wang 2024 NY
   Project 36  DHT11 Temperature and Humid Sensor
 */
#include  <SimpleDHT.h> // Adding DHT libraries
int  pinDHT11 = 11;  //Declaring digital pin no 11 as the dht11 data pin
SimpleDHT11 dht11;
void setup() {
 Serial.begin(9600); // Choose 9600 at the  port screen 
}
void loop() {
   
  Serial.println("=================================");
  Serial.println("DHT11 readings...");
  byte temperature = 0;
  byte humidity = 0;
  int err = SimpleDHTErrSuccess;
  //This bit will tell our Arduino what to do if there is some sort of an error at getting readings  from our sensor
  if ((err = dht11.read(pinDHT11, &temperature, &humidity, NULL))  != SimpleDHTErrSuccess) {
    Serial.print("No reading , err="); Serial.println(err);delay(1000);
    return;
  }
  
  Serial.print("Readings: ");
  Serial.print((int)temperature);  Serial.print(" Celcius, ");
  Serial.print((int)humidity); Serial.println("  %");
  delay(750);
}

Arduino Temp and Humid Circuit

DTH Temperature and Humid Sensor Circuit

Arduino Temp and Humid Sensor Schematic

DTH Temperature and Humid Sensor Schematic

版权声明:本文为原创文章,版权归donstudio所有,欢迎分享本文,转载请保留出处!

本文链接:http://parentscn.com/?id=293

标签: Arduino

相关文章

​Arduino Project 046 - Based Security System by Arduino with Lcd Display

​Arduino Project 046 - Based Security System by Arduino with Lcd Display

Arduino Project 046 - Based Security System by Arduino with Lcd Display/*  * Project ...

Arduino Project 021 -  LED Dot Matrix Display - Scrolling Message

Arduino Project 021 - LED Dot Matrix Display - Scrolling Message

There are many different ways to drive LEDs. Using shift registers is one way and they have their a...

C语言调试运行环境TurboC的安装

C语言调试运行环境TurboC的安装

上大学时学习《C语言程序设计》(第二版)作者谭浩强,大部分编程时间是在学校机房度过,每次点开桌面的TurboC图标,就开始在里面敲代码,然后保存程序Abc.C,下一步进行编译,如果编译成功的话,就可以...

Arduino Project 020 -  LED Dot Matrix Display - Beat Heart

Arduino Project 020 - LED Dot Matrix Display - Beat Heart

You’re going to use the same circuit, but with a slight variation in the code to create a multi-fram...

Arduino Project 028B - Basic Stepper Control (Unipolar)

Arduino Project 028B - Basic Stepper Control (Unipolar)

In this very simple project, you will connect up a stepper motor and then get the Arduino to control...

C语言调试运行环境Pelles C的安装

C语言调试运行环境Pelles C的安装

C语言调试运行环境之TurboC一文介绍了在32位Windows系统下安装C语言运行环境之TubroC,但是由于TurobC只能在32位系统下运行,导致现在很多Windows10和Windows 11...

发表评论

访客

看不清,换一张

◎欢迎参与讨论,请在这里发表您的看法和观点。