DHT11 Module

DHT11 Temperature and Relative Humidity Sensor Module With Cable


29 ₪

الناشر: متجر القطع الالكترونية

القسم: مستشعرات - سينسور

تاريخ النشر: 2021-07-15





DHT11/DHT22 Interfacing with ESP32

Connect the DHT11/DHT22 to ESP32 along with a 10K ohm pull-up resistor. The connection diagrams are shown in the pictures below.



يمكن ان نوصلها مباشرة بدون المقاومات ويمكن ان نوصل مقاومات كما في الدوائر تحت









Download DHT11 and DHT22 libraries

You will see many options available for DHT11 and DHT22 libraries. Select Adafruit library and click on the install button. You can select the latest version from the version window.





DHT11/DHTT22 Display Readings on Arduino Serial Monitor

code
نسخ
اقتباس
عرض
تنزيل
	
								
#include <Wire.h> #include "DHT.h" // Uncomment one of the lines below for whatever DHT sensor type you're using! //#define DHTTYPE DHT11 // DHT 11 //#define DHTTYPE DHT21 // DHT 21 (AM2301) #define DHTTYPE DHT22 // DHT 22 (AM2302), AM2321 //DHT Sensor; uint8_t DHTPin = 4; DHT dht(DHTPin, DHTTYPE); float Temperature; float Humidity; float Temp_Fahrenheit; void setup() { Serial.begin(115200); pinMode(DHTPin, INPUT); dht.begin(); } void loop() { Humidity = dht.readHumidity(); // Read temperature as Celsius (the default) Temperature = dht.readTemperature(); // Read temperature as Fahrenheit (isFahrenheit = true) Temp_Fahrenheit= dht.readTemperature(true); // Check if any reads failed and exit early (to try again). if (isnan(Humidity) || isnan(Temperature) || isnan(Temp_Fahrenheit)) { Serial.println(F("Failed to read from DHT sensor!")); return; } Serial.print(F("Humidity: ")); Serial.print(Humidity); Serial.print(F("% Temperature: ")); Serial.print(Temperature); Serial.print(F("°C ")); Serial.print(Temp_Fahrenheit); Serial.println(F("°F ")); delay(1000); }


سلة المشتريات افراغ السلة