Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Project Documentation

Arduino-Controlled Incubator with Temperature Regulation and LCD Display

Image of Arduino-Controlled Incubator with Temperature Regulation and LCD Display

Circuit Documentation

Summary

This circuit is designed to control an incubator's temperature using a DHT22 temperature and humidity sensor, a 5V relay to switch an AC bulb (used as a heater), and a 120mm 12V fan for air circulation. The system is controlled by an Arduino UNO microcontroller, which interfaces with an LCD display for user feedback and three pushbuttons for user input to set the desired temperature. The relay controls the power to the AC bulb, and the fan is connected to a 12V power supply. The circuit includes resistors for current limiting and pull-up configurations.

Component List

DHT22

  • Temperature and Humidity Sensor
  • Pins: + (Power), Out (Signal), - (Ground)

5V Relay

  • Electromechanical switch
  • Pins: Normally Open, Common terminal, Normally Closed, In (Control), GND, VCC

LCD 16x2 (Wokwi Compatible)

  • Alphanumeric Liquid Crystal Display
  • Pins: VSS, VDD, V0, RS, RW, E, D0-D7, A (Anode), K (Cathode)

LCM1602 IIC

  • I2C Interface for LCD
  • Pins: GND, VCC, SDA, SCL, D6-D7, A, K, VSS, VDD, V0, RS, D2-D5, RW, E, D0-D1, LED_A, LED_B

Pushbutton (x3)

  • Momentary tactile switch
  • Pins: Pin 1, Pin 2, Pin 3, Pin 4

Resistor (x3)

  • Electrical passive component
  • Resistance: 10 Ohms, 200 Ohms, 200 Ohms

AC Bulb

  • Incandescent light bulb
  • Pins: P (Phase), N (Neutral)

POWER SUPPLY 12V 5AMP

  • DC Power Supply
  • Pins: 220V Positive Pole (AC), 220V Negative Pole (AC), GND, GND (DC), 12V-24V Output (DC)

120mm Fan 12V

  • Cooling fan
  • Pins: 12V+, GND

Arduino UNO

  • Microcontroller Board
  • Pins: Digital I/O, Analog Inputs, Power, Ground, and other control pins

Wiring Details

DHT22

    • to 5V
  • Out to Arduino UNO D5
    • to GND

5V Relay

  • In to Arduino UNO D6
  • VCC to 5V
  • GND to GND
  • Normally Open to AC Bulb P
  • Common terminal to 220V Positive Pole (AC)

LCD 16x2 (Wokwi Compatible) & LCM1602 IIC

  • VSS to VSS
  • VDD to VDD
  • V0 to V0
  • RS to RS
  • RW to RW
  • E to E
  • D0 to D0
  • D1 to D1
  • D2 to D2
  • D3 to D3
  • D4 to D4
  • D5 to D5
  • D6 to D6
  • D7 to D7
  • A to A
  • K to K

Pushbuttons (x3)

  • Pin 4 to Arduino UNO D4, D3, D2 (respectively for each button)
  • Pin 2 to GND
  • Pin 3 to Resistor (10 Ohms, 200 Ohms, 200 Ohms respectively for each button)

Resistor (x3)

  • One side to Pushbutton Pin 3
  • Other side to 5V

AC Bulb

  • P to 5V Relay Normally Open
  • N to 220V Negative Pole (AC)

POWER SUPPLY 12V 5AMP

  • 220V Positive Pole (AC) to 5V Relay Common terminal
  • 220V Negative Pole (AC) to AC Bulb N and 120mm Fan 12V+
  • GND to GND (DC)
  • 12V-24V Output (DC) to 120mm Fan 12V+

120mm Fan 12V

  • 12V+ to 220V Negative Pole (AC)
  • GND to GND

Arduino UNO

  • D6 to 5V Relay In
  • D5 to DHT22 Out
  • D4, D3, D2 to Pushbuttons Pin 4
  • A4 to LCM1602 IIC SDA
  • A5 to LCM1602 IIC SCL
  • 5V to DHT22 +, 5V Relay VCC, LCM1602 IIC VCC, and Resistor (10 Ohms, 200 Ohms, 200 Ohms)
  • GND to DHT22 -, 5V Relay GND, LCM1602 IIC GND, Pushbuttons Pin 2

Documented Code

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

// Configuration of pins
#define DHTPIN 4           // Data pin for DHT22 sensor
#define DHTTYPE DHT22      // DHT sensor type
#define RELAY_PIN 7        // Relay pin for the heater
#define BUTTON_INC 8       // Pushbutton 1: Increase target temperature
#define BUTTON_DEC 9       // Pushbutton 2: Decrease target temperature
#define BUTTON_TOGGLE 10   // Pushbutton 3: Toggle heater on/off

DHT dht(DHTPIN, DHTTYPE);
LiquidCrystal_I2C lcd(0x27, 16, 2);

float targetTemp = 37.5;    // Initial target temperature
bool heating = false;       // Heater status

void setup() {
  pinMode(RELAY_PIN, OUTPUT);
  pinMode(BUTTON_INC, INPUT_PULLUP);
  pinMode(BUTTON_DEC, INPUT_PULLUP);
  pinMode(BUTTON_TOGGLE, INPUT_PULLUP);

  lcd.begin(16, 2); // Initialize the LCD
  lcd.backlight();
  dht.begin();

  Serial.begin(9600);
  lcd.setCursor(0, 0);
  lcd.print("Incubator Ready");
  delay(2000);
  lcd.clear();
}

void loop() {
  // Read temperature from the sensor
  float temperature = dht.readTemperature();
  if (isnan(temperature)) {
    Serial.println("Failed to read temperature");
    return;
  }

  // Target temperature control with pushbuttons
  if (digitalRead(BUTTON_INC) == LOW) {
    targetTemp += 0.5;
    delay(300);
  }
  if (digitalRead(BUTTON_DEC) == LOW) {
    targetTemp -= 0.5;
    delay(300);
  }

  // Manual heater control
  if (digitalRead(BUTTON_TOGGLE) == LOW) {
    heating = !heating; // Toggle heater status
    delay(300);
  }

  // Automatic heater control based on temperature
  if (temperature < targetTemp) {
    heating = true;
  } else if (temperature >= targetTemp) {
    heating = false;
  }

  // Heater relay control
  digitalWrite(RELAY_PIN, heating ? HIGH : LOW);

  // Display temperature, target, and heater status on LCD
  lcd.setCursor(0, 0);
  lcd.print("Temp: ");
  lcd.print(temperature);
  lcd.print(" C");

  lcd.setCursor(0, 1);
  lcd.print("Target: ");
  lcd.print(targetTemp);
  lcd.print(" C ");
  lcd.print(heating ? "ON" : "OFF");

  // Delay for the next reading
  delay(2000);
}

This code is responsible for reading the temperature from the DHT22 sensor, controlling the relay based on the temperature and user input, and displaying the current temperature, target temperature, and heater status on the LCD. The pushbuttons allow the user to adjust the target temperature and toggle the heater on or off.