Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino Uno R3 with DHT11 Sensor and LCD I2C Display for Temperature and Humidity Monitoring

View and Edit Project In Cirkit DesignerImage of Arduino Uno R3 with DHT11 Sensor and LCD I2C Display for Temperature and Humidity Monitoring

Circuit Documentation

Summary

The circuit in question is designed to interface a DHT11 temperature and humidity sensor with an Arduino Uno R3 microcontroller board, and display the sensor readings on an LCD I2C display. The Arduino Uno R3 serves as the central processing unit, reading data from the DHT11 sensor and controlling the LCD display via the I2C communication protocol.

Component List

DHT11 Temperature and Humidity Sensor

Arduino Uno R3

LCD I2C Display

Wiring Details

DHT11 Temperature and Humidity Sensor

Arduino Uno R3

LCD I2C Display

Documented Code

Arduino Uno R3 Code

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include "DHT.h"

#define DHTPIN 2
#define DHTTYPE DHT11

DHT dht(DHTPIN, DHTTYPE);

LiquidCrystal_I2C lcd(0x27,16,2); 

void setup() {
  dht.begin();
  lcd.init(); 
  lcd.backlight();
  lcd.clear();

  lcd.setCursor(0,0);
  lcd.print("Temp:");
  lcd.setCursor(0,1);
  lcd.print("Humid:");
}

void loop() {
  delay(1500);
  
  float h = dht.readHumidity();
  float t = dht.readTemperature();

  if (isnan(h) || isnan(t)) {
    return;
  }

  lcd.setCursor(7, 0);
  lcd.print(t);
  lcd.setCursor(7, 1);
  lcd.print(h);
}

Filename: sketch.ino

Description: This code initializes the DHT11 sensor and the LCD I2C display. In the setup() function, it begins communication with the DHT11 sensor and sets up the LCD display with the initial text for temperature and humidity. The loop() function reads the temperature and humidity from the DHT11 sensor every 1.5 seconds and updates the display with the new readings. If the sensor readings are not valid (NaN), the function returns without updating the display.

(Note: The code for the DHT11 sensor and the LCD I2C display is not provided as it is assumed to be part of the standard libraries included at the beginning of the sketch.)