Measuring Temperature and Humidity using DHT11:

Component list:
1. DTH11 Temp/Humidity Sensor
2. 4K7 Resistor
3. Arduino UNO

Data pin of the Sensor can be connected to any digital pin of the UNO.
Also needs to pull up data pin with 4K7 resistor.
DTH11 can be powered from the UNO board.
connect the board to USB through to the computer.

Launch Arduino IDE, from Library manager, install Adafruit DHT sensor Library.

Arduino code:

//Example testing sketch for DHT11/22 sensors
// DHT Sensor Library:
//AMP technology @ 2021
#include "DHT.h"
#define DHTPIN 7     // Digital pin connected to the DHT sensor
#define DHTTYPE DHT11   // DHT11 Sensor
// Initialize DHT sensor.
void setup() {
   Serial.println(“DTH11 Sett up”);

void loop() {
// Wait a few seconds between measurements.
// Reading temperature or humidity takes about 250 milliseconds!
//read Humidity  
  float h = dht.readHumidity();
// Read temperature as Celsius (the default)
  float t = dht.readTemperature();
// Check if any reads failed and exit early (to try again).
  if (isnan(h) || isnan(t) || isnan(f)) {
      Serial.println("Failed to read from DHT sensor!");
  Serial.println("Humidity: ");
  Serial.println("Temperature: ");
  Serial.print("°C ")


For Comment you need to Login