🌡️ Temperature & Humidity Monitor

Monitor real-time temperature and humidity using the DHT11 sensor and display the data through the Arduino Serial Monitor.

Components Needed



DHT11 Sensor


Breadboard


Jumper Wires


  • How It Works

    The DHT11 sensor measures temperature and humidity. The Arduino reads the values and sends them to the Serial Monitor, where they can be viewed in real time.

  • What You'll Learn

    ✅ Reading sensor data

    ✅ Using external libraries

    ✅ Serial Monitor basics

    ✅ Environmental monitoring


#include 

#define DHTPIN 2
#define DHTTYPE DHT11

DHT dht(DHTPIN, DHTTYPE);

void setup() {
  Serial.begin(9600);
  dht.begin();
}

void loop() {
  float temperature = dht.readTemperature();
  float humidity = dht.readHumidity();

  Serial.print("Temperature: ");
  Serial.print(temperature);
  Serial.println(" °C");

  Serial.print("Humidity: ");
  Serial.print(humidity);
  Serial.println(" %");

  delay(2000);
}