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

Arduino-Based Temperature and Humidity Monitor with LCD Display and Adjustable Contrast

View and Edit Project In Cirkit DesignerImage of Arduino-Based Temperature and Humidity Monitor with LCD Display and Adjustable Contrast

Circuit Documentation

Summary

This circuit reads temperature and humidity data from a DHT11 sensor and displays the values on a 16x2 LCD. A potentiometer is used to adjust the contrast of the LCD display. The circuit is controlled by an Arduino UNO+WiFi R3 ATmega328P+Node MCU ESP8266 CH340G microcontroller.

Component List

  1. DHT11 Humidity and Temperature Sensor

    • Description: Measures temperature and humidity.
    • Pins: VDD, DATA, NULL, GND
  2. LCD 16x2 (Wokwi Compatible)

    • Description: Displays data on a 16x2 character screen.
    • Pins: VSS, VDD, V0, RS, RW, E, D0, D1, D2, D3, D4, D5, D6, D7, A, K
  3. Potentiometer

    • Description: Adjusts the contrast of the LCD display.
    • Pins: GND, Output, VCC
  4. Arduino UNO+WiFi R3 ATmega328P+Node MCU ESP8266 CH340G

    • Description: Microcontroller that controls the circuit.
    • Pins: KORF, RST, 3.5v, 5.0v, GND, VIN, A0, A1, A2, A3, A4, A5, SCL, SDA, ARET, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, TX, RX

Wiring Details

DHT11 Humidity and Temperature Sensor

LCD 16x2 (Wokwi Compatible)

Potentiometer

Arduino UNO+WiFi R3 ATmega328P+Node MCU ESP8266 CH340G

Code Documentation

/*
 * This Arduino Sketch reads temperature and humidity data from a DHT11 sensor
 * and displays the values on a 16x2 LCD. A potentiometer is used to adjust the
 * contrast of the LCD display.
 */

#include <DHT.h>
#include <LiquidCrystal.h>

#define DHTPIN 2     // Pin connected to DHT11 data pin
#define DHTTYPE DHT11
#define RS 7
#define E 8
#define D4 9
#define D5 10
#define D6 11
#define D7 12

DHT dht(DHTPIN, DHTTYPE);
LiquidCrystal lcd(RS, E, D4, D5, D6, D7);

void setup() {
  // Initialize the LCD
  lcd.begin(16, 2);
  lcd.print("Initializing...");

  // Initialize the DHT sensor
  dht.begin();

  // Print a message to the LCD
  lcd.setCursor(0, 1);
  lcd.print("DHT11 Sensor");
  delay(2000);
  lcd.clear();
}

void loop() {
  // Read temperature and humidity
  float h = dht.readHumidity();
  float t = dht.readTemperature();

  // Check if any reads failed and exit early (to try again).
  if (isnan(h) || isnan(t)) {
    lcd.setCursor(0, 0);
    lcd.print("Sensor error");
    return;
  }

  // Print temperature and humidity to LCD
  lcd.setCursor(0, 0);
  lcd.print("Temp: ");
  lcd.print(t);
  lcd.print(" C");

  lcd.setCursor(0, 1);
  lcd.print("Humidity: ");
  lcd.print(h);
  lcd.print(" %");

  delay(2000); // Wait a few seconds between measurements
}

This code initializes the DHT11 sensor and the LCD display. It reads the temperature and humidity data from the DHT11 sensor and displays the values on the LCD. The potentiometer is used to adjust the contrast of the LCD display.