Reset – How to Trigger Reset with Long Button Press


I am trying to make a button control on/off and reset all in one, but I can't quite get my head around how to design it.

It should basically function like a PC power button. If short press it's either on or off, depending on state, and a long press is the reset that works when something completely locks up the computer. The on/off is easy as that's software controlled, but the reset has to be in hardware somehow as it has to ALWAYS work, no matter the state of the software or MCU.

The reset functionality should kick in after a long press of about 5~10 s. Once the reset signal goes low it should stay low for >10ms. How to do this?

I can find dedicated IC's that can set a signal low for x ms, which would work, but how do I trigger them in a good way? RC and then a comperator to trigger at a set voltage or…? And how do I avoid triggering the reset when starting up if using the RC approach?

Any help would be appriciated.

Best Answer

You could use a RC delay circuit.

A simple one is made out of a resistor and a capacitor. For example, charge the capacitor, attached to ground, through a pull-up resistor R1. Then discharge through another resistor R2 and the "long-press" reset button to the ground. The trick is to calculate the values of C, R1 and R2 to make the timings right, so that the capacitor slowly discharges to the digital zero threshold. Then the signal at the junction could be used for (inverted) reset signal.

You could add an inverter to make the reset signal more robust.

Here is an online calculator to estimate the delays: