Powering an ESP32 through C-Wire

Hello everyone,

Hating cloud stuff, I’m very happy that I started playing with HA in the last week.

My first project would be to control my electric furnace with the scheduler component/card and take full advantage of dynamic pricing we have here.

My issues are with powering the ESP32 through the C-Wire of the furnace using a stepdown (24V DC to 5V DC). There must be something I’m not understanding, how would I connect the negative terminal of the converter back to the furnace?

thermostat V1

I think the rest of the wiring is accurate (except power and ground to the relays and dht11, these would be the same bus probably) But I’ll take any criticism!

Aren’t most residential HVAC systems 24VAC rather than 24VDC? There should be a transformer for your furnace, which should give you ground.

1 Like

In the US, residential HVAC operates on 24VAC. R and C are your voltage terminals (C is usually called common, but it’s a misnomer because there is no “common” in AC voltage). You will need a 24VAC to DC transformer to convert the voltage then step it down to 5VDC. The only other advice I can recommend is to use some relays that are rated for HVAC equipment/use. They’re usually higher quality and durability and longer lasting.

1 Like

You are right, checked with a voltmeter between R and C wire, getting 24-26VAC, I’ll post a Version 2 picture shortly

I thought the C wire was a hot wire, but it seems like its a ground.

Yup, you are right, need to had a ac-dc converter

My understanding now is that R is power and C would be ground (or I could use a ground somewhere else like CO_4X4 suggested)

I’ll definitly look up some better relays than what i have, cheap stuff from china


thermostat V2

Yes, that diagram looks correct. No you cannot use any other “ground” for the 24VAC side. You must use your R and C terminals on the furnace.

I’m guessing you’re going to use the generic thermostat built into HA? Not sure what logic you’re going to use, but if I were doing this, I’d write the thermostat logic on the ESP32. When you turn off the service switch for the furnace, this will kill power at the 24VAC transformer and also turn off the ESP32 “thermostat”. This is good because the relays will open their contacts as long as you wire to the normally open terminals. However on power up, you might want to put in a small delay in the logic where the DHT will settle before you activate any relays so you confirm the temperature is what it actually is and not an erroneous value. Additionally you might want to incorporate some hysteresis or smoothing to the DHT sensor as well as deadband on/off temperatures so you don’t short cycle your heater. I’m used to gas furnaces, so this might not apply to electric, but maybe it does. You want longer but less frequent runtimes. So something as simple as if your setpoint is 70F, turn on heat lower than 69F, and turn off above your setpoint. Take this logic further and you could potentially setup remote temperature sensors that talk to the main thermostat.

I am curious as to why you are going this route instead of just getting a smart thermostat. Don’t take that as a criticism, I’m just curious what this solution offers you that a thermostat doesn’t for cycling your furnace dynamically.

I had the same thought. Ecobee you can use without the cloud and connect to HA through HomeKit controller and that keeps control 100% local. That’s what I use and it offers all of the same features as what’s trying to be accomplished here and then some. That’s just one option and I’m sure there are many other thermostat options out there. I can’t speak for the OP, but I wouldn’t want to reinvent the thermostat.

1 Like

Yea, I use a Z-Wave Honeywell T6 and it’s the same thing, 100% local.

Valid questions

I was going to use the scheduler component/card, my understanding it that it would avoid short cycling the furnace.

Minor reasons:
-Costs, all smart thermostat I found go for 150$-250$ (CAD) while this whole setup would be around 50-60$
-the fun of thinkering/learning

Major reason:
-I’m just not really familiar with smart/connected devices, I don’t own any. I’m not sure how it would interact with HA and the scheduler card (will the thermostat schedule override the HA scheduler card?)
-I don’t like when stuff requires an app for the first setup, I hate that (again not familiar with connected devices)

In the end making my own seemed simpler than learning how these others work and integrating them. But I could 100% be wrong there

I have a lot of ESP devices I created for exactly this reason, I get it!

You just let HA control scheduling and don’t use it on the thermostat.

If you get a wifi device this might be the case, on my Z-Wave it just integrates with nothing else needed.

I would think building your own is exponentially more difficult than buying one that does this and more. Consider that with control you then have to link together temperature sensors, humidity sensors, make sure your wiring is right, make sure you aren’t short cycling your HVAC - all things that a good thermostat already handles quite well.

Main reason I’m doing all this is my power utility announces peek events in the morning and evening during winter. So I want to have my normal schedule (night, leave to work, come back, night again etc) and another schedule I can toggle on/off for the next day when they announce a peek event.

That second schedule need like 7-8 changes of temperature to be really efficient.

All this seemed to give me more control than a bought smart thermostat, they generaly have 4 scheduling time for a day, which is insufficient

Here’s one for less than $100, I would look first (as a general rule all of the time) to see if people have any issues with it in HA, but it’s a wifi thermostat by Honeywell and I assume the Honeywell integration handles it (do your own research though).

Think about a smart thermostat as being just the gizmo on your wall, you handle all of this from HA. I manage mine in a similar way to yours, the thermostat is the means to the end, HA controls the management of my home climate, I don’t let the thermostat do anything on its own.

Yea I might be making things more complicated than they need to be, thanks I’ll definitely look up that thermostat, 115$CAD is not too bad if I don’t have to put in all that work

I’d recommend having a backup thermostat anyway, it doesn’t need to be smart, just a thermostat. Because the one thing I can tell you from using HA to control my own heating, is sometimes Proxmox crashes, sometimes Home Assistant crashes, sometimes the network crashes (packet storm from a random device). It doesn’t matter the reason - what matters, is that you are left in a situation where you have no heating until you figure out what is wrong and fix it. A backup thermostat at least gives you the security of knowing you won’t freeze.

1 Like

Yea I am not throwing away the programmable thermostat I have, I will definitly keep it has a backup

I still have my old Insteon version, a manual Honeywell that came with the house and my old Nest for just in case. I’ve never needed it, though, because a smart thermostat is still a thermostat and can be controlled even if everything else is down. But I hear where you are coming from for sure!

The relays in the OP aren’t controlling the motors but replacing the relay in the thermostat. Any relay should be fine as they just control larger contactors in the furnace.

In most modern HVAC systems the thermostat is pretty simple:

The thermal switches in the thermostat simply connect one of the contactors in the furnace to the R wire from the transformer. The C is not needed by dumb thermostats.

What I mean is you need a relay that 1) has a coil voltage that matches the control circuit (microcontroller) and 2) is specifically rated to handle 24VAC or more at rated current across the contacts. Some relays have a variable range coil voltage (for example 18-36V AC/DC in the Industrial controls industry) while others are specifically a 12VDC coil only (automotive industry). Additionally, cheaper relays have cheap contacts made of cheap material. at low voltage it’s rare, but I have seen relay contacts welded shut due to the age and constant use. Typical life span of a relay is ~100k cycles. On a typical cold day/night, my thermostat cycles the heat about 15 times. doing the math, that means I should get worst case about 18 years life span (actually closer to double that or 36 years since I run my heat only half the year) from a relay whose sole job is to trigger my furnace. Buy cheap, buy twice.

EDIT: What is being discussed here is the actual electromechanical relay that triggers the furnace and/or fan by connecting R and W1 or G through it’s contacts. Yes, those are the thermal switches or the fan on/auto switch, but in the presence of a microcontroller, they are now no longer thermal contacts, rather electromechanical relays.

1 Like