How to replace momentary button with timed circuit - Page 1
Forum section: electronics / beginners

author: pwnell
author_rank: Regular Contributor
timestamp: August 27, 2022, 11:55:31 pm
content: I have a momentary button that causes my sit/stand desk to raise/lower. I need to keep it depressed for about 10 seconds to raise or lower fully.How can I replace it with a basic analogue circuit running off 5V that can simulate a button press for 10 seconds? The existing button has 5V across its terminals when not pressed, and just shorts the two terminals. So I want to have another momentary button that I press once briefly, and it should short the existing button’s terminals for 10 seconds simulating a 10 second button press.I looked at circuits using capacitor, resistance and an NPN transistor but I am not sure if it is accurate enough. I need it to be accurate between 8 - 12 seconds and create a hard short and hard open, but preferably not using relays as I need the circuit to be small.Any pointers? I also looked at 555 timers but am not sure how I would hook it up to the existing circuit. Just need to be pointed in the right direction then I can do the research. Right now I feel a bit lost.

author: themadhippy
author_rank: Super Contributor
timestamp: August 28, 2022, 12:54:24 am
content: Quoterelays dont have to be big, for example these aint much bigger than a 555https://www.te.com/commerce/DocumentDelivery/DDEController?Action=showdoc&DocId=Data+Sheet%7F108-98001%7FZ%7Fpdf%7FEnglish%7FENG_DS_108-98001_Z.pdf%7FN-A

author: ledtester
author_rank: Super Contributor
timestamp: August 28, 2022, 02:07:08 am
content: Quote from: pwnell on August 27, 2022, 11:55:31 pmLook up "monostable multivibrator". Here is one built from a 555:https://www.basicselectronics.com/monostable-multivibrator/QuotePerhaps it looked like circuit 2 on this page:https://www.circuitsdiy.com/mosfet-delay-timer-ciruit/#Circuit_2_Turn_off_after_delay_with_MOSFETOne issue with this approach is that the programmed delay only starts when the switch is released. So if you hold the switch down for, say, 3 seconds before releasing it you'll be adding 3 seconds to the RC-programmed time.

author: pwnell
author_rank: Regular Contributor
timestamp: August 28, 2022, 09:00:58 pm
content: Thanks for the help. I ended up building a simple monostable multivibrator using a relay as the output trigger and it works well, after I picked the relevant R & C parts for my time constant.I have one more challenge. I need the button to toggle between two states. If I press it once, it should trigger the relay as discussed. This part works. But I want to have it behave differently when I press it again. The second press should trigger the same logic but on a different relay. The third press should trigger the first relay again etc. Reason being the sit/stand desk has two switches - one for raising and one for lowering of the desk. To keep the interface simple I'd like to have a single button toggle alternatively one of two relays.So I had built this latch circuit:It basically uses another 555 and if you press the button once, it latches the output high. Press it again and it latches the output low. This I thought I could combine with two OR gates, taking the switch as one input to each (pulling the input low) and the output of the latch to one OR gate and the NOT output of the latch to the other OR gate. This would give me a low on gate 1 if the switch is depressed AND the latch is high. If I press the switch again it would give me a low on gate 2. If I build a second monostable multivibrator, feeding the output of the first OR gate to Trigger on the 555, and the output of the second OR gate to Trigger on the second 555, I could get it theoretically to alternate between triggering two different relays. This however seem very complicated.Another idea I had was to use the 555 latch circuit linked above, and have its output drive a relay with both NC and NO contacts. I then hook up two relays on the output of the monostable multivibrator, but instead of hooking both relays' coils to Vcc, I hook them up via the NO and NC outputs of the relay on the latch circuit. Therefore one or the other will engage depending on the state of the latch. This seems simpler at the cost of an extra relay), but my worry is that half of the time one relay will always be energized, seeming to waste energy.Any ideas?

author: ledtester
author_rank: Super Contributor
timestamp: August 28, 2022, 11:47:22 pm
content: Quote from: pwnell on August 28, 2022, 09:00:58 pmA schematic would help here.Your requirements are getting to the point where you should consider using a microcontroller.For a small form factor module, have a look at the Arduino "Beetle" -- a ATmega32U4 running at 5V and available through Digikey:https://www.digikey.com/en/products/detail/dfrobot/DFR0282/6588438You can, of course, develop the firmware on a regular size Arduino module (Uno / Nano).

author: pwnell
author_rank: Regular Contributor
timestamp: August 29, 2022, 01:53:03 am
content: Thing is I am really good at programming and have implemented many arduino projects thus far. Really want the challenge of improving my electronics knowledge though. I have studied electrical engineering many moons ago so I want to rekindle my love for electronics.I will create a schematic and post it here.Thanks for the support.

author: pwnell
author_rank: Regular Contributor
timestamp: August 31, 2022, 10:47:56 pm
content: Finally gotten around to draw the schematic. This is one way I thought it might work. I have the latch as the first circuit - so you press the push button which is attached to the latch that generates alternatively a 5V and a 0V signal as output on pin 3. This goes through a basic edge detector and invertor that produces two signals - a pulse when the output goes to 5V, and a pulse when the output goes low, as two separate outputs. I connect each of these outputs to their own monostable multivibrator circuits which drives separate relays, which are connected to the raise and lower buttons on the sit/stand desk control.Idea is you press the button once, the latch changes state to 1, and only the topmost circuit triggers a 13 second pulse on the relay raising the desk. Press the button again and the latch changes to 0, which triggers the bottom circuit that will energise the bottom relay for 13 seconds, lowering the desk.Would this work or did I make a major blunder? Schematic attached.

author: ledtester
author_rank: Super Contributor
timestamp: September 02, 2022, 03:00:15 pm
content: Question: What does the desk controller do if you press the raise and lower switch at the same time? Or if you press one while the other is still pressed down?Here is how it appears your circuit operates...The user operates a switch which will toggles a flip-flop. Then you have edge detectors which detect the rising and falling edges of the flip-flop's output. Each edge detector triggers a monostable to activate a relay for a certain amount of time -- one closes the "up" switch and the other the "down" switch.This Ray Marston article has some other edge detector circuits based on Schmitt triggers you might be interested in:http://www.n5dux.com/ham/files/pdf/Working%20With%20Monostable%20Multivibrators.pdfAnother resource for design tips with digital logic ICs is Don Lancaster's CMOS Cookbook -- you can find a copy in the Internet Archive library.As an optimization, I think it might be possible to have the edge detectors generate the long pulse to the relays directly - bypassing the need for the monostables.Another thing to think about is what happens on power on/off. On power on you want to initialize the state of the FF but without generating any spurious signals on the output.

author: pwnell
author_rank: Regular Contributor
timestamp: September 02, 2022, 04:00:16 pm
content: That is a good observation. It cancels the action. So if I press up, and the desk raises, when I press down it stops. I have to press again to make it resume.

author: ledtester
author_rank: Super Contributor
timestamp: September 02, 2022, 05:10:44 pm
content: Here are some discrete designs which use Schmitt trigger edge detectors:Version 1:https://www.eevblog.com/forum/projects/recognize-tap-and-tap-hold-with-discrete-components-to-control-a/msg4186486/#msg4186486Version 3:

author: ledtester
author_rank: Super Contributor
timestamp: September 03, 2022, 01:03:58 pm
content: Quote from: pwnell on August 27, 2022, 11:55:31 pmYou might be interested in this:https://www.tindie.com/products/tjhorner/upsy-desky/github files:https://github.com/tjhorner/upsy-deskyQuote

author: pwnell
author_rank: Regular Contributor
timestamp: September 03, 2022, 02:55:05 pm
content: Oh I can probably just get this:https://www.hermanmiller.com/resources/images/renew-sit-to-stand-table-programmable-control/0fc76099-b097-45f8-84b2-2b18ea79099e/but I wanted to build this myself as a learning experience. I have changed my design a bit - it is more optimised and has the added benefit that if I press the button again it will interrupt the output and switch states to the other relay.Thanks for the links - really useful stuff.