Zbotic Logo Zbotic Logo
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

  • Shop
  • About Us
  • Contact Us
  • Reseller
  • Blogs
020 69134444
1800 209 0998
[email protected]
Help Desk
Facebook Twitter Instagram Linkedin YouTube
Zbotic Logo Zbotic Logo
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

All departments
  • 3D Print Service
  • 3D Printer
  • Batteries & Chargers
  • Development Boards
  • Drone Parts
  • EBike parts
  • Sensor Modules
  • Electronic Components
  • Electronic Modules
  • IoT and Wireless
  • Mechanical Parts and Workbench Tools
  • Motors & Drivers & Pumps & Actuators
  • DIY and Robot Kits
  • Show more
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
Return to previous page
Home Electronics Basics

Room Temperature Controller: Relay and Fan Automation

Room Temperature Controller: Relay and Fan Automation

April 1, 2026 /Posted by / 0
Table of Contents

  1. Project Overview
  2. Components Required
  3. Circuit Design
  4. Arduino Code with LCD Display
  5. Multi-Zone Control
  6. Adding WiFi with ESP32
  7. Recommended Components
  8. Extending the Project

A room temperature controller with relay and fan automation maintains comfortable room temperatures by automatically switching fans, coolers, or ACs based on sensor readings. This practical Arduino project is perfect for Indian homes and offices where temperature management directly affects comfort and productivity.

Project Overview

This project uses an Arduino or ESP32 to read room temperature, display it on an LCD, and control a relay that switches an AC fan or cooler. The system turns cooling on when temperature exceeds the set point and off when it drops below — with hysteresis to prevent rapid cycling.

Components Required

  • Arduino Uno (₹193) or ESP32 (₹329 for WiFi)
  • DHT22 temperature and humidity sensor (₹91)
  • 16×2 I2C LCD display for local readout
  • Relay module — 5V for fan, SSR for AC unit
  • Pushbuttons (2) for set point adjustment
  • Buzzer for alerts
  • 5V power supply or USB power

Core Components

Arduino Uno R3 Development Board
₹193
Buy Now
DHT22 Temperature & Humidity Sensor Module
₹91
Buy Now
1 Channel 5V Relay Module
₹84
Buy Now

Circuit Design

  • DHT22: VCC→5V, GND→GND, Data→Arduino pin 2
  • LCD I2C: SDA→A4, SCL→A5
  • Relay IN→Arduino pin 7
  • Button UP→pin 3, Button DOWN→pin 4 (with internal pull-ups)
  • Buzzer→pin 8

Arduino Code with LCD Display

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

#define DHT_PIN 2
#define RELAY_PIN 7
#define BTN_UP 3
#define BTN_DOWN 4
#define BUZZER 8
#define HYST 2.0

DHT dht(DHT_PIN, DHT22);
LiquidCrystal_I2C lcd(0x27, 16, 2);
float setpoint = 28.0;
bool fanOn = false;

void setup() {
  dht.begin();
  lcd.init(); lcd.backlight();
  pinMode(RELAY_PIN, OUTPUT);
  pinMode(BTN_UP, INPUT_PULLUP);
  pinMode(BTN_DOWN, INPUT_PULLUP);
  pinMode(BUZZER, OUTPUT);
}

void loop() {
  if (!digitalRead(BTN_UP)) { setpoint += 0.5; delay(200); }
  if (!digitalRead(BTN_DOWN)) { setpoint -= 0.5; delay(200); }
  setpoint = constrain(setpoint, 18, 35);
  
  float temp = dht.readTemperature();
  float hum = dht.readHumidity();
  
  if (temp >= setpoint + HYST && !fanOn) {
    digitalWrite(RELAY_PIN, HIGH); fanOn = true;
  } else if (temp = 40) tone(BUZZER, 2000, 500); // High temp alarm
  
  lcd.setCursor(0, 0);
  lcd.print("T:"); lcd.print(temp,1); lcd.print("C ");
  lcd.print("H:"); lcd.print(hum,0); lcd.print("%");
  lcd.setCursor(0, 1);
  lcd.print("Set:"); lcd.print(setpoint,1);
  lcd.print(fanOn ? " FAN ON " : " FAN OFF");
  delay(2000);
}

Multi-Zone Control

For multi-room control, add more DHT22 sensors and relay channels. Each zone gets its own set point. Use an Arduino Mega (more pins) or ESP32 with I2C expander for 4+ zones.

Adding WiFi with ESP32

Upgrade to an ESP32 to add WiFi control, smartphone app (via Blynk or web server), temperature logging to InfluxDB, and Telegram alerts. The core control logic remains identical — only the communication layer changes.

Recommended Components

Room Controller Components

Arduino Uno R3 Development Board
₹193
Buy Now
ESP32 Development Board 38 Pin
₹329
Buy Now
DHT22 Temperature & Humidity Sensor Module
₹91
Buy Now
1 Channel 5V Relay Module
₹84
Buy Now
DS18B20 Temperature Sensor Module
₹53
Buy Now

Extending the Project

  • Add a real-time clock (DS3231) for scheduled temperature profiles (cooler at night, warmer during day)
  • Add an SD card for data logging — analyse temperature patterns over weeks
  • Integrate with home automation (MQTT to Home Assistant)
  • Add occupancy detection (PIR sensor) — turn off cooling when room is empty

Frequently Asked Questions

Can this control my AC?

For split ACs, use an IR LED with IRremoteESP8266 library to send IR commands — no relay needed. For window ACs or coolers, use a relay to switch the mains power.

What is the cost of this project?

Under ₹500 for the basic version (Arduino + DHT22 + relay + LCD). Under ₹1,000 with ESP32 for WiFi control. Significantly cheaper than commercial smart thermostats.

How accurate is the temperature reading?

DHT22 provides ±0.5°C accuracy. For most room temperature control applications, this is more than sufficient. Mount the sensor away from heat sources and AC vents.

Can I use this with a desert cooler?

Yes. Connect the relay to the cooler’s pump and fan circuit. When temperature rises above the set point, the cooler turns on. This works perfectly for Indian desert coolers.

Is it safe to switch mains with this circuit?

Yes, when properly built: use rated relay modules, mains-rated wire, fused connections, and an insulated enclosure. Never leave exposed mains connections. Consider SSR for heavy loads.

Shop Cooling & Thermal Components at Zbotic

India’s trusted store for electronics components. Fast shipping, genuine products, and expert support.

Browse All Components

Tags: cooling, electronics basics
Share Post
  • Facebook
  • Linkedin
  • Whatsapp
HVAC Thermostat: Smart Control...
blog hvac thermostat smart controller with esp32 614921
blog thermoelectric harvester power from waste heat 614925
Thermoelectric Harvester: Powe...

Related posts

Svg%3E
Read more

Coffee Roaster: Temperature Profile Controller Build

April 1, 2026 0
Table of Contents Why Build a Coffee Roaster? Roasting Temperature Profiles Components for the Build Thermocouple Placement PID Profile Controller... Continue reading
Svg%3E
Read more

Sous Vide Cooker: Precision Temperature Water Bath

April 1, 2026 0
Table of Contents What Is Sous Vide Cooking? Precision Temperature Requirements Components for the Build PID Temperature Controller Water Circulation... Continue reading
Svg%3E
Read more

Kiln Controller: High-Temperature Pottery Automation

April 1, 2026 0
Table of Contents What Is a Kiln Controller? Temperature Requirements for Ceramics Components for High-Temperature Control K-Type Thermocouple and MAX6675... Continue reading
Svg%3E
Read more

Heat Gun Controller: Temperature and Airflow Regulation

April 1, 2026 0
Table of Contents What Is a Heat Gun Controller? Temperature and Airflow Regulation Components for the Build PID Temperature Control... Continue reading
Svg%3E
Read more

Soldering Iron Station: PID Temperature Controller Build

April 1, 2026 0
Table of Contents Why Build a Soldering Station? PID Temperature Control for Soldering Components Required Thermocouple Sensing at the Tip... Continue reading

Add comment Cancel reply

Your email address will not be published. Required fields are marked

Facebook Twitter Instagram Pinterest Linkedin Youtube

Get the latest deals and more.

Download on Google Play Download on the App Store

Call us: 020 69134444 / 1800 209 0998

Monday - Saturday 09:30 AM - 06:00 PM
For Technical Supports Email: [email protected]
For Sales / Enquiries Email: [email protected]

  • My Account

    • Cart

    • Wishlist

    • Checkout

    • My Orders

    • Track Order

    • My Account

  • Information

    • FAQs

    • Blogs

    • Career

    • About Us

    • Contact Us

    • Payment Options

  • Policies

    • Privacy Policy

    • Terms & Conditions

    • GST Input Tax Credit

    • Shipping Return Policy

    • E-Waste Collection Points

    • Our Sitemap

© Zbotic.in is registered trademark of Moxie Supply Pvt Ltd – All Rights Reserved
Login
Use Phone Number
Use Email Address
Not a member yet? Register Now
Reset Password
Use Phone Number
Use Email Address
Register
Already a member? Login Now