A Simple Thermostat

by Northstrix in Circuits > Microcontrollers

1244 Views, 7 Favorites, 0 Comments

A Simple Thermostat

IMG_20210213_115353.jpg

In this project, I'm going to show you how to build a simple thermostat.

Supplies

1) Arduino x1
2) K0-4B display x1
3) Relay module x1
4) LM317 x1
5) DS18B20 x1
6) 20K potentiometer x1
7) 33K resistors x2
8) 20K resistors x2
9) 10K resistor x1
10) 50K resistor x1
11) 4.7K resistor x1
12) Wires

How Does a Thermostat Work

DS18B20 measures the ambient temperature and sends the readings to Arduino. Arduino sends the value of the ambient temperature to the display, and at the same time compares this value with the desired temperature.

If the ambient temperature = desired temperature then do nothing;
If the ambient temperature at least one degree lower than the desired temperature, then turn the heater on;
If the ambient temperature at least one degree higher than the desired temperature, then turn the heater off.

Gather the Components

IMG_20210213_131317_hdr.jpg

Flash Arduino

IMG_20210214_110346.jpg

Connect the Display

FQLD7RZKKFFV30O.png

Connect the DS18B20

ds.png

Connect the Potentiometer

r.png

Connect the Relay Module

IMG_20210206_170449.jpg

Relay module with one relay will be enough for this project.

Connect relay module's VCC to Arduino's 5V pin
Connect relay module's IN to Arduino's 3 pin
Connect relay module's GND to Arduino's GND

Test the Device

IMG_20210213_114845.jpg
IMG_20210213_114849.jpg
IMG_20210213_114855.jpg

Finally. Let's test it!

The ambient temperature will be displayed on the left, the desired temperature will be displayed on the right.

I've set the desired temperature to 75°F. In the first photo, you can see that the ambient temperature is 76°F. So, the heater will be turned off. In the second photo, you can see the temperature falling to 75°F, it's equal to the desired temperature. Hence, the state of the heater won't change. In the third photo, the temperature falls to 74°F, which is one degree lower than the desired temperature. Hence, the heater will turn on until the ambient temperature won't reach 76°F.

How to Display Temperature in °C

Untitled.png

To display the temperature in °C, simply modify these two strings. But since this display only supports the letters "F" and "P". It won't be able to display the letter "C".

Output in °C *optional

IMG_20210213_125759.jpg
IMG_20210213_125905.jpg

Connect the Heater

High voltage is dangerous. Improper wiring on that step may lead to an injury, including potentially fatal injuries or even death. Proceed at your own risk.