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

Temperature Controlled Relay: AC Fan and Heater Switch

Temperature Controlled Relay: AC Fan and Heater Switch

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

  1. What Is a Temperature Controlled Relay?
  2. Components and Circuit Design
  3. Wiring for AC Fan Control
  4. Wiring for AC Heater Control
  5. Arduino Code with Hysteresis
  6. Safety Considerations for Mains Switching
  7. Recommended Components
  8. Common Applications

A temperature controlled relay automatically switches AC-powered fans, heaters, or other loads based on temperature readings. This is the foundation for thermostat projects, incubators, fermentation chambers, and HVAC control. This guide covers building a safe, reliable temperature-controlled relay switch for both cooling and heating applications.

What Is a Temperature Controlled Relay?

A temperature controlled relay combines a temperature sensor (DS18B20 or DHT22), a microcontroller (Arduino), and a relay module to switch AC mains loads. When temperature exceeds a threshold, the relay activates a fan for cooling. When temperature drops below another threshold, the relay activates a heater. With proper hysteresis, this provides stable, automatic temperature control.

Components and Circuit Design

  • Arduino Uno or Nano
  • DS18B20 temperature sensor
  • Relay module (5V, rated for your AC load)
  • AC fan or heater (the load being controlled)
  • 4.7kΩ pull-up resistor (for DS18B20)
  • Enclosure rated for mains voltage
  • Mains-rated wire (1.5mm² minimum for loads up to 10A)

For loads above 10A: Use an SSR (Solid State Relay) instead of a mechanical relay. SSRs handle higher currents, switch faster, and have no contact wear.

Relay Control Components

Arduino Uno R3 Development Board
₹193
Buy Now
DS18B20 Temperature Sensor Module
₹53
Buy Now
1 Channel 12V 30A Relay Module
₹311
Buy Now
5V 1 Channel SSR Solid State Relay Module
₹108
Buy Now
SSR-25DA Solid State Relay 24-380V
₹293
Buy Now

Wiring for AC Fan Control

AC fan cooling circuit:

  • DS18B20 → Arduino pin 2 (with 4.7kΩ pull-up)
  • Arduino pin 7 → Relay module IN
  • AC mains Live → Relay COM (Common)
  • Relay NO (Normally Open) → AC fan Live input
  • AC mains Neutral → AC fan Neutral

When temperature rises above threshold, Arduino sets pin 7 HIGH, relay closes, fan runs. When temperature drops below threshold minus hysteresis, relay opens, fan stops.

IMPORTANT: The relay only switches the Live wire. Neutral connects directly to the load. This is a safety requirement — never switch Neutral while Live remains connected.

Wiring for AC Heater Control

AC heater control circuit: Same wiring as fan, but the logic is reversed — relay closes when temperature drops below the set point, and opens when temperature rises above the set point.

For a combined heating/cooling system (like an incubator), use two relays: one for the heater (activated below set point – hysteresis) and one for the fan/cooler (activated above set point + hysteresis). The dead zone between heater-off and cooler-on prevents both running simultaneously.

Arduino Code with Hysteresis

#include <OneWire.h>
#include <DallasTemperature.h>

#define SENSOR_PIN 2
#define FAN_RELAY 7    // Cooling relay
#define HEATER_RELAY 8 // Heating relay
#define SETPOINT 37.5  // Target temperature
#define HYST 1.0       // Hysteresis (±1°C)

OneWire oneWire(SENSOR_PIN);
DallasTemperature sensors(&oneWire);

void setup() {
  Serial.begin(9600);
  sensors.begin();
  pinMode(FAN_RELAY, OUTPUT);
  pinMode(HEATER_RELAY, OUTPUT);
  digitalWrite(FAN_RELAY, LOW);
  digitalWrite(HEATER_RELAY, LOW);
}

void loop() {
  sensors.requestTemperatures();
  float temp = sensors.getTempCByIndex(0);
  
  // Cooling: ON above setpoint + hysteresis
  if (temp >= SETPOINT + HYST) {
    digitalWrite(FAN_RELAY, HIGH);  // Fan ON
  } else if (temp <= SETPOINT) {
    digitalWrite(FAN_RELAY, LOW);   // Fan OFF
  }
  
  // Heating: ON below setpoint - hysteresis
  if (temp = SETPOINT) {
    digitalWrite(HEATER_RELAY, LOW);  // Heater OFF
  }
  
  Serial.print("Temp: "); Serial.print(temp);
  Serial.print(" Fan: "); Serial.print(digitalRead(FAN_RELAY));
  Serial.print(" Heater: "); Serial.println(digitalRead(HEATER_RELAY));
  delay(2000);
}

Safety Considerations for Mains Switching

WARNING: This circuit switches AC mains voltage (230V in India). Improper wiring can cause electrocution or fire.

  • Use relay modules rated for at least 1.5x your load current at 250V AC
  • Use mains-rated wire (1.5mm² minimum, ISI marked)
  • Enclose ALL mains connections in an insulated box — no exposed terminals
  • Use a proper mains plug with earth connection
  • Add a fuse rated for your load current in the Live line
  • Test with a multimeter before connecting the load
  • Keep low-voltage (Arduino) and high-voltage (mains) wiring physically separated
  • Consider using an SSR for mains switching — no mechanical contacts to arc and weld

Recommended Components

Complete Temperature Control Kit

Arduino Uno R3 Development Board
₹193
Buy Now
DS18B20 Temperature Sensor Module
₹53
Buy Now
1 Channel 12V 30A Relay Module
₹311
Buy Now
SSR-25DA Solid State Relay 24-380V
₹293
Buy Now
DHT22 Temperature & Humidity Sensor Module
₹91
Buy Now

Common Applications

  • Egg incubator: Maintain 37.5°C with heater and fan relays
  • Mushroom growing chamber: Maintain 20-25°C with humidifier and exhaust fan
  • Fermenter: Maintain lager temp 10-14°C or ale temp 18-22°C
  • Server room backup: Emergency fan activation if main AC fails
  • Greenhouse: Heating at night, ventilation during day
  • Aquarium: Heater control for tropical fish (25-28°C)

Frequently Asked Questions

Can I switch AC mains with an Arduino relay?

Yes, using a relay module rated for 250V AC. The Arduino controls the relay coil at 5V; the relay contacts switch the AC mains. Always follow mains safety practices.

What relay should I use for a heater?

For heaters up to 2kW (8.7A at 230V), a 10A relay module works. For larger heaters, use a 25A or 40A SSR (Solid State Relay) with a heat sink.

What is the difference between SSR and mechanical relay?

SSRs have no moving parts — they switch using semiconductors. Faster switching, no contact wear, no arcing. Mechanical relays are cheaper and simpler. Use SSRs for frequent switching or high-current loads.

How much hysteresis should I use?

1-2°C for precise applications (incubators, fermenters). 3-5°C for comfort applications (room thermostats, server rooms). Less hysteresis = tighter control but more relay cycling.

Where can I buy relay modules in India?

Zbotic.in stocks 5V and 12V relay modules from ₹84, and SSR solid state relays from ₹108. Both work with Arduino and ESP32 for temperature-controlled switching.

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
Solar Charge Profile: Absorb, ...
blog solar charge profile absorb float and equalize 614912
blog wind charge controller dump load and braking circuit 614916
Wind Charge Controller: Dump L...

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