24

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

JRE
  • 67,678
  • 8
  • 104
  • 179
BipedalJoe
  • 449
  • 2
  • 9
  • 17
    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. – Andy aka Aug 03 '22 at 06:52
  • Also see devices like the [TPS342x](https://www.ti.com/product/TPS3422). – CL. Aug 03 '22 at 07:16
  • 5
    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. – user57037 Aug 03 '22 at 08:44
  • 1
    BipedalJoe, You can also look [here](https://electronics.stackexchange.com/a/559374/38098) 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. – jonk Aug 03 '22 at 09:01
  • 6
    L/R time constants of seconds are impractical. – John Doty Aug 03 '22 at 19:42
  • Look up time delay relay. An electrician wiring the controls for a factory is more likely to use these than standalone ICs. It may use a plunger for the timing. – jy3u4ocy Aug 05 '22 at 18:55

4 Answers4

38

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.

JRE
  • 67,678
  • 8
  • 104
  • 179
  • OK thanks. I'm aware it can be done in software. I guess devices that need to factory reset have microprocessors and what they need for that. – BipedalJoe Aug 03 '22 at 06:51
  • 10
    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. –  Aug 03 '22 at 11:25
  • 10
    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. – user1850479 Aug 03 '22 at 13:07
  • 19
    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. – supercat Aug 03 '22 at 15:25
  • 8
    @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. – abligh Aug 04 '22 at 06:31
  • @supercat Do you have any examples of small type microcontroller that may be commonly used for something like this? – Derek D Aug 05 '22 at 16:31
  • 1
    @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. – supercat Aug 05 '22 at 17:02
  • Isn't it usually done on a CPLD or something rather than a full microcontroller? – forest Aug 05 '22 at 22:21
  • microcontrollers go a lot lower than CPLDs nowadays. – Peter Green Aug 06 '22 at 09:41
25

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

user57037
  • 28,915
  • 1
  • 28
  • 81
16

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.

Rohat Kılıç
  • 26,954
  • 3
  • 25
  • 67
  • 12
    +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). – danmcb Aug 03 '22 at 07:22
  • 1
    Hi, can you tell me what's the transistor and mosfet network below doing? And OA2's purpose? – Meenie Leis Aug 04 '22 at 08:45
  • 3
    @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. – Rohat Kılıç Aug 04 '22 at 09:02
14

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.

AAT
  • 241
  • 1
  • 4