25
\$\begingroup\$

I used a "factory reset button" a few days ago, and wondered how they make it activate only after a few seconds. Are there standard solutions to that? My best idea was to use something analogous to an RL low pass filter that takes a while to set output to logic high.

enter image description here

\$\endgroup\$
6
  • 18
    \$\begingroup\$ You activate the switch which applies power to a motor which lifts a plunger that eventually breaks a microswitch. Don't laugh; this type of method is done on HV switchgear in some applications. It would make a perfectly fine reset mechanism. \$\endgroup\$
    – Andy aka
    Commented Aug 3, 2022 at 6:52
  • \$\begingroup\$ Also see devices like the TPS342x. \$\endgroup\$
    – CL.
    Commented Aug 3, 2022 at 7:16
  • 5
    \$\begingroup\$ Once I did it with an RC delay. If you held down the power button for 10 seconds it would reset the processor (which otherwise was always on and never got reset). The delay was not very precise. But it was long enough to not be tripped by accident. \$\endgroup\$
    – user57037
    Commented Aug 3, 2022 at 8:44
  • 2
    \$\begingroup\$ BipedalJoe, You can also look here to see yet another process for achieving a similar idea without using an MCU (which is the obvious choice for DIY) or a custom IC, which also exist as boutique. \$\endgroup\$
    – jonk
    Commented Aug 3, 2022 at 9:01
  • 6
    \$\begingroup\$ L/R time constants of seconds are impractical. \$\endgroup\$
    – John Doty
    Commented Aug 3, 2022 at 19:42

4 Answers 4

39
\$\begingroup\$

It is usually done in software. The microprocessor in the device detects that the button is pressed, and waits five seconds to see if it stays pressed. If the button stays pressed long enough, then the reset is carried out.

\$\endgroup\$
9
  • 11
    \$\begingroup\$ of course this only works if the microprocessor is actually running that software. If it crashes hard enough to need a factory reset, that may no longer be true. Sometimes an independent system (either dedicated HW or a second really cheap CPU) is used. \$\endgroup\$
    – user16324
    Commented Aug 3, 2022 at 11:25
  • 11
    \$\begingroup\$ RC delay is also fairly common on battery powered devices with a non removable battery. Otherwise you could crash the device and be unable to reset until the battery ran down. This can be quite handy, I once set the PLL wrong on a device with weeks of standby time, disabling the CPU and the USB programmer. Fortunately the RC reset didn't need a clock and I was able to recover without desoldering a battery. \$\endgroup\$ Commented Aug 3, 2022 at 13:07
  • 20
    \$\begingroup\$ In many kinds of devices, the long button push is handled in software running in a small microcontroller separate from the main processor, to ensure that a crash in the main CPU won't leave a device in a state that can only be recovered by waiting for the batteries to drain. \$\endgroup\$
    – supercat
    Commented Aug 3, 2022 at 15:25
  • 9
    \$\begingroup\$ @user_1818839 often the leading edge of the push on the reset button does a normal CPU reset (to avoid this issue). On reset the CPU then waits (in code) until either the reset button is released or 5 seconds has passed, and if the latter does a factory reset. \$\endgroup\$
    – abligh
    Commented Aug 4, 2022 at 6:31
  • 2
    \$\begingroup\$ @DerekD: One could use something like a ATTINY9-TS8R, which Digikey has for $0.39 each in reels of 4,500, but there are probably some parts that could do that task for a quarter the price; I'm not really familiar with the low-end microcontroller market these days. \$\endgroup\$
    – supercat
    Commented Aug 5, 2022 at 17:02
26
\$\begingroup\$

Once I did something sort of like this. It was more complicated because the button was actually the power button and had to work normally for short presses. The idea was to reset the microprocessor on a long press. We didn't want to rely on the microprocessor to implement it because the idea was to be able to recover if the microprocessor got hung up. It seemed to work well enough in testing. It went into production. But I don't have any way of knowing whether customers ever had to use the long press.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
17
\$\begingroup\$

As JRE stated in their answer, MCUs or microprocessors manage the resetting process generally.

If your system has nothing for digital control then you can still go for analog implementations. The following is the one I designed in the past, for a remote reset signal:

schematic

simulate this circuit – Schematic created using CircuitLab

RF-CF pair is a de-bounce and spike filter. RT-CT pair determines the timing. And there's a safe-discharge network (formed by the BJT-NMOS pair) to discharge the timing cap trough RD when the button is released, just to prepare the system for the next RESET quickly.

\$\endgroup\$
3
  • 12
    \$\begingroup\$ +1 for presenting an analogue solution. There are times when you don't really want a uC, also in some older electronics they were not available. This type of circuit (using 4000 series CMOS not opamps) was common in some well known analogue audio mixers designed in the 80's and 90's (damn I feel old). \$\endgroup\$
    – danmcb
    Commented Aug 3, 2022 at 7:22
  • 1
    \$\begingroup\$ Hi, can you tell me what's the transistor and mosfet network below doing? And OA2's purpose? \$\endgroup\$ Commented Aug 4, 2022 at 8:45
  • 3
    \$\begingroup\$ @MeenieLeis the transistor-MOSFET network forms a safe discharger for the timing capacitor, CT. When the button is released the capacitor will be discharged through RD to prepare for the next reset quickly, in case the user wants to press the RESET switch again in a relatively shorter time. AO2 works as a comparator which tracks the timing capacitors voltage and generates a HIGH signal when it reaches to the reference voltage. I edited my answer accordingly. \$\endgroup\$ Commented Aug 4, 2022 at 9:02
15
\$\begingroup\$

Use a Smart Reset generator such as the ST Micro SR1 family. That will generate a reset pulse after you hold the button down for a long (settable) time while the button acts normally for UI functions. https://www.st.com/en/reset-and-supervisor-ics/sr1.html

SR1 in circuit

Trust me, if you only have a software-implemented reset, you will be kicking yourselves during development at least as you have to open up the device and disconnect the battery to force a reset.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.