กลับไปหน้ารวมไฟล์
the-arduino-nano-ajustable-thermostatic-relay-project-bd498e-en.md

The story behind this project started when I needed to figure out a way to stop my water pipes from freezing at my cottage in the autumn months prior to winterizing.

I found a 12 volts pipe heating cable, but needed a way to control it. After doing a little bit of research a came across this online course on how to build a fully automatic and adjustable thermostatic relay, so I gave it a try.

The course was quite simple to follow, as they supply all the code and made it easy to follow step-by-step instructions. The unit can also display a warning message which will scroll on your LED display when a certain predefined condition occurs.

Here is a diagram of the completed and functional project on the breadboard prior to assembling the portable version:

Precision HVAC Control: Programmable Thermostatic Relay

Cheaper commercial space heaters use analog bimetallic strips that bend under heat to click off, resulting in wildly erratic temperature swings spanning up to 5°C! The Ajustable Thermostatic Relay project fundamentally re-engineers thermal containment by utilizing true digital sensing. The Arduino Nano constantly interrogates a high-precision digital environmental sensor and runs custom Hysteresis mathematics to command a physical electromagnetic Contact Relay, maintaining the exact atmospheric target degree with surgical stability!

Implementing The Critical "Hysteresis" Envelope!

If you write simple code like if (temp < 25) { Relay_ON(); } else { Relay_OFF(); } you will violently execute your Relay!

  • The temperature will waver at 24.99 and 25.01 rapidly, causing the heavy 240V Relay to click ON and OFF 10 times a second (Short Cycling). This immediately melts the relay contacts and destroys the connected Heating Compressor!
  • Hysteresis enforces a mandatory massive "Dead Zone" gap!
float currentTemp = dht.readTemperature();

// The heater turns ON only when it drops far below 23°C
if (currentTemp <= 23.0) {
  digitalWrite(RELAY_PIN, HIGH); // 240V HEATER ENGAGED!
  heaterState = true;
}

// But it refuses to turn OFF until the room reaches all the way up to 26°C!
if (currentTemp >= 26.0) {
  digitalWrite(RELAY_PIN, LOW); // HEATER DISENGAGED!
  heaterState = false;
}
// Between 23 and 26, the Arduino executes NO commands! The state is locked!

The High-Voltage AC Relay Interface

The Arduino operates entirely inside a tiny 5V logic bubble.

  • To violently control a massive 1500-Watt Space Heater, you must explicitly use an Opto-Isolated 5V Relay Board.
  • The Arduino sends 5V into an LED inside the Relay Board (Optocoupler), which shines light onto a phototransistor to active the magnetic coil.
  • This physical light-gap completely isolates the fragile Arduino silicon from the terrifying 240-Volt grid power!

Climatic Hardware Infrastructure

  • Arduino Nano (Its tiny form factor is incredibly optimal for housing inside small 3D-printed thermostat boxes on the wall).
  • DHT11 / DHT22 or DS18B20 Sensor Matrix (DHT22 is vastly superior for absolute decimal precision over the DHT11!).
  • 16x2 I2C LCD Screen (Absolutely critical to visually verify the target Setpoint against current Ambient parameters).
  • Rotary Encoder or Potentiometer (To manually adjust the target threshold Setpoint Variable globally in real-time).
  • Physical 10A / 250V AC Rated Relay Module (Always verify the amperage of the heater! A 1500W heater draws ~13 Amps at 110V; a standard 10A relay will catch fire! Ensure massive industrial load rating!).

Once I completed the portable version of the project, I tested it at my cottage and I've never had a problem since.

I’ve tried to include as much info on the project as I could without offending the authors of the course, but if anyone wants to take a deeper dive, I highly recommend going to the following link for more details on doing this project:

https://aiotconsulting.com/services/#iot

Here is a video from the project showing the finished portable version of the project with an external 5v power supply:

ข้อมูล Frontmatter ดั้งเดิม

apps:
  - "1x Arduino IDE 2.0 (beta)"
author: "arduinoguy007"
category: "Sensors & Environment"
components:
  - "1x Panel Mount Extension Mini B USB Cable - for Nano models with Mini USB"
  - "1x Breadboard wire bundle"
  - "1x tm1637 4 digit dis play"
  - "1x Arduino Nano"
  - "1x Waterproof 1-Wire DS18B20 Digital temperature sensor"
  - "1x GX12 Male Female 12 mm 3 Pin Connectors"
  - "1x GX16 Male Female 16mm 2 Pin Connectors"
  - "1x Project Breadboard"
  - "1x 5V One Channel Relay Module"
description: "Thermal containment engineering! Completely replace fragile mechanical bimetallic thermostat strips with a robust DHT11-driven computational threshold system, enforcing brutal localized HVAC climates via 240V heavy-duty AC relays."
difficulty: "Intermediate"
documentationLinks: []
downloadableFiles: []
encryptedPayload: "U2FsdGVkX1+VqZJMd70xGsIT59NpfdyPDC3hV0cmRyZCRpAEs3KxhND5Mwl5Tnq/KxYAWi9WLXUWofB/OMyPUCKrckaTs0dDKzUaBGdKaYY="
heroImage: "https://cdn.jsdelivr.net/gh/bigboxthailand/arduino-assets@main/images/projects/the-arduino-nano-ajustable-thermostatic-relay-project-bd498e_cover.png"
lang: "en"
likes: 1
passwordHash: "0abf95d63b0f11121027f53ddabe3609dca6e1aa052da2d197357cfd9119d9dd"
price: 299
seoDescription: "Build an Arduino Nano Adjustable Thermostatic Relay project. Learn to create your own temperature monitoring and control device."
tags:
  - "Environmental Sensing"
  - "Energy Efficiency"
  - "Monitoring"
  - "Security"
  - "Tools"
  - "Weather"
  - "Home Automation"
title: "The Arduino Nano Ajustable Thermostatic Relay Project"
tools: []
videoLinks:
  - "https://youtu.be/qLMZ_JW6NgU"
views: 1465