Smart Thermostat and Transformers

Hello all, This question may have been asked before as it seems like an obvious idea for any maker to want to do but I can't seem to find the answer myself.

I'm looking at doing a smart thermostat project. The brain is probably going to be a raspberry pi but I haven't decided yet if I'm going to just have it set up somewhere as a central server type thing and have an arduino or something handling the thermostat replacement part, or have it actually live in the wall where the thermostat control will be.

But either way my question is still the same, powering the device off the thermostat wiring. My house is newer so I have the common 24v wire already at my thermostat. But 24v is still to much for an arduino or raspberry pi. Also, it's 24v AC and I'll need DC. From what I can gather I need a transformer and to build a rectifier bridge, then use a voltage regulator to get it down to a safe 5v for the controller. But I'm having difficulty figuring out exactly what I can use to do this. All the transformers I can find are kind of huge. I'd be surprised if these small lcds and circuitry in store bought thermostats can handle 24 volts, yet there is no where in them for one of these big transformers.

All the how to build a smart thermostat guides I've been able to find don't really go into detail about powering the controller. The only one that did ran a wall wart for a raspberry pi to a regular 110v outlet. Definitely not something that I want to do, I want it to look good and not have any wires or plugs exposed. Plus the power is there, I just have to figure out how to make it usable lol.

So anyone have any advice? Is there a premade breakout board that would work for what I need to do (convert 24v ac into 5v dc), or can anyone give me some advice on finding a small transformer?

As a side question if anyone happens to have any opinions about this. I plan to have remote temperature sensors all over the house eventually. But initially I'm just going to have one at the thermostat. Can anyone think of a good way to thermally separate the DHT22 (temp / humidity sensor I'm going to use) from the rest of the electronics so that the heat from any transformer or controller doesn't effect the readings?


You need to consider if you will need to isolate the ground or negative side of the power. If not then there are many small dc power supply boards that will accept up to 32 vdc and give you 5v out. Just use a full wave rectifier and a 1000mfd cap from your 24vac and feed the regulator board.

I haven't done much with AC previously, I'm not sure what isolating the ground would do.

You do not need a transformer to convert 24VAC to 5V DC. You need a diode, a resistor/capacitor ripple filter and a switching voltage regulator.

HOWEVER, the 24VAC wiring in a modern home HVAC control system often does not have a neutral connection! Instead, there is a "hot" 24VAC connection, and the remaining wires lead to controls in the central system. So, you have to understand how [u]your entire system works[/u] in order to derive 5V for powering devices.

For example see this page and this wiring diagram: |500x300

This is not recommended for the inexperienced.

My system does have the black 24v common line. From what I gathered, it served as the neutral / common for the 24v line. That could be incorrect on my part though.

If you are absolutely certain that the black lead is the 24VAC neutral, then a simple rectifier/filter/buck converter will work fine, for example: |500x258

Or better use a full wave diode bridge:

A Pololu buck converter will convert the 33 VDC to 5V.

If I were to do this my thermostat would be a simple thermistor - just measure the temperature and do the settings/sums in the controller...



So, the only purpose of a transformer is to step voltage down some? And in this case I don't really need it since I'm already at a voltage level that a buck converter can step down to my level?

As for being absolutely certain of the black line, that is what all the color guides I can find say it is. This house was built in 2011, so I'm assuming everything was done to a recent code lol. But, to be absolutely certain, what would I need to do to verify since this is AC? Is there a particular way I can connect a voltmeter to determine it safely? In the past when dealing with AC my voltmeter hasn't been terribly reliable because it doesn't sense the AC fluctuations fast enough or something lol.

You do not need a transformer.

Wire colors are not standardized in HVAC systems, although there are some loosely obeyed conventions.

Your only reliable guide to the [u]function of the connections[/u] is the data sheet for your thermostat.

Unfortunately an AC voltmeter is not definitive in identifying neutral and hot leads in an AC system. A lead that connects to a low resistance load (relay coil, etc.) will still behave like "neutral" to a voltmeter.

In fact, modern electronic thermostats that derive their power from the 24VAC hot lead of a 4 wire system depend on the fact that the load connected to one of the three outgoing connections will conduct current to the remote neutral.

If you want to be certain, ask a professional HVAC engineer to examine your system.

Ok, I got some follow up questions for someone that knows about thermostats and ac systems.

I have a heat pump unit in my house. So I apparently have a reversing valve. On the current thermostat, there is an orange wire going into the "O" terminal. From what I can determine, this needs to be "energized" to activate the reversing valve for cooling mode. If it were connected to the "B" terminal that would mean it would have to be energized for heat mode.

Is this accurate?

I'm assuming by "energized" that means, I just need to activate a relay to pass the 24v red power line into the O terminal / orange wire, right?

Same for cooling yellow, heating white, and fan green? So, when the temperature gets high enough to need the AC, I would have to activate 3 relays and pass the 24v red lines power to the reversing valve, compressor, and fan at the same time. Is there any reason not to just have the reversing valve and compressor work off the same relay? I'm not understanding the purpose of a thermostat controlled reversing valve fully, seems to me if the cooling line is energized, the system should be smart enough to activate the reversing valve if that is necessary for cooling... But anyway, when the temperature gets low enough to need the heat, I'd only activate 2 relays to pass the 24v red line power to the heater and the fan. Just want to make sure this seems accurate to you guys.

Also, my old thermostat doesn't really do anything with humidity, are there any good guides that I could read on what I'd want to do in an AC system when I have a humidity value available? (if anything).

And finally, I don't know if a typical thermostat does this, but I was thinking it would be a good idea and figured I'd see what you guys thought. I was thinking when the temperature reached the value to cut off whatever system is running, I'd cut off the compressor and reversing valve, or heat line, but leave the fan running for a few minutes in order to blow all the hot / cold air still in the vents out and not waste as much of it to attic temperatures. Does that seem reasonable?


Hi, Simple ready to go 5V supply, USB power pack.

|500x366 Ths one supposed to be 2.5A Ideal considering the experience/knowledge of the OP.

Tom... :)

Thanks TomGeorge, but a wall wart doesn’t really address any of the questions in this post. Especially when I specifically said a wall wart is not something I want to do for this, having a wall wart for a thermostat would look stupid imo.