Hardware anti-cycle - Page 1
Forum section: electronics / beginners

author: paulca
author_rank: Super Contributor
timestamp: December 15, 2017, 11:05:22 am
content: I was doing a little planning for connecting my home heating controller to the boiler (xmas holiday project).I am a software engineer, so it might surprise you (or not) that I would like the implement the protection mechanics in hardware.What I do not want is a software failure to cycle the boiler on, off, on, off, on, off, 10 times a second repeatedly. The boiler of course has it's own anti-cycle device, so if you switch it off and back on again it will not actually start/ignite for 1 minute.I want to do the same on my relay controller.I'm sure there is something I can do with a basic RC circuit and an NPN transistor or a 555.The idea I think would be to switch the control signal to the relay via the NPN, but put an RC on the base with a 1 minute time constant. Thus regardless of what the control signal is from the Raspberry PI (in this case) the NPN will be switched off and it will not fire the relay.When the circuit is switched off the RC circuit would be momentarily discharged, then begin charging once more. Only when it is fully charged is the control signal connected back to the relay.I can probably work something out, but as this is probably a very common circuit I thought I would ask if there are any clever ways to do this "off the shelf".Basic requirements:Allow the control signal to set the relay (opto-decoupled 5V coil, 240V 10A) OFF without any restrictions.Do not allow the relay coil to be re-energized within 1 minute of it being switched off.If the relay signal is set ON and kept ON after 1 minute it will energize the coil and switch on.If the relay has been OFF for > 1 minute then it should be allowed to switch ON instantly.

author: Rerouter
author_rank: Super Contributor
timestamp: December 15, 2017, 11:15:08 am
content: RC clock, driving a clock divider chip, this acts as your timeout window.When he reaches your timeout, switch a logic gate to stop it counting,Then use an AND gate of the timeout and the rasp to allow a switch on, on switch off, reset the counter, which lets it begin counting again.Bit tired tonight, but i can flesh out the idea better tommorow if you wish, should only need 2 logic chips.

author: paulca
author_rank: Super Contributor
timestamp: December 15, 2017, 11:30:03 am
content: Interesting digital approach. I wasn't expecting that.What about an SR latch with the set side fed from an AND gate. I1 is the control signal, I2 is the RC circuit.The !Q (Reset) output of the latch could switch the RC circuit to charge. The Q (Set) output will discharge the capacitor via a small resistor to ground.As the 555 timer is basically an RC circuit charge/discharge controller and an SR latch I wonder if I could tempt a 555 to do this entirely, with an external AND gate.I googled and found these devices exist but the ones I found are all on industrial controller manufacturer pages and expensive.

author: Benta
author_rank: Super Contributor
timestamp: December 15, 2017, 02:50:08 pm
content: When you're looking at RC solutions that go to seconds, they get unwieldly, imprecise and prone to all kinds of leakage phenomena.Much better to work at a higher clock frequency, say 100 kHz, and divide down using digital logic/counters.

author: paulca
author_rank: Super Contributor
timestamp: December 16, 2017, 10:19:49 am
content: Quote from: Benta on December 15, 2017, 02:50:08 pmHmm. I see what you are saying, but I'm not really interested in accuracy. If I do the RC time constant calculation for 60 seconds and I get anywhere close to +-10 seconds that would be fine.I had a fridge controller for homebrew using a Raspberry PI and 240V relay. The temperature probe failed to register on i2c and the software, untested for that case, started to oscilate the relay about 5 times a second. The fridge didn't like this, but it survived as I was present to switch things off quickly. It 'could' have eventually damaged the fridge or potentially tripped my mains trip.EDIT: I did then write a C++ wrapping class around the relay which had a timer preventing it being switched on within 30 seconds of being switched off, but for some reason I want to do it in hardware instead this time, so no matter what happens with the software it is physically impossible to short cycle it.

author: Rerouter
author_rank: Super Contributor
timestamp: December 16, 2017, 11:03:22 am
content: Its not accuracy, its more to do with tolerance to noise, after all you will be switching many amps,to get an RC on the time scale of 60 seconds, either needs a very big resistance, which is susceptible to noise, or a very large capacitance which is generally price or size constrained out.If you wanted to go with a single RC, you could accomplish it with a dual op amp. the RC charges off its supply, the first op amp when the threshold is reached switches high, you would then AND this via a transistor or mosfet, to combine with the Pi.the other op amp acts as a differentiator, when the pi signal falls low, it switches a mosfet which drains the RC back to 0, enforcing the timeoutI will again stress that such a circuit can be sensitive to noise, to keep the RC part well shielded.

author: paulca
author_rank: Super Contributor
timestamp: December 16, 2017, 12:01:04 pm
content: Quote from: Rerouter on December 16, 2017, 11:03:22 amI'm only switching the boiler's external control line. It's a gas boiler, not an electric one. The manual outlines how to wire it for external control. It seems to only require that the external device is capable of 240V switching, it doesn't mention current. Looking at the existing timer control thing I doubt it could handle more than a few 100mA.My relay will just replace the external control box in their installation guide. It's just 240V in and 240V out.