Arduino interface with 24v Thermostats

Thread Starter

haukeg

Joined Dec 9, 2018
66
Hi, I am new to the forum and not super versed in circuit design, but excited to learn more here.

I have been trying to design an optocoupler circuit to allow me to "listen" in on my 24v Thermostat calls to my Taco ZVC405-4 zone valve which controls my radiant hydronic heating in my home. I would like to be able to watch for the calls via an Arduino microcontroller.

I have done a number of Arduino (low voltage) projects, but am trying to make sure I go about tying into a line voltage system with good isolation. Attached is a quick schematic I came up with based on some other research I have been doing on the Arduino forum for this design. However, I am not sure how to calculate the Resistor values properly given the two sides of the optocoupler. I may also have some flaws in my layout, If you can offer any advice and assistance on the design, I would really appreciate it.

Thanks!

OptocouplerThermostatCircuitDesign01_haukeg.png
 

dendad

Joined Feb 20, 2016
4,452
I take it you just want to know when the thermostat connects the 24VAC power to the valve?
Try something like this...
ThermostatArduino.jpg
Use the pullup config.
Eg,
//configure pin 2 as an input and enable the internal pull-up resistor
pinMode(2, INPUT_PULLUP);

The input will be LOW when the thermostat turns on the valve.
 

DickCappels

Joined Aug 21, 2008
10,152
A couple of notes:The circuit in post #1 will work but you need to put a diode across the LED to protect the LED from being reverse biased -reverse bias can shorten the life, sometimes to nearly zero. The open transistor output of the will be pulses at the line frequency. Since a little bit of delay in the circuit is probably ok you can connect a small capacitor, maybe 1 ur to 10 uf between the collector and emitter of the transistor to smooth the pulses. Alternatively you can take care of that in firmware.

Are you using the internal weak pull-up on the Arduino? If not, add a 20k pull-up to +5V and a 4.7 uf capacitor across the collector and emitter.

@dendad's circuit in post #2 is much better in that with transformer isolation it is much less likely to be a shock hazard.
 

LesJones

Joined Jan 8, 2017
4,174
Hi Dick,
I disagree. The circuit inpost #1 is trying to sense the tiny voltage drop across an unknown length of unknown type of wire. I think you assumed the circuit was sensing the voltage across the valve. I have also seen some optos that work with AC input. they have two LEDs reverse connected so each one provides light to the detector on half of the cycle.

Les.
 

DickCappels

Joined Aug 21, 2008
10,152
@LesJones you are right, this one has the dual LEDs. Still I advocate the capacitor unless haukeng wants to take care of the ripple in firmware.

If the wire that the optocoupler and its resistor are connected across is the valve solenoid, things should be fine. It is really across a length of wire as LesJones noted, it would probably be better to put the optoisolator's input with its series resistor across the thermostat.
 

Thread Starter

haukeg

Joined Dec 9, 2018
66
Thank you @dendad for the circuit design and sample code. I was thinking I would just detect when the thermostat is closing the loop to the Zone Valve Controller and not the lines from the Valve Control to the valve itself (if that is what you meant). For some reason, the sketch you posted isn't enlarging when I click on it (even tho the hover says it will), so I could be reading it wrong - it's a little fuzzy un-zoomed.

@LesJones and @DickCappels - thanks for the feedback. I should have posted that I chose this particular optocoupler from a response from a post on the Arduino forum for this problem:

"I made a setup to monitor my Taco Zone valves (for the same purpose) I used a Fairchild FOD814A300,
With 20K in series with the input and a 1µF on the output (to remove the ripple)."

I asked the poster if they were doing this on the thermostat side and not the Zone Valve Control to Valve side but did not receive a response, but I assumed it was the thermostat side based on how I framed my question. Not sure if that helps, but its feedback from someone doing the same thing. That post along with a couple other responses here.

When I throw my meter in series with my thermostat line and measure the calls, I get ~24v on close and nothing on open, so I assumed that was what I wanted to watch for. Thanks all for the help!
 

Reloadron

Joined Jan 15, 2015
7,501
I have been trying to design an optocoupler circuit to allow me to "listen" in on my 24v Thermostat calls to my Taco ZVC405-4 zone valve which controls my radiant hydronic heating in my home. I would like to be able to watch for the calls via an Arduino microcontroller.
If you want to monitor is a 24 VAC (or for that matter a 24 VDC) signal is present a simple turn key solution might be to just use a HCPL3700 AC/DC to Logic Interface Optocoupler since it is designed to do exactly what you seem to want to do. While at about $5 USD per chip they aren't a very cheap chip but everything is in one neat package including an 8 pin dip version. Run your AC in and get your logic level out.

Ron
 

Thread Starter

haukeg

Joined Dec 9, 2018
66
Thanks @Reloadron - I had not considered a solution like that, I will take a closer look at it, thanks!

I actually plan to “listen” to each of the 5 zones, so I was planning to create a separate circuit for each (so 5x my design in post #1). I assume there might be a more elegant solution to that need as well, but was starting with a simple approach.
 

Reloadron

Joined Jan 15, 2015
7,501
Thanks @Reloadron - I had not considered a solution like that, I will take a closer look at it, thanks!

I actually plan to “listen” to each of the 5 zones, so I was planning to create a separate circuit for each (so 5x my design in post #1). I assume there might be a more elegant solution to that need as well, but was starting with a simple approach.
In that case if the link I posted for your zone controller is what you have I would just get the chips I mentioned and place their inputs across each zone pins 1 & 2 and use the logic out for your Arduino using one DI for each zone. If you want to be cool about it you can include a display with the Arduino telling you want each zone is doing in addition to using some DO channels to light a LED for each zone. Then to be super cool I guess you could place an Arduino Ethernet Shield on your Arduino, make it a web server on a home network allowing any PC, laptop or tablet in your home access to what your controller is doing. :)

Ron
 

Thread Starter

haukeg

Joined Dec 9, 2018
66
Actually, the correct wiring schematic for my valve control is here. Not sure if that changes anything in your thinking.

If you were referring to the Zone terminals at the bottom of the schematic, I was not thinking of connecting my interface there, but on the top ones where the thermostat connects to each thermostat zones R & W pins. If you can provide any wiring design thinking on using the HCPL3700 I would appreciate it, I am still pretty fuzzy with circuit layout and want to make sure I understand the approach.

Appreciate the help!
 

Reloadron

Joined Jan 15, 2015
7,501
It would be the same, pins 1 & 2 for each zone are the 24 VAC out to operate the zone valves. So on the chip I mentioned, one chip per zone Pins 1 & 4 (AC Input) would go to pins 1 & 2 of your controller for each valve. When the valve goes active the chip output logic goes Low, the logic truth table is on the chip data sheet. You power the chip pin 8 with +5 volts from your Arduino board and the chip common pin 5 is your Arduino common. The chip digital out logic is pin 6.

The problem with using the top (thermostat) terminals is the thermostat is merely acting as a switch you will measure 24 VAC across those terminals when the thermostat is open and zero when the thermostat is closed but at the thermostat terminals there is no common reference for the 24 VAC. Also knowing if a thermostat is calling for something like heat or cool does not tell you if your valve is being commanded to open, that is why I choose the valve side of the controller.

I just see using a single chip turn key solution as easier then building a solution with some discrete parts.

Ron
 

Thread Starter

haukeg

Joined Dec 9, 2018
66
That sounds great, I really like the simplicity of your approach. Would I need to add in resistors or diodes as many ya e recommended with my earlier approach using this specific chip?

Oh, and forgot to say, on your earlier post of readout, I was planning to build a web view that my arduino sends data to, so I can monitor my calls in a lot of ways. Plan to use an Arduino MKR1000 and send data over WiFi.
 

Reloadron

Joined Jan 15, 2015
7,501
I should also point out if you want to see when the thermostat calls for heat you can have it that way. On your controller there is a C terminal which is 24 VAC Common so you would look at the C (common) and the W (call for heat) terminals. When the thermostat switch closes calling for heat the C & R terminals will have 24 VAC across them. Personally I would monitor the out of the controller but you can also do it as you mentioned using the top terminals.

Using the chip I suggested all you need is a single external resistor. Looks like about 20K from the chip data sheet Figure 8 on page 6. That would be for a 24 VAC (give or take) input.

As to the Arduino there is no shortage of tips and tricks to get all of your data web based, pretty cool stuff. :)

Ron
 

Reloadron

Joined Jan 15, 2015
7,501
A Google of HPCL3700 Arduino will bring up some good drawings and ideas. Since the HPCL3700 has an open collector out you want to either setup your Arduino to use an internal pullup in your code or just place a 10K resistor between Vout of the HPCL3700 and Vcc. Pretty much a matter of how you want to go about it.

Ron
 

dendad

Joined Feb 20, 2016
4,452
Thank you @dendad for the circuit design and sample code. I was thinking I would just detect when the thermostat is closing the loop to the Zone Valve Controller and not the lines from the Valve Control to the valve itself (if that is what you meant). For some reason, the sketch you posted isn't enlarging when I click on it (even tho the hover says it will), so I could be reading it wrong - it's a little fuzzy un-zoomed.
Sorry Haukeg, I did not post full ample code. That was just a segment to show how to use the built in pullups on the Arduino.
Have you had a look at... https://forum.allaboutcircuits.com/threads/arduino-based-whole-home-humidistat.141619/
Just a thought to further complicate things, this could be an application for an ESP8266 as it has built in WiFi, or ESP32 that also has Bluetooth.
This guy sells a really good course on ESP8266/32, https://randomnerdtutorials.com/ and also a home automation course.

And Ebay has some quite cheap boards or you could get some well supported ones from Adafruit. They have good programming example.
 

Thread Starter

haukeg

Joined Dec 9, 2018
66
Excellent, thank you @Reloadron - these are super helpful leads and details, I will start designing my options.

No worries @dendad - really appreciate the follow-up and other suggestions, good to have options and I will check those out too.

This was exactly the help I was looking for, glad I found this great forum. Thanks all.
 

Phil-S

Joined Dec 4, 2015
238
@Reloadron - you beat me to it. The HCPL3700 or it's more sensitive version HCPL3760 is purpose made for interfacing HV (240-V AC etc.) with logic level circuits like the Arduino. In fact, just an hour ago, two more came through the letter box. The data sheet gives all the calculations for determining the threshold point at which the logic output flips. Broadcom (the manufacturer) has in its application notes, an Excel spreadsheet for doing the sums. In many cases, it will replace relays for interfacing. I use them for central heating monitoring, but what got me into these was the need to get some old lighting programmable timers that work without a neutral being directly connected. When replacing a bog standard plate switch with a timer, the timer power relies on leaking a small current through the lamp filament to neutral on the lamp. This is fine with the old purely resistive filament lamps, but newer loads like LED lamps won't work properly. So, instead of the LED as a load on the timer, a couple of high wattage resistors provide the load which can be just a few mA with the 3760 version. The 3760 drives a sub-miniature relay. Now any load can be switched, no minimum or maximum, resistive, LED CFL, whatever you like depending on the contacts. Highly recommended useful chip, and in DIP-8 format.
 

Hemi

Joined Mar 17, 2012
30
If I had known about the HCPL3700 / HCPL3760, I probably would have went with that. :) But I created this following to sense when my HVAC turns on and off (very similar design to dendad's suggestion).

The VOM617A-3T is a 6 pin DIP and is $0.60/ea on Mouser.com vs $3.35/ea for the HCPL3700
 
Top