A Simple Thermostat
by Northstrix in Circuits > Microcontrollers
1250 Views, 7 Favorites, 0 Comments
A Simple Thermostat
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
Flash Arduino
You can find code here https://github.com/Northstrix/A_simple_thermostat
Connect the Display
Connect the DS18B20
Connect the Potentiometer
Connect the Relay Module
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
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
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
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.