If you are looking for information about how a thermostat works and how you can build your own DIY Arduino Thermostat, you are at the right place, keep reading or bookmark this page for later!
Before I start, I should say that I have been postponing this post for quite some time, the main reason is that you can’t write a tutorial on how to create an Arduino Thermostat, because every HVAC unit is slightly different. For that reason, I have decided to explain how I built mine hoping that some people might get some inspiration out of it.
What will You find here?
- Basic understanding of what is a thermostat and how does it work.
- Different examples of thermostat wiring diagrams.
- How to reverse engineer your own thermostat.
- How I built my DIY Arduino Thermostat.
If you are starting with Arduino you should check the Arduino for Dummies Guide, it will help you get up to speed.
Introduction to Thermostats
Before we get into details on how you can approach building a DIY Arduino Thermostat, I want to walk you through the basics of the different types of thermostats and how do they work, if this is too basic for you, skip to the building part.
Thermostat Definition
I know this is very to basic but I needed to start with something…
Speaking in general terms, a thermostat is a device that senses the temperature and takes action to elevate or decrease it until it is as close as possible to the setpoint or target temperature. Although this post will only focus on HVAC machines, there are tons of systems that require a thermostat: a water heater, an oven..etc.
In case you didn’t know (I didn’t), HVAC stands for Heating, Ventilation and Air conditioning. On this post, I will explain to you how to have basic control over your HVAC system (if you have one) using an Arduino.
Thermostat vs thermometer
You may know this but since some people asked me about it I am going to through a few words…
The main difference is that a thermometer only senses the temperature and provides information, it doesn’t take an action to affect the ambient temperature. A thermostat on the flip side, not only monitors the temperature but it is also able to regulate it using things like your central heating system.
Different Types of Thermostats
Let’s talk about the different types of thermostat from 2 points of view, the wiring and the functionality that they offer.
Wiring
There are several types of thermostats. In this section, I will talk about the most popular ones and will give you some tips on how to identify them.
Line-Voltage Thermostats
This type of thermostat is generally used for single heating systems like baseboards or radiant systems. The way they work is actually pretty simple. The thermostat is connected in series with the heating system and when the device reaches the setpoint temperature, it stops the current from flowing through the thermostat. These type of systems are generally connected to 240V so be careful if you decide to manipulate it. Not that 120V can’t get you in trouble…
Low-Voltage Thermostats
Nowadays, the low-voltage thermostat is the most common option for home installations. You will find them controlling all sorts of central heating systems that use oil, gas or electricity. This type of thermostats has several advantages over the line-voltage type:
- They are more efficient in the way they handle the flow of current.
- The operating voltage is between 24v and 50v hence reducing the exposure to higher voltages. That is the reason because you see that the cables inside of the thermostat are not as thick as for the first type.
- There are lots of options in the space of programmable thermostats.
The main difference is that the low-voltage thermostats don’t control directly the flow of the current but rather tell the central heating system what to do to do based on the ambient temperature.
If you are looking to see what type of thermostat you have installed at home check the following Blog post.
Outlet Thermostats
These are not very common but you can still see some of them around. For the sake of simplification, I will tell you that they are like a smart plug with a temperature sensor. It allows you to specify a setpoint temperature and when it is reached, it turns itself ON or OFF. Pretty simple isn’t it?
Functionality
Regardless the type of thermostat, some of them can be programmed up to a certain degree. I can mainly think of three types. I don’t sell thermostats so this classification is completely made up…
Dumb Thermostat
This is the most absolutely basic type of thermostat. You select a setpoint temperature and the thermostat will do its best to keep it within the range.
Not-So-Dumb Thermostat
In this category, you will find thermostats that are slightly more expensive but deliver significantly more functionality. They are based on the same principals as the dumb thermostat but provide you with a much more granular way to specify the temperature.
For example, if you follow a similar schedule every week in terms of what time do you wake up and what time you come back from work you can program your Not-So-Dumb Thermostat to warm up the house right before you need it and keep it off the rest of the time. This can already result in a great deal of savings for your utility bill.
Smart Thermostat
The Smart Thermostats go a step further to help you save energy at home. Some features that you may find on Smart Thermostats are:
- Ability to program the temperature with a great deal of granularity.
- Presence detection to keep the temperature in check only when somebody is at home.
- Voice control using devices like Google Home or Amazon Alexa.
- Control the settings with your smartphone when you are not home or when you are home but you are too lazy to walk to the thermostat.
What we are trying to build on this post is the foundations of a Smart Thermostat.
Thermostat Wiring Diagram for Low-Voltage
Here is the last bit of theory before we get down to business building the DIY Arduino Thermostat.
The table below gives you an idea of the color and function of the terminals according to the industry standards. The tricky part here is that the industry standards aren’t always the standard…
Color | Terminal Code | Purpose | Description |
Red | R | 24 AC Power | This is the 24V power terminal. Most of the low-voltage thermostats work with this voltage although you can find them all the way up to 50V.
It is not uncommon to find 2 red cables RH and RC. In this case, both carry 24VAC and you can use them to energize separately heat and cool. |
Black | C | 24 AC Common | This is the common ground for the 24V. |
White | W | Heat | This is the terminal to be energized for the heat |
Yellow | Y | Compressor | This is the terminal that energizes the compressor. |
Orange | O | RV On In Cool | O and B terminals interact with the reverse valve. The reverse valve controls the flow of refrigerant in the piping system, basically allowing you to provide cool or hot air. O energized calls for cool air. |
Blue | B | RV ON In Heat | Same as the terminal O but to call for heat. It is very common to see these two terminals combined into one with the legend O/B.
The industry standard is that when O/B is energized the unit provides cool air. If it is not energized it provides heat. As always, this depends on the HVAC unit. |
Green | G | Indoor Fan | The green terminal usually controls the fan to the level that your system allows it. |
No Standard Defined | Y2 | 2nd Stage Cool | Y2 basically activates a feature to boost the power of your compressor. It is only required on climates that are extremely hot. |
No Standard Defined | W2 | 2nd Stage Heat | Similar terminal to Y2 but to provide heat. |
No Standard Defined | E | Emergency Heat | This feature turns off the heat pump on an emergency and switch to electricity. |
I want to do my best to give you an understanding of what you will find when you open your thermostat so I will do two things. First, I will give two of the most common examples that you can find. Second, I will provide you with the steps that I followed to find out how mine works, I hope that helps…
Thermostat Wiring Diagram: Example 1
Color | Terminal Code | Purpose |
Red | R | 24 AC Power |
Black | C | 24 AC Common |
White | W | Heat |
Yellow | Y | Compressor |
Green | G | Indoor Fan |
- HEAT: In most cases, connecting R to W will turn ON the heat. Sometimes you also need to connect R to G. That depends on your system.
- AC: In most cases, connecting R to Y will turn ON the AC. Sometimes you also need to connect R to G. That depends on your system.
I say sometimes because this depends entirely on the manufacturer, DON’T TAKE ANYTHING FOR GRANTED.
Thermostat Wiring Example 2
Color | Terminal Code | Purpose |
Red | R | 24 AC Power |
Black | C | 24 AC Common |
Yellow | Y | Compressor |
Orange | O/B | Reverse Valve |
Green | G | Indoor Fan |
This is a slightly more complicated case.
On this schema, you have to energize Y to start blowing air, then, depending on if O/B is active or not it will blow hot or cold air. As in the prior case, sometimes you will have to energize also G.
As I said, this is what I have seen based on my experience replacing thermostats, having said that, I am not a technician so there is probably a whole world out there that I don’t know about…
To finish this section I want to walk you through the steps that I took to find out how my HVAC thermostat worked. This is what helped me to reverse engineer and replicate the same behavior using relays and an Arduino.
How Does your Thermostat Work?
1. Open your current thermostat and check how is it wired.
If you see five or more thin cables with different colors, chances are that your unit is using a low-voltage thermostat. If this is not your case, it is probably a line-voltage thermostat.
You can also see if the legend on your terminals looks alike any of the examples above.
If you remove any of the cables make sure you take a picture first, if your memory is a good as mine, you won’t remember later…
2. Search for your thermostat specs on the internet.
Check what the manufacturer says about the unit. In my case, I needed to connect R to Y to turn on the unit. If O/B is not energized it blows hot air, if it is energized it blows cold air. The terminal G is automatically turned ON when you energize terminal Y.
Trust, but verify
Even if the specs of your unit are crystal clear, which they are usually not…it is always good to verify that the understanding of the wiring is correct.
3. Verify your understanding using a multimeter
In order to verify that your understanding is correct, you can use a multimeter. Measure the voltage between the terminal C and the rest of the terminals. Set your thermostat on the different modes (AC, HEAT…) and check what terminals are energized on each function.
This will give you a pretty good idea of the terminals that you will have to connect to activate the different modes.
I am sure you know this but do not ever let R and C terminals get in touch, the outcome of this can’t be good…
How to Build your own Smart Arduino Thermostat
While I generally try to write detailed tutorials suitable for everyone, this is most definitely not one of them. I am not an HVAC expert, just a guy with a lot of curiosity that has done some research so please, if you decide to do this project, you do so at your own risk. If you don’t have at least a basic understanding of electricity an electronics I would advise you against it.
Things that you should know before you start:
- The Arduino Thermostat project is based on the MySensors framework so you should first get familiar with it. I would recommend you to follow the DIY Home Automation Sensors tutorial because it will help you get up to speed in no time.
- You should have a decent understanding of Arduino and how to program it. If you are not yet familiar with it. Check Getting Started with Arduino.
- If you haven’t played with relays before check How to control a relay with Arduino. I would add the info here but to be honest, the internet is full of tutorials about that…
Shopping List
Here is the list of components that you will need, if you have followed DIY Home Automation Sensors you should have everything except for the relay board already.
Units | Description | AlliExpress | Amazon |
1 | NRF24L01 | Link | Link |
1 | Arduino Nano | Link | Link |
1 | Jumper Cables | Link | Link |
1 | DHT22 Temperature and Humidity Sensor | Link | Link |
1 | 4-Channels – Relay Board | Link |
For this project, I am using the Arduino Nano, mostly because I don’t have size restrictions but any Arduino will do it though.
What is Relay?
A relay is an electronically operated switch…what? Long story short, a relay allows us to open and close a circuit driving a high voltage load with a low voltage signal, 5V in this case, like the one that Arduino can provide. This magnificent component provides a small microcontroller with the ability to control devices that require higher voltage, like a bulb for example.
At this point, you might already have an idea of how the relay is going to help us here. The relay will energize the different terminals connecting R to Y and O/B resulting in our HVAC turning ON the HEAT or the AC.
Arduino Thermostat: Wiring Things Up
If you followed the DIY Home Automation Sensors tutorial you will only have to connect a few extra wires to get your Arduino Thermostat up and running. The diagram that I am going to show is based on my own Arduino Thermostat, you will have to wire things up based on your own findings but I can help you do it if you contact me.
Arduino Thermostat Code
Same way as the wiring, the code will be slightly different for your Arduino thermostat, you will need to adapt it to your own needs. I have added comments to the code to try to make it as simple as possible. Pay special attention to the function hvacCommand() and to the definition of the pins for the relays, you should be able to use the rest of the code as it is.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 |
#include <DHT.h> #define MY_DEBUG #define MY_RADIO_NRF24 #define MY_NODE_ID 2 //Specify the ID of every sensor. This will help you identifying the MQTT messages. #define CHILD_ID_TEMP 0 //ID of the temperature sensor #define CHILD_ID_HUM 1 //ID of the Humidity Sensor #define CHILD_ID_HVAC_COOL 2 //ID of the sensor that indicates when the AC is ON. #define CHILD_ID_HVAC_HEAT 3 //ID of the sensor that indicates when HEAT is ON. //The Pin where the DHT22 sensor is connected. #define DHT_DATA_PIN 3 //Constant to identify the DHT sensor type. In my case is DHT22 #define DHTTYPE DHT22 //Allows you to define an offset for the temperature. It is useful if the sensor is inside an enclosure for example. #define SENSOR_TEMP_OFFSET 0 // The relays are controlled by the pin 7 and 8. You can call then in a way that is meaningful to you. #define RELAY_HEAT 7 #define RELAY_REVERSE_VALVE 8 #include <MySensors.h> /**************************************************/ /****************** CONSTANTS *********************/ /**************************************************/ //Constant to specify how often will the thermostat evaluate the temperature and take an action. Turn on the AC for example. static const uint64_t UPDATE_INTERVAL = 10000; static const uint64_t FORCE_UPDATE_N_READS = 3; static const uint8_t = 10; /**************************************************/ /****************** VARIABLES *********************/ /**************************************************/ //Variables to keep track of the temperature and the humidity. float lastTemp; float lastHum; float temperature = 24.0; float humidity; float targetTemp = 24.0; int statusHVAC = 0; uint8_t nNoUpdatesTemp; uint8_t nNoUpdatesHum; /**************************************************/ /****************** MESSAGES **********************/ /**************************************************/ //Define your mysensor messages to communicate with OpenHab MyMessage msgHum(CHILD_ID_HUM, V_HUM); MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP); MyMessage msgCool(CHILD_ID_HVAC_COOL, V_CUSTOM); MyMessage msgHeat(CHILD_ID_HVAC_HEAT, V_CUSTOM); DHT dht(DHT_DATA_PIN, DHTTYPE); void presentation() { present(CHILD_ID_HUM, S_HUM); present(CHILD_ID_TEMP, S_TEMP); present(CHILD_ID_HVAC_COOL, S_HVAC); present(CHILD_ID_HVAC_HEAT, S_HVAC); } void setup() { //Before I do anything, I want to make sure that all the relays are opened (nothing is connected) //Setup all the Arduino Pins pinMode(RELAY_HEAT, OUTPUT); pinMode(RELAY_REVERSE_VALVE, OUTPUT); digitalWrite(RELAY_HEAT,HIGH); digitalWrite(RELAY_REVERSE_VALVE,HIGH); delay(2000); //Wait 2 seconds before starting sequence dht.begin(); //Load the latest target temperature and status from the eprom, just in case my arduino loses power. targetTemp = loadState(0); statusHVAC = loadState(1); } void loop() { //Retrieve teh value of the temperature and the hummidiy from the DHT22 sendTemperatureHumiditySensor(); //Take an action opening or closing the relays if needed. HVACycle(); wait(UPDATE_INTERVAL); } /**************************************************/ /**************** AUX. FUNCTIONS ******************/ /**************************************************/ //This is the main function, it turn ON or OFF AC or HEAT when the current temperature falls out of range. void HVACycle() { if(statusHVAC == 0) { hvacCommand(0,1); hvacCommand(0,2); printStatus(); } if(statusHVAC == 1) { if(temperature > targetTemp) { if(abs(temperature - targetTemp) >= 1) { hvacCommand(0,1); printStatus(); } else printStatus(); } else { if(abs(temperature - targetTemp) >= 1) { hvacCommand(1,1); printStatus(); } else printStatus(); } } if(statusHVAC == 2) { if(temperature > targetTemp) { if(abs(temperature - targetTemp) >= 1) { hvacCommand(1,2); printStatus(); } else printStatus(); } else { if(abs(temperature - targetTemp) >= 1) { hvacCommand(0,2); printStatus(); } else printStatus(); } } } void printStatus() { Serial.print("\nTemperature: "); Serial.print(temperature); Serial.print("\nTarget: "); Serial.print(targetTemp); Serial.print("\nStatus: "); Serial.print(abs(temperature - targetTemp)); Serial.print("\nMode: "); Serial.print(statusHVAC); } /************ hvacCommand ****************/ /* command: 0 -> ON 1 -> OFF * hvacStatus: 1-> HEAT 2-> AC */ /*****************************************/ //This function is very important. It basically describes how to turn ON the AC or the HEAT opening or closing the relays. //Review it carefully and adapt it to your needs. void hvacCommand(int command,int hvacStatus) { if(command == 0) { if(digitalRead(RELAY_REVERSE_VALVE) != HIGH) digitalWrite(RELAY_REVERSE_VALVE, HIGH); if(digitalRead(RELAY_HEAT) != HIGH) digitalWrite(RELAY_HEAT, HIGH); send(msgHeat.set(0)); send(msgCool.set(0)); } else if(command == 1) { if(hvacStatus==1) { //When I close the relay between terminals R and Y my unit turns ON the HEAT if(digitalRead(RELAY_HEAT) != LOW) digitalWrite(RELAY_HEAT, LOW); send(msgHeat.set(1)); } if(hvacStatus==2) { //When I close the relays between terminals R and Y and R and Reverse Valve (O/B) my unit turn ON the AC. Please adapt it to your own needs. if(digitalRead(RELAY_REVERSE_VALVE) != LOW) digitalWrite(RELAY_REVERSE_VALVE, LOW); if(digitalRead(RELAY_HEAT) != LOW) digitalWrite(RELAY_HEAT, LOW); send(msgCool.set(1)); } } } /* send(msgHeat.set(1)) and send(msgCool.set(1)) are only for accountability purposes. * I want to send a message to my Home Automation Controller when the unit turns ON a function. * It helps me keeping track of the usage. */ /* This functions reads the temperature from the DHT22 and send it to the gateway. * You can probabbly use it as it is. */ void sendTemperatureHumiditySensor() { temperature = dht.readTemperature(); humidity = dht.readHumidity(); if (isnan(temperature)) { Serial.println("Failed reading temperature from DHT!"); } else if (temperature != lastTemp || nNoUpdatesTemp == FORCE_UPDATE_N_READS) { lastTemp = temperature; nNoUpdatesTemp = 0; temperature += SENSOR_TEMP_OFFSET; send(msgTemp.set(temperature, 1)); #ifdef MY_DEBUG Serial.print("T: "); Serial.println(temperature); #endif } else { nNoUpdatesTemp++; } if (isnan(humidity)) { Serial.println("Failed reading humidity from DHT"); } else if (humidity != lastHum || nNoUpdatesHum == FORCE_UPDATE_N_READS) { lastHum = humidity; nNoUpdatesHum = 0; send(msgHum.set(humidity, 1)); #ifdef MY_DEBUG Serial.print("H: "); Serial.println(humidity); #endif } else { nNoUpdatesHum++; } } /* This function listens to the gateway to receive the commands * It captures the target temperature and the mode of the Arduino thermostat: AC or HEAT. */ void receive(const MyMessage &message) { Serial.print(("New message: ")); Serial.println(message.type); Serial.println(message.getInt()); if (message.type == V_HVAC_SETPOINT_COOL) { Serial.print("Setting Temperature To: "); Serial.println(message.getInt()); targetTemp = message.getFloat(); saveState(0, targetTemp); //Save the targetTemperature on the EPROM so you can retrieve if the arduino loses power. } if (message.type == V_HVAC_FLOW_STATE) { Serial.print(F("Setting Mode To: ")); Serial.println(message.getInt()); statusHVAC = message.getInt(); saveState(1, statusHVAC); } } |
Add the Items to the Home Automation Controller
Here you have the items of items that you will need to add to your items file in case you are using OpenHab.
1 2 3 4 5 6 |
Number thermostat_livingroom_temp "Target Temperature [%.1f]" {mqtt=">[mosquitto:mygateway1-in/1/1/1/0/44:state:*:${state}]"} Number thermostat_livingroom_mode "Mode [%.1f]" {mqtt=">[mosquitto:mygateway1-in/1/1/1/0/21:command:*:${command}]"} Number mqtt_livingroom_temperature "Temperature [%.1f]" {mqtt="<[mosquitto:mygateway1-out/1/0/1/0/0:state:default]"} Number mqtt_livingroom_humidity "Humidity [%.1f]" {mqtt="<[mosquitto:mygateway1-out/1/1/1/0/1:state:default]"} Switch thermostat_livingroom_hvacCool "HVAC LIVINGROOM COOL" {mqtt="<[mosquitto:mygateway1-out/1/2/1/0/48:state:ON:1],<[mosquitto:mygateway1-out/1/2/1/0/48:state:OFF:0]"} Switch thermostat_livingroom_hvacHeat "HVAC LIVINGROOM HEAT" {mqtt="<[mosquitto:mygateway1-out/1/3/1/0/48:state:ON:1],<[mosquitto:mygateway1-out/1/3/1/0/48:state:OFF:0]"} |
Please, let me know in the comments if there is something that isn’t clear or you would like me to add.
Future Improvements
The Arduino thermostat has lots of room for improvement, here are a few things that I can think of…
- Add a motion sensor to turn ON and OFF the unit based on presence.
- Add an AUTO mode.
- Include external sensors to capture the temperature of the room at different locations.
- Include an OLED screen to monitor the temperature.
- Anything else? tell me about it in the comments.
BK Hobby has great content related to temperature sensors using NodeMCU, if you aren’t subscribed to the channel you are really missing out! I am going to leave you here a video about his temperature sensors in case you want to check it out.
Conclusion
As I said before, this wasn’t a step by step tutorial but rather a walk through. I did a lot of research when I started my Arduino Thermostat Project and I thought it could be useful for some people trying to do the same.
I hope you learned something today and got an inspiration for your next project.
If you like or hate this post please, tell me about it by email or in the comments, also if you have questions of course!
wow, your DIY its incredible. Firts I am sorry of my english, I am from Spain and I dont speak it well. I want to install a duct air conditioner in my new house, and I want to install motorized grids, and controls them with arduino. But I need to replace the control unit of the air conditioned system with arduino. What kind or model of air conditioned do you recommend me to do this DIY?
Thank you very much.
Que tal Julio?
Your English is just fine and I am Spanish as well by the way :).
Where are you from? If you struggle with the language no worries, just email me and I can answer you in Spanish.
I would not chose a unit based on that. I assume you already have an AC unit which is hooked up to a Thermostat correct?
jajaja, all right…
Gracias David, jaja, me parto. Soy de Valencia ciudad.
Te cuento, me encanta arduino y sus posibilidades, de hecho controlo la calefacción (caldera con radiadores) desde cualquier parte del mundo, puedo ver su estado, temperatura de consigna, temperatura del salón, etc (todo a través de thingspeak). Con ello quiero decirte que tengo algunos conocimientos tanto de electrónica como de programación, aunque soy mas un roba código.
Bueno, la cuestión es que me vot a hacer una reforma integral en una vivienda y quiero meter una bomba de calor y A/A por conductos, pero claro, lo que me gustaría es poder domotizarlo y meter rejillas motorizadas en todas las estancias. Pero claro, me enfrento al problema de la “unidad central de control por cable” del equipo con su respectivo sensor de temperatura, que es en definitiva el que hará que la máquina se mueva o se pare.
Lo que quiero es, tal y como has hecho tú, saltarme la unidad central de control y sustituirla con un arduino, proporcinarle wifi para su control externno, y por supuesto con sus rejillas motorizadas.
El problema, como te he dicho es el control del equipo en sí, porque claro, si tengo la habitación en la que se encuentra el sensor de temperatura principal a la temperatura de consigna, el equipo se apagará, estén como estén las temperaturas de las otras habitaciones.
Así que lo que pretendo es que cada habitación esté a la temperatura deseada, en plan Air Zone, pero DIY.
Así que lo que haré será domotizar todas las rejillas mecanizadas, controladas con arduino con un sensor de temperatura en cada habitación, y por supuesto con tu pedazo de proyecto, que es lo que ando buscando. Poder activar el equipo para enfriar o calentar cualquier habitación.
No sé si me habré explicado bien.
Para ello lo que necesito saber es el tipo de máquina que debo de comprar, porque sí sé que hay máquinas que en ON/OFF funcionan con 220, así que con un relé me sobraría, pero lo que pretendo es lo mismo que has hecho tú, algo mas “smart”.
Así que como aun no he comprado ningún equipo, pues sería genial si me pudieses aconsejar sobre qué equipo pillarme para poder automatizarlo a “full”, sustituyendo la unidad central por un arduino….
Espero no haberte confundido, más que explicado,jajajajajaj
Gracias por todo y un saludo.
P.D.: ¿De donde eres?
Hi Julio,
I will answer you by email so we don’t mix stuff up on the comments 🙂
What are you communicating with? Also, I see no reference in your code to the “recieve” function. Is there something missing?
Hi Jim,
This tutorial is based upon this other one http://smarthomeblog.net/diy-home-automation-sensors/
It uses a library called MySensors which is where you will be able to find the function Receive.
The thermostat communicates with a gateway (Raspberry Pi) which then send messages to an MQTT broker.
Hi,
Thanks a loooot for this post, It’s very helopful.
My project is to control a thermostat with a microcontroller, can you suggest me a thermostat which is easy to understand how to control ?or there re another way to show that we control temperature without using a thermostat?(I’m new in electronics)
Thanks,
Hi,
They all work very similarly. If you already have just check the user manual. In the installation guide it should tell you the color coding for your thermostat.
This tutorial is a great launching point for the project I have in mind. Thank you for putting it together.
I have a few things you might be able to help me with. The first is, how do I even get the leads on my multimeter into place to test the voltages while the existing unit is hooked up? I want to test the wires in my home because the wire colors don’t match the letter labels. (also there is no ground??)
My other question is how are you powering your Arduino? I was thinking it would be nice to hook into the voltage coming in on Red, but obviously would need to transform to an appropriate DC voltage first, and I don’t know how easy that would be.
Hey Esteban!
There is a discord community that I am putting together in case you want to chat there.
To probe with the multimeter you can remove the cover of the thermostat. There is there are normally screws in contact with the cables to keep the cable in place. You should be able to probe there. For this purpose, you don’t really need ground just need to open and close the circut with the power and the heat/compressor.
I am just using a usb cable, it is not very elegant but building the rectifier was a bit painful. I would be interested if you try though!
Join the discord and we can catch up there!
Hello David,
Great job, I am new with arduino, I want to create this. you might be able to help me with it because when I compile the code I got this error.
Thermostat1:36:22: error: expected unqualified-id before ‘=’ token
static const uint8_t = 10;
C:\Users\Admin\Thermostat1\Thermostat1.ino: In function ‘void sendTemperatureHumiditySensor()’:
Thermostat1:242:61: error: ‘FORCE_UPDATE_N_READS’ was not declared in this scope
} else if (temperature != lastTemp || nNoUpdatesTemp == FORCE_UPDATE_N_READS)
^
Thermostat1:261:56: error: ‘FORCE_UPDATE_N_READS’ was not declared in this scope
} else if (humidity != lastHum || nNoUpdatesHum == FORCE_UPDATE_N_READS)
Thanks in advance
Hi Johana,
Sorry for the late response, there is an issue in the code that I just saw.
missing declaration of FORCE_UPDATE_N_READS. I have just added to the sketch, thank you for pointing it out.
static const uint64_t FORCE_UPDATE_N_READS = 3;
Hi David, please could you explain a bit more about this specific openHab binding how it’s States are building up
Great info here!
I was looking for ways to add functionality to my HVAC, and came across this post. I am not familiar with your other projects, so I will have to do some reading and “playing” before I can start on this tutorial.
There were a couple of ideas for HVAC control that I’ve been wanting, which aren’t addressed in this tutorial, so I wanted to throw them out there. First is integration with the fire alarms to disable the HVAC in case of smoke/CO2 alarm.
Second, adding a “comfort mode” to run the fan when different rooms have different temperatures, without running heat pump. The idea is to “ballance” the temperature in the home, without having to run the A/C in the process.
Other ideas are to have a wider deadband when unoccupied or at night, and allowing more “overshoot” of the setpoint to allow fewer starts and longer runtimes for efficiency.
(I have a background in controls. Much of what I do in “the real world” revolves around efficiency.)
Thanks for the information.
Hi Peter,
There is no binding perse, the logic is all maintained in the arduino code. Openhab just sends and receive information.
Are you stuck somewhere?
Those are actually good ideas. The posts was only to cover the basics but when you have the control implemented you can make it smarter over time. Have you tried any of them?
Nice post. I came across it while looking for thermostat wire descriptions. I spent last night chasing with my meter and your article confirm my finding that my thermostat never sends a signal to W2 (only has the O/B signal to start the heat pump or cool). Thank you description of the Arduino HVAC, I would love to do it but I just keep too many projects in the air right now.
Thanks!!!
David, email me at my vette gmail address (this is my spam bucket, so be sure to mention ARDUINO THERMOSTAT) in the title line. Great job! I think you might be interested in a modification I have wanted to do for many years. It is a feature I don’t think even the NEST thermostats have.
Emailed!