I have an older project that uses a Basic Stamp to monitor my furnace's control lines to determine when the heat or A/C is on. It's ugly. And I'm looking for guidance on improving/replacing it with an Arduino.
The heat and A/C lines from the thermostat are 24VAC. I put them through a rectifier and a cap to try and filter them into a DC signal, which then went through an opto-isolator to protect the Stamp. However, there was still enough ripple in the signal that I had to code up some hackery in the Stamp to deal with the digital I/O line toggling at 60Hz.
Sigh.
One option is to have the 24VAC signal lines drive a relay, but that is bulky, and I don't have any relays with a 24VAC coil.
I'm probably thinking out loud the solution, so, I guess I just have to rework the rectifier/cap setup? or is there something else I might be missing or has been done with more success?
You don't say what values you were using for what parts, but the basic circuit you describe works fine (I have used same sort of thing for detecting AC without a problem). Two things come to mind in your description that may be an issue - the cap may be too small (you should not be seeing that much ripple) and you may also not be passing enough current through the LED in the opto-isolator. Without seeing a schematic and what parts you are using, it is impossible to be more specific.
The heat and A/C lines from the thermostat are 24VAC. I put them through a rectifier and a cap to try and filter them into a DC signal, which then went through an opto-isolator
That should work perfectly. What's the capacitor value? It should be easy enough to filter the rectified AC to the point where the opto-isolator is always "on" when voltage is present.
However, there was still enough ripple in the signal that I had to code up some hackery in the Stamp to deal with the digital I/O line toggling at 60Hz.
That's fairly easy too, although it shouldn't be necessary. Just make a little loop that runs for something like 1 second, and if the heat has been detected as "on" in the last second (or whatever time period), it's "on", and if it hasn't been detected as "on" then the heat is off.
ehud42:
The heat and A/C lines from the thermostat are 24VAC. I put them through a rectifier and a cap to try and filter them into a DC signal, which then went through an opto-isolator to protect the Stamp. However, there was still enough ripple in the signal that I had to code up some hackery in the Stamp to deal with the digital I/O line toggling at 60Hz.
Thermostat signals are very low bandwidth (slow changing), and digital inputs (like the arduino) are very high impedance. So it should be totally trivial to filter those signals right at the digital input.
Like dlloyd's solution above. If you don't have an "ac" opto like the H11AA1 handy, it should still be trivial to adequately filter even a half wave version of the above. (Just make sure that you add the anti parallel diode externally if it's a regular opto isolator).
TL;DR - haven't changed anything. Yet. Was exploring options during the Christmas break (Dec 2018) to migrate my home furnace monitoring system to a Raspberry Pi and was trying to figure out how to reliably detect the 24VAC signal and I found this thread. Seems I have been down this road before.
Thanks for all the input! I hope it has helped someone, and when I get around to rebuilding, hopefully I will remember this post!
I don't have AC compatible optocouplers, so I threw a reverse diode across the input. I mathed 30V -> 10mA to be 3K, and then grabbed a 2.7K resistor - so I might be running the input a bit too hot.
I have a little XProtoLab oscilloscope, and found the results to be quite fascinating and satisfying. Without a cap on the output, signal drops to near 0 every cycle - was a little surprised that I didn't see a sharper shutoff - the optocoupler's I have must have some internal capacitance.
I put a 10uF, then a 1uF and finally a 0.1uF, and that seemed to be the best balance between almost no ripple and reasonably quick shutoff time (~0.2 seconds).
Next step will be to write some Arduino code and actually consume this newly filtered input.
I've been using the same basic circuit as dloyd's Post #3 but using a Fairchild FOD814A300. 20K input resistors and 1 µF output filter caps.
I also used the same opto with 120k series resistors to monitor the 120VAC circulator pump.
Just a thought, if you don't have bidirectional input optos, and don't want to filter the 1/2 wave output, you could put two "regular" optos with inputs back to back and outputs in parallel.
JohnRob:
Just a thought, if you don't have bidirectional input optos, and don't want to filter the 1/2 wave output, you could put two "regular" optos with inputs back to back and outputs in parallel.
Question: Which is simpler and more practical - two optocouplers, or one optocoupler and a bridge rectifier (four diodes - 1N914s will do just fine)?
Hope you are using modern optocouplers and not the obsolete 4N2x series ...
You could make a circuit to create 3 phases or more, and attach them between the cathode of a diode and the anode of the other diode. You will get left 3 anodes and 3 cathodes. The 3 anodes are the positive pole and the cathodes are the negative pole. Just put a capacitor in parallel to smooth this out.
You could make a circuit to create 3 phases, and attach them between the cathode of a diode and the anode of another diode. You will get left 3 anodes and 3 cathodes. The 3 anodes are the positive pole and the cathodes are the negative pole. Just put a capacitor in parallel to smooth this out.
So, I was serious about using 4N35's in my test - I was naively kidding/insinuating they weren't likely to be any better (since they're basically new-old-stock to me). However, it did get me reading, and seems I've lucked out!
4N2x's seem to cause a lot of issues with the output not being as digital as desired, and requiring quite a few mA on the input to work. Something about CTR (current transfer ratio).
I was referring primarily to the CTR. The more modern four-pin optocouplers generally have a CTR at least of 1 and more.
The graph of fall-off over time is concerning. Most spec sheets do not mention this - I wonder to what extent it is improving? I expect components to have a lifetime way more than two or three years in continuous use!