Simulate push button switch using relay

Thread Starter

hw_user

Joined Nov 22, 2022
5
There are some devices that turn on using a push button switch. That is the contact made when the button is pushed and breaks once the button is released. I like to control this type of device using an electric timer. I can easily make a relay to pick when the timer turns on electricity (110 volt). But I don't know how to make it drop immediately or with some controllable delay to simulate someone using a push-button switch.
We all have 5V 1 or 2 amp adaptors from old cell phones. A circuit using 5V may be simpler and cheaper (no need to buy new components).
If there are other electronics that can be used instead of a relay, I am open to any suggestions.
 

SamR

Joined Mar 19, 2019
5,040
Let me see if I have this right. Pushbutton activates a timer which turns 110V on and off? What is the current of the 110V (AC?)? Using your 5V DC wall wart for control power, 555 timer, and a 5VDC signal relay might do it depending what the current is on the 110V (AC?). The current cannot exceed the capability of the signal relay but 10A should be doable. Draw up a sketch so we won't be guessing just what it is you want to do.
 

Tonyr1084

Joined Sep 24, 2015
7,899
Depending on what voltage you choose and which coil you get; this circuit will energize the relay for only as long as it takes for the cap to charge up triggering the relay until charged. The resistor needs to be large enough so that the coil doesn't remain active once triggered but small enough to allow somewhat rapid retriggering of the relay.

1669219802077.png
When you push and hold the button the cap will begin to charge, drawing a fair amount of current. That current (and proper voltage) will close the relay until the cap charges enough to drop the current below the Hold Threshold of the coil. If you're using an electronic signal to trigger the relay then that signal source needs to be able to supply sufficient current to drive the relay. The diode becomes even more important because it prevents back feeding of a high voltage spike which can damage your electronics. The relay contacts need to be rated to handle the amount and type of voltage AND current.
 

MisterBill2

Joined Jan 23, 2018
18,477
The circuit proposed by Tony in post #3 has the correct concept, but it is over complicated. Your timer switching on the AC mains power to a small five volt supply will not require an external button to switch the power to the relay coil. The relay will energize until the capacitor is charged enough so that the charging current will fall below the holding current for the relay, at which time it will release. This simulates releasing the button. The diode is not required because after the capacitor is fully charged the current through the relay coil will be zero, or close to it. The resistor across the cap is needed to assure that it discharges, since the only other discharge paths are leakage and the resistance of the unseen 5 volt supply. I have not tried this with five volts but it works very well with 12 volts and an n automotive horn relay.
 

Tonyr1084

Joined Sep 24, 2015
7,899
The circuit proposed by Tony in post #3 has the correct concept, but it is over complicated
Everything but the diode?

I show a push button to simulate a momentary (or long term) press. I understand the TS wants to have the relay controlled by some electronics means, which is why I included the diode. Upon further reflection, the diode may be unnecessary, but I'd still be concerned of a back EMF shooting through the cap and back into the electronic device the TS chooses to control the relay with. The diode is extremely cheap insurance. Using it or not is a matter of choice. Me? I'd use it as insurance that I don't damage the electronics. Remember, the collapsing field of an inductor has a pretty big kick back. Even if the electronic device controlling the relay has a pulse of one or two minutes long, when it shuts the power off - remember, the resistor conducts current both ways - that drop in voltage can cause an inductive kickback. Whether it can damage a microprocessor or other electronic device is an unknown. Since the TS hasn't given us more detail my drawing is basic in concept with very little information. The fact that I show ranges in capacitance and resistance is to generally cover what the TS might do. In the end the engineering of the circuit requires knowing all parameters of the components. I didn't even indicate what diode to use.

I respect your opinion but I don't see my circuit as being overly complex. Power to the relay comes from some unknown source. The cap charges. During that charge time the relay, assuming it's the correct inductance and the farad rating of the cap work well together, the relay will close, acting like a push button closure between the C and the NO contacts. When the cap charges sufficiently the current will drop and the relay will fail to hold the armature down. Even though the current has dropped to near zero, the voltage is still there. When the voltage goes away that's when BEMF occurs. C'mon Bill, you know this.
 

Thread Starter

hw_user

Joined Nov 22, 2022
5
Thanks, Tony and MisterBill. The circuit is simple enough. I have two devices that I want to use the circuit on.
The first one is my garage door. It uses a push button. Push it once it opens. Push it again it closes. I want to control it over the internet. I have wifi smart plugs which I can switch on or off over the internet. Using your circuit and an adapter to get the proper DC voltage, I will be able to do what I want. I think a small capacitor will make the relay drop quickly (say within 0.5 seconds). I found a 12V relay and a 12 V DC adaptor. Any suggestion on the capacitor and resistor value?
The second device is similar to a computer. If I push the power button once, it power on. If I push the button again when it is already on, it power off. If I push and hold the button for 3 seconds or more, it will perform some reset action. For the power on and power off, I think I can build one the same way as the one for the garage door. I will need a separate one for the 3-second hold which requires a bigger capacitor.
 

Tonyr1084

Joined Sep 24, 2015
7,899
Part of the equation is the coil inductance. Similar to resistance, it will conduct current when the power first comes on. Depending on its inductance, the cap will charge at varying rate, dependent on the inductance. Since you're talking about an event that will occur once in a while, not every five seconds or so, a large resistor will be sufficient to bleed down the charge in the cap. It will also prevent the relay from latching and remaining latched the whole time.

I have a bunch of 12V relays on my workbench. They each behave differently when powered through a capacitor. Best advice I can think to give you is to set up a test experiment on your workbench. Get your 12V PS and a random capacitor, something fairly high in micro-farads, maybe 4700µF and power your relay. Listen for the clicks to tell you when it energized and dropped out. If the timespan is too long for your liking go with a smaller cap. I'd imagine a 10KΩ resistor will do an excellent job of draining off the cap when power is shut down, since it's not likely you'll be opening and closing the door every 10 seconds. Not even every 10 minutes. Probably not for an hour or more. So 10KΩ might be fine. But testing will prove out what works best to your liking.

Same is true for the computer. But shutting off the computer may be better served by shutting power off instead of rigging up a relay to hold the button for longer than 3 seconds. For that you'd probably need some significant capacitance. Without testing I'd only be guessing. So build a test on your bench. Doesn't need to be an elaborate build, just a relay, some jumpers and a power supply. That'll get you going for how short the relay holds. But after each test you'll need to drain the cap before you can repeat the experiment. Then grab some resistors and experiment what current is needed to hold the armature locked down.
 

Thread Starter

hw_user

Joined Nov 22, 2022
5
Part of the equation is the coil inductance. Similar to resistance, it will conduct current when the power first comes on. Depending on its inductance, the cap will charge at varying rate, dependent on the inductance. Since you're talking about an event that will occur once in a while, not every five seconds or so, a large resistor will be sufficient to bleed down the charge in the cap. It will also prevent the relay from latching and remaining latched the whole time.

I have a bunch of 12V relays on my workbench. They each behave differently when powered through a capacitor. Best advice I can think to give you is to set up a test experiment on your workbench. Get your 12V PS and a random capacitor, something fairly high in micro-farads, maybe 4700µF and power your relay. Listen for the clicks to tell you when it energized and dropped out. If the timespan is too long for your liking go with a smaller cap. I'd imagine a 10KΩ resistor will do an excellent job of draining off the cap when power is shut down, since it's not likely you'll be opening and closing the door every 10 seconds. Not even every 10 minutes. Probably not for an hour or more. So 10KΩ might be fine. But testing will prove out what works best to your liking.

Same is true for the computer. But shutting off the computer may be better served by shutting power off instead of rigging up a relay to hold the button for longer than 3 seconds. For that you'd probably need some significant capacitance. Without testing I'd only be guessing. So build a test on your bench. Doesn't need to be an elaborate build, just a relay, some jumpers and a power supply. That'll get you going for how short the relay holds. But after each test you'll need to drain the cap before you can repeat the experiment. Then grab some resistors and experiment what current is needed to hold the armature locked down.
Thanks, will experiment with it as suggested.
 

MisterBill2

Joined Jan 23, 2018
18,477
Thanks, Tony and MisterBill. The circuit is simple enough. I have two devices that I want to use the circuit on.
The first one is my garage door. It uses a push button. Push it once it opens. Push it again it closes. I want to control it over the internet. I have wifi smart plugs which I can switch on or off over the internet. Using your circuit and an adapter to get the proper DC voltage, I will be able to do what I want. I think a small capacitor will make the relay drop quickly (say within 0.5 seconds). I found a 12V relay and a 12 V DC adaptor. Any suggestion on the capacitor and resistor value?
The second device is similar to a computer. If I push the power button once, it power on. If I push the button again when it is already on, it power off. If I push and hold the button for 3 seconds or more, it will perform some reset action. For the power on and power off, I think I can build one the same way as the one for the garage door. I will need a separate one for the 3-second hold which requires a bigger capacitor.
I am not sure that my scheme would be satisfactory for a 3 second contact closure. It has worked for several folks on this forum over a few years, but only duplicating the quick press and release of a button.
 

Tonyr1084

Joined Sep 24, 2015
7,899
I think a small capacitor will make the relay drop quickly (say within 0.5 seconds).
That much is true. However, for a 3 second push of a button simulator relay - you'll need a very small relay with high impedance and a very very large capacitor. Making that work out will be very difficult and likely excessively time consuming. If I were going to take an approach to energize a relay for 3 (or a little longer) seconds, I'd opt for an oscillator and counter, and likely a Double D Type Flip Flop.

A slow square wave (by that I mean something like 2 Hertz generated by a 555 timer) feeding the DDFF producing a 1Hz pulse and a decade counter (CD4017 for instance). Choose the appropriate output and run that back to the second DDFF. DDFF's have two flip flops, that's why they're called Double D Flip Flops.

The first FF divides 2Hz by 2 giving you 1Hz (one pulse per second). The second FF /Q output (not-Q) holds high upon energizing, holding your relay closed for a set period of time. The 4017 counts three steps advancing the counter from zero to #2 output. When that goes high the second FF switches and toggles the relay off. If that's too short you can choose output #3 or 4 or whatever works best.

Using a simple capacitor to hold a relay active for three seconds will be highly inaccurate, not that accuracy is important, but the point is that it could fail to hold the relay as long as you like. Adding resistance to slow down the charge time can cause the relay to fail to click in, so a resistor isn't going to make a significant enough delay. If you don't want to go with two chips you can get away with an op-amp or comparator. Using a fixed resistance and a variable resistance for a reference (adjustable) and a resistor/capacitor (RC) you can create a saw wave that can take several seconds to charge up. Using the adjustment you can select the reference point where the comparator switches from a low to a high. That in turn can drive a small transistor that drives your relay. The relay in this case will need to be wired C and NO contacts. When power comes on the relay is energized and makes the simulated "Push" button turn the power off. When you get around to shutting off the power the relay will fall back to being normally open and the computer can be restarted whenever you wish. A high value resistance across the cap will drain the cap when power shuts off and the whole thing will be ready to go again.
 

Tonyr1084

Joined Sep 24, 2015
7,899
It may not be worth the effort to implement it.
I agree. It might not be worth it. However, and before I added onto my garage I had a system where a timer would energize for one minute at various times of the day. If the garage door was open the system would automatically close the door. It was not possible for it to open the door. It consisted of a programmable clock timer, a power supply, two microswitches and two relays. At a given time if the switches were both actuated when the timer came on then a relay would activate to close the door. Once the door was going down the second relay would cancel the first. The door would still close. If the switches were not actuated there would be no activation of the relays. This didn't require the ability to connect to the internet to activate and close (or open) the garage door. My wife would sometimes leave for work and forget to close the door. If she did then the timer would typically activate and close the door about 15 minutes after she normally left. If she left late there was another set time an hour after her normal departure. There were also times when I'd go to bed and forget to close the door. The program could hold up to twenty different times and could activate for as short as one minute. My door would always be closed unless I wanted it open. And if I wanted it open and have it stay open through those close times I'd just block the safety beam. The door might begin to close but as soon as the second switch opened and activated the second relay the door would return to full open and stay there until the next close command time.

Here - here's a drawing of that circuit I did so long ago: (assume the door is open when the timer comes on)
1669564457420.png
You (in my case) don't need to modify the wall switch. I have a couple door bell switches that operate both garage doors (I have two doors). Basically you're just jumping between the two wires that connect to the wall switch. You can wire in wherever is most convenient for you.
 
Last edited:

MisterBill2

Joined Jan 23, 2018
18,477
For that "much longer" contact closure the simple approach will be to Have the charging capacitor drive the gate of a suitable NPN darlington transistor to operate the relay. The same supply that charges the capacitor can power the relay, so that the function will automaticly disable when the command is reset.
 
Top