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

Arduino-Based Environmental Monitoring System with LCD Display

View and Edit Project In Cirkit DesignerImage of Arduino-Based Environmental Monitoring System with LCD Display

Circuit Documentation

Summary

This circuit is designed to read data from a soil moisture sensor, a DHT11 temperature and humidity sensor, and a photocell (LDR). The sensor readings are then displayed on a 16x2 LCD. The circuit is controlled by an Arduino UNO microcontroller.

Component List

  1. Arduino UNO

    • Description: Microcontroller board based on the ATmega328P.
    • Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
  2. Soil Moisture Sensor

    • Description: Sensor to measure the moisture level in the soil.
    • Pins: VCC, GND, SIG
  3. DHT11

    • Description: Temperature and humidity sensor.
    • Pins: VCC, GND, DATA
  4. Photocell (LDR)

    • Description: Light-dependent resistor used to measure light levels.
    • Pins: pin 0, pin 1
  5. Resistor

    • Description: 10k Ohm resistor.
    • Pins: pin1, pin2
    • Properties: Resistance: 10k Ohms
  6. LCD 16x2 (Wokwi Compatible)

    • Description: 16x2 character LCD display.
    • Pins: VSS, VDD, V0, RS, RW, E, D0, D1, D2, D3, D4, D5, D6, D7, A, K
  7. Potentiometer

    • Description: Variable resistor used to adjust the contrast of the LCD.
    • Pins: GND, Output, VCC

Wiring Details

Arduino UNO

Soil Moisture Sensor

DHT11

Photocell (LDR)

Resistor

LCD 16x2 (Wokwi Compatible)

Potentiometer

Code Documentation

/*
 * This Arduino Sketch reads data from a soil moisture sensor, a DHT11 sensor,
 * and a photocell (LDR). It then displays the sensor readings on a 16x2 LCD.
 */

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

// Pin definitions
#define SOIL_MOISTURE_PIN A0
#define DHT_PIN 2
#define LDR_PIN A1
#define DHT_TYPE DHT11

// Initialize the LCD library with the numbers of the interface pins
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
DHT dht(DHT_PIN, DHT_TYPE);

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

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

  // Wait for sensors to stabilize
  delay(2000);
}

void loop() {
  // Read soil moisture
  int soilMoistureValue = analogRead(SOIL_MOISTURE_PIN);

  // Read temperature and humidity from DHT11
  float humidity = dht.readHumidity();
  float temperature = dht.readTemperature();

  // Read light level from LDR
  int ldrValue = analogRead(LDR_PIN);

  // Clear the LCD
  lcd.clear();

  // Display soil moisture
  lcd.setCursor(0, 0);
  lcd.print("Soil: ");
  lcd.print(soilMoistureValue);

  // Display temperature and humidity
  lcd.setCursor(0, 1);
  lcd.print("Temp: ");
  lcd.print(temperature);
  lcd.print("C ");
  lcd.print("Hum: ");
  lcd.print(humidity);
  lcd.print("%");

  // Wait before next update
  delay(2000);

  // Display light level
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Light: ");
  lcd.print(ldrValue);

  // Wait before next update
  delay(2000);
}

This code initializes the LCD and DHT11 sensor, reads data from the soil moisture sensor, DHT11 sensor, and LDR, and displays the readings on the LCD. The readings are updated every 2 seconds.