Performance Parameters① Main Control Chip: ATmega328P② Digital I/O Pins: 14③ PWM Pins: 6④ Storage (Code Space) 32KB⑤ RAM (Runtime Storage) 2KB; EEPROM (Power-off Storage) 1KB⑥ Crystal Oscillator 16MHzOnline Simulation: https://wokwi.com/
Arduino Uno Tutorial ①: Install Arduino IDE
Arduino Uno Tutorial ②: Development Board and LED Test Arduino Uno Tutorial ③: Button Control LED, with Exercises Arduino Uno Tutorial ④: Analog Quantity, Using ADC to Measure Voltage Arduino Uno Tutorial ⑤: External Interrupt, with ExercisesArduino Uno Tutorial ⑥: Serial Communication, Sending and ReceivingArduino Uno Tutorial ⑦: 0.96-inch OLED Screen Arduino Uno Tutorial ⑧: 0.96-inch OLED Screen Chinese & Image DisplayArduino Uno Tutorial ⑨: DHT11 Temperature and Humidity Sensor
(1) Introduction 1. Working PrincipleThe DHT11 contains a capacitive humidity sensing element and an NTC temperature sensing element, which are used to measure the humidity and temperature of the environment, respectively. The sensor converts the measured temperature and humidity into a digital signal output through an internal signal conditioning circuit. The humidity measurement is based on the effect of humidity on capacitance; as environmental humidity changes, the capacitance value of the sensor also changes, and the DHT11 uses the signal conditioning circuit to convert this change into a digital signal output. The temperature measurement is based on the principle of thermistors; when temperature changes, the resistance value of the thermistor changes accordingly. The DHT11 measures this change in resistance value and converts it into a digital signal representing the ambient temperature.

2. Performance Parameters1. Measurement Range: Humidity 5%95%RH (some say 20%90%RH), Temperature -20+60℃ (some say 050℃). 2. Measurement Accuracy: Humidity ±5%RH, Temperature ±2℃. 3. Resolution: Humidity 1%RH, Temperature 0.1℃. 4. Supply Voltage: 3.3~5.5V DC. 5. Power Consumption: 0.06mA in standby, 1mA during measurement.3. Features and Advantages 1. Digital Signal Output: The DHT11 transmits temperature and humidity data to the main controller via a single data line in the form of a digital signal, with a data format of a 40-bit pulse signal, which includes 16 bits of humidity data, 16 bits of temperature data, and 8 bits of checksum. This allows the DHT11 to connect directly to various microcontrollers without complex analog signal processing. 2. High Accuracy and Stability: The DHT11 uses specialized digital module collection technology and temperature and humidity sensing technology to ensure the product has high reliability and excellent long-term stability. 3. Ultra-fast Response and Strong Anti-interference: The DHT11 has an ultra-fast response speed, capable of quickly and accurately measuring changes in environmental temperature and humidity, and has strong anti-interference capability.(2) Library FilesDHT11 Library File Download: https://wwmg.lanzouj.com/id6GV2fydzpa① Define DHT11 Sensor Type
③ Real-time Update Sensor Information
④ Get Temperature and Humidity Information and Save to Variables
humi = DHT11.humidity; temp = DHT11.temperature;
⑤ Serial Print Temperature and Humidity Information
Serial.print("Current Temperature (℃): "); Serial.println(temp);
Serial.print("Current Humidity (%): "); Serial.println(humi);
(3) Program① Include DHT11 Library and Define Sensor Type and Pin for Arduino Uno Board Pin 2
#include <dht11.h>// Include DHT11 Library
/********************### Definition ###********************/
dht11 DHT11;// Define Sensor Type
#define DHT11PIN 2// Define Sensor Connection Pin.
② Initialization Function Since we will output data to the serial port, set serial communication at a baud rate of 115200
void setup(){ Serial.begin(115200); }
③ Loop Function First Define Two Variables, One for Temperature and One for Humidity
int temp = 0; int humi = 0;
Update Sensor Information, Then Save Temperature and Humidity Information to Variables
DHT11.read(DHT11PIN); // Update All Sensor Information
humi = DHT11.humidity; temp = DHT11.temperature;
Serial Print Variables, Output Temperature and Humidity Data
Serial.print("Current Temperature (℃): "); Serial.println(temp);
Serial.print("Current Humidity (%): "); Serial.println(humi);
④ Phenomenon Demonstration

#include <dht11.h>// Include DHT11 Library
/********************### Definition ###********************/
dht11 DHT11;// Define Sensor Type
#define DHT11PIN 2// Define Sensor Connection Pin.
void setup(){ Serial.begin(115200); }
void loop() { int temp = 0; int humi = 0; DHT11.read(DHT11PIN); // Update All Sensor Information humi = DHT11.humidity; temp = DHT11.temperature; Serial.print("Current Temperature (℃): "); Serial.println(temp);
Serial.print("Current Humidity (%): "); Serial.println(humi);
delay(2000);
}
Free Application Development Board

Submission/Promotion/Cooperation/Join Group Please Scan to Add WeChat
(Please Note the Purpose, When Joining the Group Please Note City-Name-Industry Position Information)