Long press detection to trigger 555

Thread Starter

brianbrian

Joined Jan 5, 2024
4
Hey,
Im creating a circuit to mimic a sequence of button presses for an appliance using two 555 timers.
The idea is to implement it in parallel to the appliance switches so I dont distrupt the normal use of the appliance, which leaves the only way to trigger the 555 timer being detecting a long press of one of the buttons that is only momentarily pressed in normal operation.


The circuit sequence is-
Detect 3 second button hold>
trigger 555mono output for 60seconds >
powers 555astable output sequence until 555mono cuts power to chip


Can anyone offer advice or a simple circuit to detect if a button is held for 3 seconds?
I would hope to make dozens or more of these so Im looking for the simplest solution here. Id rather not have to program an IC for every unit.
(unless there was an IC that handles this without programming?)

I have put together a simple representation of the circuit, keeping(i think) the necessary information.


Kind regardsmimic modchip.png
 
Last edited:

AnalogKid

Joined Aug 1, 2013
11,021
It never is a good idea to power one 555 from the logic output of another 555. Better to use the 2nd 555's Reset input to control its output operation.

What is the pullup impedance of, or how much current is available from, the cpu pin? This sets how long the circuit takes to reset the 3-second timer after a button release.

Is the button *always* released before the 60-second timing period ends?

Consider adding reference designators to your drawing.

Overall, this is not a difficult circuit. I think everything can be done with one CD4093 quad Schmitt trigger NAND gate, replacing both 555's.

R-C input timer
60 second true monostable (3 gates)
Output oscillator (1 gate)

ak
 
Last edited:

Thread Starter

brianbrian

Joined Jan 5, 2024
4
It never is a good idea to power one 555 from the logic output of another 555. Better to use the 2nd 555's Reset input to control its output operation.

What is the pullup impedance of, or how much current is available from, the cpu pin? This sets how long the circuit takes to reset the 3-second timer after a button release.

Is the button *always* released before the 60-second timing period ends?

Consider adding reference designators to your drawing.

Overall, this is not a difficult circuit. I think everything can be done with one CD4093 quad Schmitt trigger NAND gate, replacing both 555's.

R-C input timer
60 second true monostable (3 gates)
Output oscillator (1 gate)

ak
Hey,
Thanks for the tip about using the reset pin to start the 2nd 555, I'll definitely do that.

For the available current on the CPU pin, I'm afraid I don't know and I don't know how to measure that.

With normal appliance operation the button will never be held for longer than a short momentary button press.

The CD4093 would be a cool way to neaten it up but unfortunately the oscillator cycle output needs to be 95%HIGH/5%LOW for my appication and the 4093 is 50%duty cycle according to the datasheet.
 

Hymie

Joined Mar 30, 2018
1,282
If the momentary switch is pressed for only 2.9 seconds do you want the system to immediately reset, or if it is pressed again within say 0.2 seconds, will the pressed times be added?

The above requirement might affect the circuit design.
 

AnalogKid

Joined Aug 1, 2013
11,021
Output oscillator frequency - ?

When the oscillator is off, should its output rest high or low?

What is the oscillator output driving?

ak
 

crutschow

Joined Mar 14, 2008
34,386
Below is the LTspice sim of a 60s, 555 one-shot circuit that requires the PB to be pressed for a least 3s before it triggers.
But it may not work for you, depending on your answers to post #5.

1704643825777.png
 

sghioto

Joined Dec 31, 2017
5,388
If the question in post #5 is an issue adding Q1 and Q2 will rapidly recharge C2 when the button is released.
1704655552500.png
 
Last edited:

AnalogKid

Joined Aug 1, 2013
11,021
First pass at an all-NAND-gate solution.

R1-C1 set the startup delay. Rx is an assumed value for the uC internal pull-up resistance. If the actual value is much lower, such as 100K, that affects the timer; R1 and C1 would have to be adjusted.

R2-C2 set the 1-minute on time.

R3-C3 set the oscillator output high period. Absent information, I made up some values for the oscillator components.

D3 and R4 make the low period much shorter. Adjust R4 to set the overall duty cycle.

U1C inverts the oscillator output so it rests in the low state when disabled. A high resting state is available at pin 11.

I borrowed D1 from crutschow's post #7.

Most of the component values can be adjusted to match your inventory. For example, since most people have more resistors than capacitors, C1 and C2 can be the same value if R1 and R2 are adjusted. C4 is the power supply decoupling capacitor for U1. It can be whatever C3 turns out to be if you change the oscillator components.

UPDATE: Added diode D2 to the monostable shorten the C2 reset time. Changed refdes of the oscillator diode.

ak


Timed-Osc-Delay-1-c.gif
 
Last edited:

MisterBill2

Joined Jan 23, 2018
18,388
The simple scheme is to use a CD4098 dual monostable with the button triggering the first timer that has a delay of the three seconds, and at the same time enables the second monostable while the button is pressed. Then when the first times out, if the sccond is still enabled by the button being pressed, an output pulse is generated. one IC and only 2 resistors and two capacitors. And it can operate on any voltage from 4 volts up to 15 volts.
 

AnalogKid

Joined Aug 1, 2013
11,021
one IC and only 2 resistors and two capacitors. And it can operate on any voltage from 4 volts up to 15 volts.

One IC
2 resistors
2 capacitors
Optional 1 diode
4 V - 15 V operation

and

The same IC forms the output oscillator, plus its control gating, plus both normal and inverted pulse trains.

ak
 
Last edited:

Thread Starter

brianbrian

Joined Jan 5, 2024
4
If the momentary switch is pressed for only 2.9 seconds do you want the system to immediately reset, or if it is pressed again within say 0.2 seconds, will the pressed times be added?

The above requirement might affect the circuit design.
A reset would be the better option tbh but not totally vital to application.
the 2nd 555 timer is driving a series of pulses to the cpu to mimic single button presses at 5 second periods on another push button circuit, for about a 60 second length.
 

Thread Starter

brianbrian

Joined Jan 5, 2024
4
The simple scheme is to use a CD4098 dual monostable with the button triggering the first timer that has a delay of the three seconds, and at the same time enables the second monostable while the button is pressed. Then when the first times out, if the sccond is still enabled by the button being pressed, an output pulse is generated. one IC and only 2 resistors and two capacitors. And it can operate on any voltage from 4 volts up to 15 volts.

This is an interesting approach, it does leave the oscillator to be triggered if the user pressed the button at 0 seconds and 3 seconds by chance triggering the sequence. normally users will only press buttons once every 30 seconds or so but rarely they may press it in such a way that may trigger the sequence. which brings me to my next puzzle- how to abort the oscillator sequence if the user disires. ideally with the same button? or perhaps pressing another button will always set the oscillator to not run(all buttons follow the same sink 5v to ground) . like in a 555 example, pressing another button on the appliance will always ground the reset pin.
 

AnalogKid

Joined Aug 1, 2013
11,021
which brings me to my next puzzle- how to abort the oscillator sequence if the user disires. ideally with the same button?
This requires a toggle flipflop. There are many ways to do this, from two transistors to 1/2 of a dual ff IC.

The circuit in #11 intentionally ignores all button activity after the first 3 seconds. That initial 3-second timer is semi-retriggerable; if you release the button at 2 seconds, C1 begins to discharge through Rx, but not rapidly. The output of U1A never changed state, so D1 does not perform the rapid reset. Of course there is a way around this if it is a problem.

Changing the 60-second timer from a true monostable to one that is retriggerable or resetable is mostly rearranging the parts that already are in the circuit, What's left is the toggle circuit. A system with a separate abort button definitely would be less complex.

Please clarify - is it ok for the oscillator output to sit in the high state when not oscillating?

ak
 

AnalogKid

Joined Aug 1, 2013
11,021
First pass at a start-stop version. Aside from the new switch and its conditioning, the net change from #11 is only 1 diode (D5). I think this captures everything in #16 and#17 except a true toggle function.

Start and Stop now control a Set-Reset flipflop. When set by the start button being held down for at least 3 seconds, the U1A output goes high. This reverse-biases D2 and lets C2 charge up through R2. After 60 seconds, the voltage across C2 is high enough to change the inputs of U1D and reset the circuit through D5.

If the Stop button is pressed during the 60 second period, the U1A output goes low. This disables the oscillator immediately and resets timing capacitor C2 through diode D2.

There now are five timers in the circuit:

R1-C1 - 3-second input discriminator
R2-C2 - 60-second output enable
R3-C3 - Oscillator output high period
R4-C3 - Oscillator output low period
R5-C5 - Power-On Reset (POR) - assures that the circuit powers up in the off state.

D1 - performs a rapid reset of the input timer
D2 - performs a rapid reset of the output timer
D3 - separates oscillator high and low periods
D5 - resets the circuit after 60 seconds by pulling the Stop input low

If this looks like a lot of parts, that's because it is doing a lot of stuff. An equivalent circuit using two 555's would not have fewer parts. The 555's internal Discharge transistor would eliminate D2 and D3. However, you still would need a flipflop circuit (which could be a third 555) and a way for the end of the 60-second timer to reset everything.

ak


Timed-Osc-Delay-2-c.gif
 
Last edited:

AnalogKid

Joined Aug 1, 2013
11,021
Based on application information in the National Semiconductor datasheet for the CD4093, the oscillator high output period in a 5 V circuit is approx. 0.19 x R3 x C3. A 5-second period would be 8.08 x R x C. For example, this could be done with a 10 uF capacitor and 750 K or 820 K resistor. A tighter fit would be an 806 K, 1% resistor, but the oscillator transition voltage levels are not tightly controlled and electrolytic capacitors are not very precise so there probably is not much advantage.

The low output period is determined by the parallel combination of R3 and R4 - approximately. D3 introduces a DC offset into the C3 discharge path, and this will lengthen the output low period by approx. 10%. However, R3 is so much larger than R4 that it has almost no effect on the low period, and can be removed from the calculation. For a 95 / 5 output waveform, start with R4 as 5% of the value of R3.

A possible starting point is:

R3 =750 K
R4 = 36 K
C3 = 10 uF

ak

https://www.allaboutcircuits.com/technical-articles/how-to-design-schmitt-trigger-oscillators/

CD40106DS_OscEq.png
 
Last edited:
Top