Building a HVAC thermostat as my first Arduino project

So the Arduino, along with other brands such as the Pi, have always interested me but I could never justify buying one as I could never come up with something to build around it, but just recently that has changed as our thermostat for the house has gone out and I quickly learned they are extremely simple devices. More or less just three 25VAC relays, one for fan, one for heat, one for cool, along with a temperature sensor. So I bought a Arduino Nano with the ATmega328 as this seems to be between middle and top end as far as Arduino boards go along with being very tiny while still having a USB port to make connecting to it easy. Both of which were important to me.
The thermostat ended up getting replaced for free thanks to Home Depot being nice and honoring a 90day warranty that ended over a year ago but I still want to try this for some fun. So I guess I'll just list my questions and let you guys have fun with it...

  1. What are good and very small relays that can handle 25VAC at up to 1A and is there such a relay that has three positions? As Heat and Cool will never be on at the same time. This way I'd have one relay for the overall mode (Off/Heat/Cool) and one relay for the fan (Auto/On). There was only one relay on the old thermostat I had but I returned it before thinking to get its part number, all I remember was it having 8pins and looked like only 5 were used.
  2. What would be a good display for text only? I'd love to go all out and have an e-ink or OLED screen that has touch but I hear displays get complicated real fast and I'm pretty sure that's above my capabilities for now, plus I'm not sure if this Arduino could handle even a small low resolution color screen with touch, but I haven't looked into that. So I'd like it to be nice looking, but at the same time if there's a display for beginners I probably will want that more.
  3. Can I just grab any temperature sensor from RadioShack for 99cents or is there something you guys recommend?
  4. As it can not take the 25VAC from the HVAC system, this completes the circuit and tells it to turn heat, cool, and/or fan on, I'd like to power this by battery. Thus I'm interested in an e-ink or OLED display and if there are such relays that don't require constant power to keep the relay enabled. Along with any other power saving ideas. Unless this could last for a long time on a battery of some sort or you guys know a way to use that 25VAC without turning the HVAC on and having a big transformer for 25VAC to 5VDC?
  5. As my first step I plan on just making a manual thermostat, but if I ever feel like going the next step and making it run on schedules and maybe have stuff like total time the heat, cool, and fan were running is it capable of keeping the time? I ask because I see a lot of talk about real-time clock shield addons and such.

I think that covers all my basics. I'm sure parts of this will be over my head as I don't have a ton of experience with microcontrollers but where's the fun if everything is a breeze.

You need to start with little experiments that will eventually combine to be your thermostat. Get some temperature sensors and some relays and LEDs and other stuff and practice wiring it up and making code for it.You have to learn the basics first. This is reasonable for a first 'project' but not for a first time ever picking up an Arduino. Go ahead and get the parts you will need, but pick up some extra parts like LEDs - the LED makes a good indicator light for testing code (why fry an expensive relay when you can fry an LED instead).

You have a good sense of the requirements of this project, which is a really good start, but you need to go get the know-how to finish it, and I don't suggest risking anything on your home electrical system as a learning exercise.

Cheap thermocouples are pretty accurate - I'm not sure about the sensors like this:
https://www.sparkfun.com/products/10988 (looks like it has the precision to run a thermostat, but not the accuracy)

jasmine2501:
You need to start with little experiments that will eventually combine to be your thermostat. Get some temperature sensors and some relays and LEDs and other stuff and practice wiring it up and making code for it.You have to learn the basics first. This is reasonable for a first 'project' but not for a first time ever picking up an Arduino. Go ahead and get the parts you will need, but pick up some extra parts like LEDs - the LED makes a good indicator light for testing code (why fry an expensive relay when you can fry an LED instead).

You have a good sense of the requirements of this project, which is a really good start, but you need to go get the know-how to finish it, and I don't suggest risking anything on your home electrical system as a learning exercise.

Cheap thermocouples are pretty accurate - I'm not sure about the sensors like this:
Temperature Sensor - TMP36 - SEN-10988 - SparkFun Electronics (looks like it has the precision to run a thermostat, but not the accuracy)

I plan on working myself up to it, and don't plan on simply throwing stuff together and hooking it up to the HVAC system hoping all goes well. Like first getting the thermometer calibrated, then figuring out how to use two buttons to turn a variable up or down, and switches to change modes, so on and so on section at a time till I can put it together like a puzzle. My experience with the Arduino is zero, but I've worked with BASIC Stamps in the past enough to know the basics (ha ha) of microcontrollers. So I already planned on the whole LEDs to emulate stuff being turned on and off and all that. This thread mainly is to guide me towards the final goal that I'm working up to and suggestions on what I should and shouldn't use. Such as the smallest relays I could use or if anyone knows what that one relay that controlled the entire system was, then the big one being the display, I know I will have a lot of learning to do on that, I read about a display that requires only two pins and is simple and suggested for beginners. Would you guys suggest it? (Here it is: LCD Shield Kit w/ 16x2 Character Display - Only 2 pins used! [BLUE AND WHITE] : ID 772 : Adafruit Industries, Unique & fun DIY electronics and kits and its color version: Adafruit 1.8 Color TFT Shield w/microSD and Joystick [v 2] : ID 802 : Adafruit Industries, Unique & fun DIY electronics and kits)

I like the TFT screens because they are so much more versatile, but the one I'm using takes almost all the pins. I think it's a good idea for the output. You have a good plan of attack too.

Can't you just use the Arduino to drive the existing relays though?

  1. What are good and very small relays that can handle 25VAC at up to 1A and is there such a relay that has three positions? As Heat and Cool will never be on at the same time. This way I'd have one relay for the overall mode (Off/Heat/Cool) and one relay for the fan (Auto/On). There was only one relay on the old thermostat I had but I returned it before thinking to get its part number, all I remember was it having 8pins and looked like only 5 were used.

Relay boards are readily available ... Like
https://www.sparkfun.com/search/results?term=relay+board&what=products
Also look into Solid State Relays
Zillions of configurations of relays are available. Not all are easily Arduino interfaced. Relays that latch-unlatch on pulses are latching relays.

  1. What would be a good display for text only? I'd love to go all out and have an e-ink or OLED screen that has touch but I hear displays get complicated real fast and I'm pretty sure that's above my capabilities for now, plus I'm not sure if this Arduino could handle even a small low resolution color screen with touch, but I haven't looked into that. So I'd like it to be nice looking, but at the same time if there's a display for beginners I probably will want that more.

Adafruit has OLED displays as do others vendors.
https://learn.sparkfun.com/tutorials/oled-display-hookup-guide

  1. Can I just grab any temperature sensor from RadioShack for 99cents or is there something you guys recommend?

Yes. I prefer a Vishay 10K NTC thermistor and the use of The Steinnhart- Hart method

  1. As it can not take the 25VAC from the HVAC system, this completes the circuit and tells it to turn heat, cool, and/or fan on, I'd like to power this by battery. Thus I'm interested in an e-ink or OLED display and if there are such relays that don't require constant power to keep the relay enabled. Along with any other power saving ideas. Unless this could last for a long time on a battery of some sort or you guys know a way to use that 25VAC without turning the HVAC on and having a big transformer for 25VAC to 5VDC?

Build a no-break power supply from a 12V Gel-Cell...

  1. As my first step I plan on just making a manual thermostat, but if I ever feel like going the next step and making it run on schedules and maybe have stuff like total time the heat, cool, and fan were running is it capable of keeping the time? I ask because I see a lot of talk about real-time clock shield addons and such.

Yes... All that stuff. But buy the premium clock module,

Next time you have a project, I expect less noise, more concentration on requirements, and some Googling on your own! You are not the first to do this...
http://www.plainlystated.com/2011/07/building-a-thermostat-using-arduino/
http://www.ebay.com/itm/6-Arduino-HVAC-Damper-Motorized-Electric-zone-control-24VAC-power-6in-inch-in-/141010732456
http://hackedgadgets.com/2009/05/20/automated-house-climate-control-whole-home-information-awareness/

Ray

but just recently that has changed as our thermostat for the house has gone out and I quickly learned they are extremely simple devices.

Well, maybe and maybe not. What type of equipment does the thermostat control, and how familiar are you with the operation of the equipment?

herqulees:
As it can not take the 25VAC from the HVAC system

Why would that be? If the current unit has any form of indicators or display it most surely does use the 25V AC, so your design would logically do the same.

Paul__B:

herqulees:
As it can not take the 25VAC from the HVAC system

Why would that be? If the current unit has any form of indicators or display it most surely does use the 25V AC, so your design would logically do the same.

It runs on two AAA batteries. You have four wires coming in to the thermostat from the wall +25VAC (Fan), +25VAC (Cool), +25VAC (Heat), and Ground. So if it were to run off any of these circuits that would complete the circuit telling that function to turn on. Apparently the Nest thermostat has issues with this as I've found multiple results on it when trying to find a way to use the 25VAC. The only way I see I could use it is to have a small battery and program a charger to only charge when the fan is running, but that's just more work on my already long for me to-do list, so batteries it is for now. Lol

My thermostat stays on with those batteries removed, so I think they are just for backup, and the thermostat runs on the house 110 lines. Are you sure it's not like that?

jasmine2501:
My thermostat stays on with those batteries removed, so I think they are just for backup, and the thermostat runs on the house 110 lines. Are you sure it's not like that?

Yes I'm sure, however I got the wiring mixed up, I meant to say it's +25VAC (red wire) supply, Ground (yellow) for cooling, Ground (white) for heating, and Ground (green) for fan. Those are the only wires supplied to the thermostat. So as you can see there is no possible way to use the 25VAC without turning a function on. I've read about electricians running another ground for the thermostat to fix the issue Nest thermostats are causing to this type of wiring set up, but that is too much work for such a simple thing. If you scroll down to the second diagram on this page you'll see a pretty good drawing on how it all works; Wire A Thermostat

EDIT: Also meant to say, as you can see from the first diagram on that page, there are systems that have many more wires and could provide power to the thermostat, however I've also read electricians complaining about people doing this because it can mess with the transformer and short it out. Either way mine is a very simple four wire system as it doesn't have multi-stage heat, multi-stage cool, variable fan, or a heat pump. It's simply an A/C unit with a huge electric heating coil mounted inside it.

Yeah I see this...
RC - Red Wire (Power 24 Vac)
RH or 4 - Red Wire Jumpered (Power 24 Vac)
W - White Wire (For Heating Enable)
Y - Yellow Wire (For Cooling Enable)
G - Green Wire (Controls Fan ON-Auto)

That doesn't power the controller?

jasmine2501:
Yeah I see this...
RC - Red Wire (Power 24 Vac)
RH or 4 - Red Wire Jumpered (Power 24 Vac)
W - White Wire (For Heating Enable)
Y - Yellow Wire (For Cooling Enable)
G - Green Wire (Controls Fan ON-Auto)

That doesn't power the controller?

Read my edit, I don't have five wires I only have four.

Yeah I see what you're saying, I wonder if my wiring is wrong now, I didn't install the thing, it came along with a whole re-build of the system here. I have a gas furnace and the AC is outside, so it's a little more complicated than your house I think.

you will need one relay for heating and one for cooling. they are different devices and need to be separate.

if you have a heat pump, you may need to run that and the heater. more information is needed.

as for programming.

heating is a VERY sloppy type of process. you can turn the heater on and you will see nothing happen for minutes. then, once the heat does come on, the heat will overshoot.

if you have a gas or oil heater, the burner comes on and heats the heat exchanger. once this rises above a point, the fan turns and and the fan will run until the hot mass is cooled below a set-point of the heat exchanger sensor. this is outside of your control. the device is built into the heater.

so expect swings of temperature. this is only natural and is what your thermostat does now.

read up on anticipation. this is a setting that you do have control over. if you send a signal to heat, and wait a minute and then turn off the signal. your heater will get warm, then start to heat, and run longer than your signal.

anticipation is alike a guess as to how soon to end the signal with the expectation that the heat will come later and run longer.

you could data log your signal for heat, the end of the signal, the start of heat increasing on your sensor and the time the heat reaches it's peak, and then the length of time it takes for the heat to decay until then next time it will call for heating. once you understand that calling for heat and actual heating are two totally separate processes and in one way have no link whatsoever, you will have a much better understanding of what you need to do to program.

that said, the anticipation setting is directly linked to the outside air temperature. something few commercial thermostats have a provision for. but higher end furnaces do take a reading of.

second, an automatic change-over. this will heat when needed and cool when needed. the commercial thermostats have ignored this and have yet to address it adequately.

a human is very comfortable with a temperature swing of 2 to 3 degrees or more.
consider that if the temperature decays, then you should be in heating mode. if the temperature rises between cycles, you should be in cooling mode.

it is not uncommon to heat all night long and cool all day long. with the oven on or a bunch of computers, you may generate more heat and need to cool in the middle of winter.

if you have a setting so that you cannot switch between heating and cooling in any period of less than 20 minutes, you should be able to eliminate the heater overshooting and the air conditioner cooling that air you just heated. the heating set point should be about 2 to 3 degrees less than the cooling set point as you shake out the program. you will find that 1 to 2 degrees difference will work for heating/cooling cycles as you hone in on your final program. one that should make your environment much more comfortable.

btw, if you can get your hands on one of those old round Honeywell thermostats with the mercury level thing, use that to test calls for heating and cooling. it has a coil on the arm that generate heat. as that heats, it shuts off before the room temperature reaches it's level. these used to be the holy grail of thermostats. they kept the best temperature for a heater. study when it calls for heat and when it shuts off and when the heater starts and when the heater shuts off. study what works best.

1 Like