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

Arduino UNO WiFi-Based Environmental Monitoring System with I2C LCD Display

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

Circuit Documentation

Summary

This circuit is designed to measure environmental parameters such as light intensity and temperature. It uses an Arduino UNO R4 WiFi as the main microcontroller, interfaced with a 16x2 I2C LCD screen for display, a DHT22 sensor for temperature and humidity, an LM35 temperature sensor, and a photocell (LDR) for light intensity measurement. The data from the sensors is processed by the Arduino and displayed on the LCD screen.

Component List

I2C LCD 16x2 Screen

Arduino UNO R4 WiFi

Photocell (LDR)

Resistor

DHT22

Temperature Sensor (LM35)

Wiring Details

I2C LCD 16x2 Screen

Arduino UNO R4 WiFi

Photocell (LDR)

Resistor

DHT22

Temperature Sensor (LM35)

Code Documentation

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

// Define the I2C address for the 16x2 LCD (often 0x27 or 0x3F for I2C LCDs)
LiquidCrystal_I2C lcd(0x27, 16, 2);

int sensorPin = A0;  // Pin where LDR is connected
int sensorValue = 0; // Variable to store the value coming from the sensor

void setup() {
  // Initialize the LCD
  lcd.init();
  lcd.backlight();

  // Start serial communication
  Serial.begin(9600);
  lcd.setCursor(0, 0);
  lcd.print("Light Level: ");
}

void loop() {
  // Read the value from the photoresistor
  sensorValue = analogRead(sensorPin);

  // Print the sensor value to the Serial Monitor
  Serial.print("Photoresistor Value: ");
  Serial.println(sensorValue);

  // Determine the light level based on the sensor value
  String lightLevel;
  if (sensorValue < 200) {
    lightLevel = "Dark";
  } else if (sensorValue < 400) {
    lightLevel = "Partially Dark";
  } else if (sensorValue < 600) {
    lightLevel = "Medium";
  } else if (sensorValue < 800) {
    lightLevel = "Fully Lit";
  } else {
    lightLevel = "Brightly Lit";
  }

  // Display the light level on the LCD
  lcd.setCursor(0, 1);  // Set the cursor to the second line
  lcd.print("                "); // Clear the second line
  lcd.setCursor(0, 1);  // Reset cursor
  lcd.print(lightLevel); // Display the light level

  // Wait 1 second before the next reading (for ease of testing)
  delay(1000);
}

This code initializes the I2C LCD and reads the light intensity from the LDR connected to the Arduino. The light level is then displayed on the LCD screen and printed to the Serial Monitor. The light level is categorized into different levels based on the sensor value.