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

Arduino UNO-Based Temperature-Controlled Actuator System with LCD Display

View and Edit Project In Cirkit DesignerImage of Arduino UNO-Based Temperature-Controlled Actuator System with LCD Display

Circuit Documentation

Summary

This circuit involves an Arduino UNO microcontroller interfacing with multiple components including three 1-Channel Relays, an LCD display, a DHT22 temperature and humidity sensor, and an actuator motor. The Arduino UNO reads temperature and humidity data from the DHT22 sensor and displays it on the LCD. Based on the temperature readings, the Arduino controls the relays to activate or deactivate the actuator motor.

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. 1-Channel Relay (5V 10A)

    • Description: Relay module for switching high voltage devices.
    • Pins: NC, signal, C, power, NO, ground
  3. Lcd 20x4 i2c

    • Description: 20x4 character LCD display with I2C interface.
    • Pins: GND, 5v, SCA, SCL
  4. Actuator Motor

    • Description: Motor for actuation purposes.
    • Pins: 12 V, Ground
  5. DHT22

    • Description: Temperature and humidity sensor.
    • Pins: +, Out, -
  6. Power 220v

    • Description: 220V power supply.
    • Pins: hot wire, neutral wire

Wiring Details

Arduino UNO

1-Channel Relay (5V 10A)

Lcd 20x4 i2c

Actuator Motor

DHT22

Power 220v

Code Documentation

Arduino UNO Code

#include <Wire.h>               // Untuk komunikasi I2C 
#include <LiquidCrystal_I2C.h>   // Untuk mengendalikan LCD 
#include <DHT.h>                 // Untuk mengendalikan sensor DHT22 

// Deklarasi pin untuk DHT22 dan relay 
#define DHTPIN 2                // Pin untuk DHT22 
#define DHTTYPE DHT22           // Jenis sensor DHT (DHT22) 
DHT dht(DHTPIN, DHTTYPE);       // Inisialisasi sensor DHT 

// Inisialisasi LCD (alamat I2C: 0x27, 20 kolom dan 4 baris) 
LiquidCrystal_I2C lcd(0x27, 20, 4);  

// Pin untuk relay 
int relay1 = 3;               // Relay 1 
int relay2 = 4;               // Relay 2 
int relay3 = 5;               // Relay 3 

void setup() { 
  // Mulakan komunikasi serial 
  Serial.begin(9600); 
   
  // Mulakan DHT sensor 
  dht.begin(); 
   
  // Mulakan LCD 
  lcd.begin(20, 4); 
  lcd.setBacklight(1); // Nyalakan lampu latar LCD 
   
  // Set pin relay sebagai output 
  pinMode(relay1, OUTPUT); 
  pinMode(relay2, OUTPUT); 
  pinMode(relay3, OUTPUT); 
   
  // Paparkan mesej "Selamat Datang Ke Bengkel PPU" 
  lcd.clear(); 
  lcd.setCursor(0, 0); 
  lcd.print("Selamat Datang Ke"); 
  lcd.setCursor(0, 1); 
  lcd.print("Bengkel PPU"); 
  delay(3000);  // Paparkan mesej selama 3 saat 
} 

void loop() { 
  // Baca suhu dan kelembapan dari sensor DHT22 
  float suhu = dht.readTemperature(); // Suhu dalam Celsius 
  float kelembapan = dht.readHumidity(); // Kelembapan dalam % 

  // Periksa jika pembacaan gagal 
  if (isnan(suhu) || isnan(kelembapan)) { 
    lcd.clear(); 
    lcd.setCursor(0, 0); 
    lcd.print("Pembacaan gagal!"); 
    delay(2000); 
    return; 
  } 

  // Paparkan suhu dan kelembapan pada LCD 
  lcd.clear(); 
  lcd.setCursor(0, 0); 
  lcd.print("Suhu: "); 
  lcd.print(suhu); 
  lcd.print(" C"); 
   
  lcd.setCursor(0, 1); 
  lcd.print("Kelembapan: "); 
  lcd.print(kelembapan); 
  lcd.print(" %"); 

  // Logik untuk mengawal relay berdasarkan suhu 
  if (suhu > 30.0) {       // Jika suhu lebih besar dari 30°C 
    digitalWrite(relay1, HIGH); // Hidupkan relay1 (actuator) 
    digitalWrite(relay2, LOW);  // Matikan relay2 
    digitalWrite(relay3, LOW);  // Matikan relay3 
  }  
  else if (suhu > 25.0) {  // Jika suhu lebih besar dari 25°C tetapi kurang dari 30°C 
    digitalWrite(relay1, LOW);  // Matikan relay1 
    digitalWrite(relay2, HIGH); // Hidupkan relay2 (actuator) 
    digitalWrite(relay3, LOW);  // Matikan relay3 
  }  
  else {                   // Jika suhu kurang dari 25°C 
    digitalWrite(relay1, LOW);  // Matikan relay1 
    digitalWrite(relay2, LOW);  // Matikan relay2 
    digitalWrite(relay3, HIGH); // Hidupkan relay3 (actuator) 
  } 

  delay(2000);  // Tunggu 2 saat sebelum membaca semula 
}

1-Channel Relay Code

void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}

This documentation provides a comprehensive overview of