Arduino - Smoothing capacitor for 24vac (thermostat)?

Arduino - Smoothing capacitor for 24vac (thermostat)?

PostBy: CoalisCoolxWarm On: Mon Dec 26, 2016 3:45 pm

Probably a simple question for those who know ;)

I am using an optoisolated IC to detect 24vac, which closes a 5vdc set of pins that I am detecting with an Arduino Mega 2560.

It works fine, MOST of the time.

But about 8 times out of 100 it will flip-flop on the Arduino side. Yes, I've debounced the digital input, which does make it better, but it's my thermostat detector and I want it 100%, not turning on a zone for 1 sec as it cycles through the loop :shock:

Obviously I have chosen the optoisolator IC instead of rectifying and then dividing the voltage and I'd like to stay with this method... which leads me to my question.

WHAT Capacitor/circuit would you recommend on the 24vac side to prevent the flip flop on zero crossing?

I currently have 2x 22k 1/4 watt resistors in parallel (I didn't have higher power ones here) to limit the current.

The IC detects up to 220v with proper resistors, uses two opposing internal LEDs for the optoisolation. So I don't mind if BOTH LEDs overlap, just no dark moments.

My inexperience at circuit design is showing :oops:

Any tips would be most appreciated.
CoalisCoolxWarm
 
Stoker Coal Boiler: Keystoker KA-6
Hand Fed Coal Furnace: old Sears rebuilt, bituminous- offline as of winter 2014
Coal Size/Type: Anthracite Buckwheat
Other Heating: Oil Boiler


Re: Arduino - Smoothing capacitor for 24vac (thermostat)?

PostBy: titleist1 On: Mon Dec 26, 2016 4:57 pm

I am an arduino newbie (only one halloween prop project) and i am sure have less circuit design know how than you - but could you program a short delay then a second read of the DI before triggering the DO in the arduino program to filter out the effect of the false trip at the zero crossing?

Just curious why you are locked into using the optoisolator IC. I used interposing relays with the appropriately rated coil voltage and I am wondering what I am missing out on!
titleist1
 
Hot Air Coal Stoker Stove: Harman Mag Stoker (old style) one in basement, one in workshop
Hand Fed Coal Stove: Harman Mark III on standby for long power outages
Coal Size/Type: Rice/Anthracite; Nut/Anthracite

Re: Arduino - Smoothing capacitor for 24vac (thermostat)?

PostBy: Rob R. On: Mon Dec 26, 2016 4:59 pm

I do not think I have ever seen another post on this forum with so many words I do not know. :shock:
Rob R.
 
Stoker Coal Boiler: EFM DF520
Hand Fed Coal Stove: Hitzer 50-93
Coal Size/Type: Lehigh Rice
Other Heating: Dad's 1953 EFM Highboy

Re: Arduino - Smoothing capacitor for 24vac (thermostat)?

PostBy: CoalisCoolxWarm On: Mon Dec 26, 2016 5:42 pm

Here is the debouncing setup I'm using in code: http://forum.arduino.cc/index.php?topic=266132.0 Yes, it does read, delay, read. But if I can condition the input side, then I only have to account for normal Arduino bouncing (crazy boards), and make sure I decouple my ICs as any circuit grows.

Relays are one method, but expensive and bulky for my needs.

I want to stay with optoisolation because it keeps the entire 24vac site 100% separate from the logic side. Cost and complexity is much less with the IC handling some functions for me.

Rob- It gets better, LOL. Not too bad once you get the basics down, but some real gotchas for newbies to circuit designs.

The chip I'm using uses (in this case) 24vac of the thermostat line to light a very tiny LED inside the chip. LEDs only work in one direction, so on its own it would only light on either the top or bottom of the AC sine wave. So the chip includes a second one on the other half of the AC circuit (in reverse) so that one of them will be lit up any time there is AC power on the line.

The other side of the chip is a tiny detector that sees the LEDs light up and closes an internal switch between two legs on the logic side, completing a DC circuit. Because there is no physical connection between the separate electrical paths, there is no chance of short circuits or AC getting on a DC line (poof!) or DC causing interference on the AC line (malfunctions).

Since the method involves Optical emission and detection, the circuit is said to be Opto-Isolated (and derivatives of that term are acceptable)

The Arduino has digital input pins than can detect this circuit because it has a tiny amount of power that goes through the chip's two legs when closed and passes through a resistor to ground. The resistor prevents a dead short when the circuit is closed (like putting a screwdriver across battery terminals would be :shock: )

The problem is where the top half of the AC sine wave drops from positive to negative. It must cross the zero voltage line, aka "zero crossing." It is at this point that NEITHER LED is lit up. So it has a little internal flicker.

This causes the output on the logic side to have matching gaps, aka pulses or ripple.

To complicate things, the circuit is pulsing twice in a cycle, which is 60 times per second, making it 120 times per second that it will be at zero (plus a little padding). The Arduino reads the digital input at some frequency that depends on the chip frequency, the circuit, the program running, etc etc etc.

MOST of the time the Arduino will miss the zero crossing, but once in a while it will hit it.

A debounce software method most often will read, make a small delay and read again, returning a "my switch changed state" message only if they match. This method helps a great deal because the odds of hitting that zero crossing corridor twice in a row get much smaller. But the chances are not zero.

Now...

Rectifying an AC circuit is just a fancy way of saying you are chopping off one half of the sine wave, usually to convert it to DC. For this example, let's say we are keeping the top half and cutting off the bottom half.

We use a diode (not Light Emitting Diode, but it could be), which act as one-way check valves. They block flow in the backwards direction and permit flow in the forward direction- when the "pressure" on the other side of the check valve drops. Just like hydronic systems.

So once we've eliminated the "backwards" part of an AC circuit, we have little one way pulses. But for DC, we usually want one way SOLID current without pulses. Enter the capacitor.

Capacitors are like little stateful batteries. They charge when there is power and once the circuit drops, it discharges its stored power into the circuit. The use we are discussing here is their ability to "bridge" or "power" a circuit during very short outages...like pulses.

The capacity, type, and power rating of a capacitor has to be appropriate for the circuit so that it will bridge the gap between pulses without dropping too low (which would be seen as an outage pulse by the circuit), but not so large that it powers the circuit too long and we miss a proper drop when the circuit is turned off on purpose.

Making a mistake either doesn't work properly, or it releases the magic smoke inside all electronics, LOL.

****

I don't want to have any chances of shorting either side of the circuit. I don't want any chance of interfering with the 24vac side. It takes just an extra pair of wires attached to anywhere in the thermostat circuit to detect when a thermostat is closed, without any impact on the system (50ma won't be noticed)

I am not expert at selecting capacitors. I've read it is common to specify at least 2x the expected voltage. For an electronics guru, this is a very normal and simple day to day thing. I'm hoping one will lend his expertise here so I don't make a mistake.

Edit to add: Once rectified, then the voltage would have to be adjusted from 24vdc down to 5vdc. The 24vac input is often 29-31vac, so it takes some caution, usually a voltage divider- or better, a regulator. When I re-read my post, I forgot this part.

Make sense?
Last edited by CoalisCoolxWarm on Mon Dec 26, 2016 5:53 pm, edited 3 times in total.
CoalisCoolxWarm
 
Stoker Coal Boiler: Keystoker KA-6
Hand Fed Coal Furnace: old Sears rebuilt, bituminous- offline as of winter 2014
Coal Size/Type: Anthracite Buckwheat
Other Heating: Oil Boiler

Re: Arduino - Smoothing capacitor for 24vac (thermostat)?

PostBy: CoalisCoolxWarm On: Mon Dec 26, 2016 5:43 pm

titleist1 wrote:I am an arduino newbie (only one halloween prop project)


Got a link? Or send me some pics? I always appreciate others' creations 8-)
CoalisCoolxWarm
 
Stoker Coal Boiler: Keystoker KA-6
Hand Fed Coal Furnace: old Sears rebuilt, bituminous- offline as of winter 2014
Coal Size/Type: Anthracite Buckwheat
Other Heating: Oil Boiler

Re: Arduino - Smoothing capacitor for 24vac (thermostat)?

PostBy: freetown fred On: Mon Dec 26, 2016 5:57 pm

Huh????????????????????????????????????????? :woot: :clap: toothy
freetown fred
 
Hand Fed Coal Stove: HITZER 50-93
Coal Size/Type: BLASCHAK Nut

Re: Arduino - Smoothing capacitor for 24vac (thermostat)?

PostBy: CoalisCoolxWarm On: Mon Dec 26, 2016 6:01 pm

freetown fred wrote:Huh????????????????????????????????????????? :woot: :clap: toothy


Pay attention, Fred, this will be on the test. toothy LOL.
CoalisCoolxWarm
 
Stoker Coal Boiler: Keystoker KA-6
Hand Fed Coal Furnace: old Sears rebuilt, bituminous- offline as of winter 2014
Coal Size/Type: Anthracite Buckwheat
Other Heating: Oil Boiler

Re: Arduino - Smoothing capacitor for 24vac (thermostat)?

PostBy: titleist1 On: Mon Dec 26, 2016 6:12 pm

You've probably already seen this on the arduino forum describing a circuit very much like you are doing. they indicate a 35V 100microF capacitor would work along with a couple resistors and a diode to fill in the zero crossing.

http://forum.arduino.cc/index.php?topic=20102.0

CoalisCoolxWarm wrote:Got a link? Or send me some pics?


I'll post a video when I get it done. Its a groundbreaker prop, the arduino is motion triggered and controls sound, lights and arm motions. I have the programming done, but will probably adjust the relay timing once I see it in action to maximize the creepy factor. I have the prop frame done but I am waiting on a couple fittings to connect up the solenoids to the cylinders for the movement. One thing I am scratching my head on now is how to package the boards and wiring, its just breadboarded and spread out on the workbench now.
titleist1
 
Hot Air Coal Stoker Stove: Harman Mag Stoker (old style) one in basement, one in workshop
Hand Fed Coal Stove: Harman Mark III on standby for long power outages
Coal Size/Type: Rice/Anthracite; Nut/Anthracite


Re: Arduino - Smoothing capacitor for 24vac (thermostat)?

PostBy: CoalisCoolxWarm On: Mon Dec 26, 2016 6:23 pm

titleist1 wrote:You've probably already seen this on the arduino forum describing a circuit very much like you are doing. they indicate a 35V 100microF capacitor would work along with a couple resistors and a diode to fill in the zero crossing.

http://forum.arduino.cc/index.php?topic=20102.0


Yeah, but that is rectified and then using the resistors as voltage divider. Okay as a one-off, limited use, but I'm looking to be more cautious.

I'll post a video when I get it done. Its a groundbreaker prop, the arduino is motion triggered and controls sound, lights and arm motions. I have the programming done, but will probably adjust the relay timing once I see it in action to maximize the creepy factor. I have the prop frame done but I am waiting on a couple fittings to connect up the solenoids to the cylinders for the movement. One thing I am scratching my head on now is how to package the boards and wiring, its just breadboarded and spread out on the workbench now.


Cool! Can't wait to see it!
Check your PM
CoalisCoolxWarm
 
Stoker Coal Boiler: Keystoker KA-6
Hand Fed Coal Furnace: old Sears rebuilt, bituminous- offline as of winter 2014
Coal Size/Type: Anthracite Buckwheat
Other Heating: Oil Boiler

Re: Arduino - Smoothing capacitor for 24vac (thermostat)?

PostBy: CoalisCoolxWarm On: Mon Dec 26, 2016 10:58 pm

I think the 5v side will be better to smooth the signal...
CoalisCoolxWarm
 
Stoker Coal Boiler: Keystoker KA-6
Hand Fed Coal Furnace: old Sears rebuilt, bituminous- offline as of winter 2014
Coal Size/Type: Anthracite Buckwheat
Other Heating: Oil Boiler

Re: Arduino - Smoothing capacitor for 24vac (thermostat)?

PostBy: Rick 386 On: Tue Dec 27, 2016 9:19 am

freetown fred wrote:Huh????????????????????????????????????????? :woot: :clap: toothy



Hey F-fred,

As soon as they get this ironed out, I'm sure they make one for your Hitzer !!!! :out:




Rick
Rick 386
 
Stoker Coal Boiler: AA 260 heating both sides of twin farmhouse
Hot Air Coal Stoker Stove: LL Hyfire II w/ coaltrol in garage
Coal Size/Type: Pea in AA 260, Rice in LL Hyfire II
Other Heating: Gas fired infared at work

Re: Arduino - Smoothing capacitor for 24vac (thermostat)?

PostBy: titleist1 On: Tue Dec 27, 2016 9:52 am

Rick 386 wrote:
freetown fred wrote:Huh????????????????????????????????????????? :woot: :clap: toothy



Hey F-fred,

As soon as they get this ironed out, I'm sure they make one for your Hitzer !!!! :out:


Rick


F-Fred's will be the super deluxe Freetown Hill version that not only controls the Hitzer but also warms up the plow truck!! :notworthy:
titleist1
 
Hot Air Coal Stoker Stove: Harman Mag Stoker (old style) one in basement, one in workshop
Hand Fed Coal Stove: Harman Mark III on standby for long power outages
Coal Size/Type: Rice/Anthracite; Nut/Anthracite

Re: Arduino - Smoothing capacitor for 24vac (thermostat)?

PostBy: BunkerdCaddis On: Tue Dec 27, 2016 10:03 am

If I my ask... I understand just enough of the words to follow the conversation. Is there a bigger reason that you are using an Arduino to control your heating system or just because you can? I know they use them in solar systems and the like but I wouldn't have thought there was much to gain in a basic hydronic setup? :gee:
BunkerdCaddis
 
Hand Fed Coal Boiler: New Yorker WC-90 or more likely a Van Wert VW85H [to be installed (soon, very soon)(well not as soon as I had anticipated]
Hand Fed Coal Stove: Waterford 105 pulling duty, Saey Hanover II getting dressed for the party
Coal Size/Type: pea/nut
Other Heating: oil fired hydronic

Re: Arduino - Smoothing capacitor for 24vac (thermostat)?

PostBy: KLook On: Tue Dec 27, 2016 10:19 am

Thank you Bunker.....how bout some mercury in a glass tube??? Anyone? :shock:
I love technology but this is way out there. But sounds fun if you have the time to play. No different then the solar users in here just playing and experimenting with them. No ROI needed.
I was able to follow along mostly, but your explanation was excellent.

Kevin
KLook
 
Stoker Coal Boiler: Harman VF 3000
Coal Size/Type: rice, bagged, Blaschak
Other Heating: Gas boiler backup/main
Stove/Furnace Model: VF 3000

Re: Arduino - Smoothing capacitor for 24vac (thermostat)?

PostBy: titleist1 On: Tue Dec 27, 2016 11:08 am

I think i remember its part of a STEM project for school.
titleist1
 
Hot Air Coal Stoker Stove: Harman Mag Stoker (old style) one in basement, one in workshop
Hand Fed Coal Stove: Harman Mark III on standby for long power outages
Coal Size/Type: Rice/Anthracite; Nut/Anthracite