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

Arduino Uno-Based Smart Environmental Monitoring System with LCD Display and Sound Detection

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

Circuit Documentation

Summary

This circuit is designed to monitor environmental conditions using various sensors and display the data on an LCD. It includes temperature and humidity sensing, sound detection, and heartbeat monitoring. The circuit also features visual and auditory alerts using LEDs and a buzzer, and it controls a relay to manage a fan based on temperature thresholds.

Component List

  1. Arduino Uno R3

    • Description: Microcontroller board based on the ATmega328P.
    • Pins: USB Port, Power Jack, Not Connected, IOREF, RESET, 3.3V, 5V, GND, VIN, A0, A1, A2, A3, A4/SDA, A5/SCL, SCL, SDA, AREF, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
  2. LED: Two Pin (red)

    • Description: Red LED for visual indication.
    • Pins: cathode, anode
  3. DHT22

    • Description: Temperature and humidity sensor.
    • Pins: +, Out, -
  4. KY 038

    • Description: Sound sensor module.
    • Pins: +, G, A0, D0
  5. LED: Two Pin (yellow)

    • Description: Yellow LED for visual indication.
    • Pins: cathode, anode
  6. LED: Two Pin (green)

    • Description: Green LED for visual indication.
    • Pins: cathode, anode
  7. Lcd 20x4 i2c

    • Description: 20x4 character LCD with I2C interface.
    • Pins: GND, 5v, SCA, SCL
  8. 220 fan

    • Description: 220V fan for cooling.
    • Pins: N, L
  9. 240v Power Source

    • Description: 240V AC power source.
    • Pins: Live, Neutral
  10. PTC

    • Description: Positive Temperature Coefficient thermistor.
    • Pins: Neutral, Live
  11. SSR-25A

    • Description: Solid State Relay for switching high voltage.
    • Pins: -, +, 1-in, 2-out
  12. buzzer

    • Description: Buzzer for auditory alerts.
    • Pins: PIN, GND
  13. power jack

    • Description: Power jack for connecting external power.
    • Pins: POSITIF, NEGATIF

Wiring Details

Arduino Uno R3

LED: Two Pin (red)

DHT22

KY 038

LED: Two Pin (yellow)

LED: Two Pin (green)

Lcd 20x4 i2c

220 fan

240v Power Source

PTC

SSR-25A

buzzer

power jack

Code Documentation

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

// DHT22 configuration
#define DHTPIN 2         // Pin connected to the DHT22 data pin
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);

// LED pins
#define GREEN_LED 4
#define YELLOW_LED 5
#define RED_LED 6

// Sound sensor pins
#define SOUND_SENSOR_PIN 3  // Digital out pin
#define SOUND_SENSOR_ANALOG_PIN A1  // Analog out pin

// Heartbeat sensor pin
#define HEARTBEAT_PIN A0

// Buzzer pin
#define BUZZER_PIN 7

// Relay pin
#define RELAY_PIN 8

// LCD configuration
LiquidCrystal_I2C lcd(0x27, 20, 4);  // Adjust the I2C address if necessary

void setup() {
  // Initialize serial communication
  Serial.begin(9600);

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

  // Initialize LCD
  lcd.begin(20, 4); // Use 20 columns and 4 rows
  lcd.backlight();

  // Initialize pins
  pinMode(GREEN_LED, OUTPUT);
  pinMode(YELLOW_LED, OUTPUT);
  pinMode(RED_LED, OUTPUT);
  pinMode(SOUND_SENSOR_PIN, INPUT);
  pinMode(HEARTBEAT_PIN, INPUT);
  pinMode(BUZZER_PIN, OUTPUT);
  pinMode(RELAY_PIN, OUTPUT);

  // Turn on relay initially
  digitalWrite(RELAY_PIN, HIGH);
}

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

  // Read heartbeat sensor value
  int heartbeatValue = analogRead(HEARTBEAT_PIN);
  float heartbeatRate = map(heartbeatValue, 0, 1023, 60, 160); // Adjust mapping as needed

  // Read sound sensor value
  int soundDetected = digitalRead(SOUND_SENSOR_PIN);
  int soundLevel = analogRead(SOUND_SENSOR_ANALOG_PIN); // Read analog sound level

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

  lcd.setCursor(0, 1);
  lcd.print("Heart: ");
  lcd.print(heartbeatRate);
  lcd.print(" bpm