Given 1 hall sensor. It can be in:
- State 1: Static 0 (no oscillations)
- State 2: Static 1 (no oscillations)
- State 3: Edging 0/1 at different frequencies
Given also an MCU which counts the positive edges. When there are no edges for a long time, the MCU goes deep sleep for power saving reason. There is no ability for the MCU to awake from the deep sleep by external interrupt. (Frankly there is light sleep mode but it does not work properly => it's excluded out of the picture hence.)
The challenge is:
- Detect start of the oscillations (state 3) after significant pause (states 1 and 2). Once the oscillations detected, pull the RST pin of the MCU down for 10 ms.
The "pause" can be just 100 ms or any more.
Thanks to @periblepsis, the graph which describe the challenge is:
For this challenge I use another MCU, of microamperes, which detect the state 3 and resets the main MCU. This adds some complexity to the circuit, more firmware to maintain, relatively low whole solution reliability.
This, This, This and This are similar parts of possible solution: they all detect any edge and generate RST pulse. This will reset the MCU on every single edge. However, the challenge states a detection of an edge after steady 0 or 1.
My question is:
- How to implement fully electronic detector of oscillations (state 3) after the after significant pause (states 1 and 2)?
I guess it should be some gates and/or FETs... A reference to similar schematics or names of relevant building block will be appreciated.
UPDATE:
I tried to run Falstad sim on the 2nd idea of @Michal
It detects the positive edge pretty well. And it is easy to disable that circuit from MCU once awaken.
The problem here is that if the Hall sensor starts rotation at high RPM then MCU might not have enough time even to reach 1st line in the code and set GPIO to 1 for circuit off. This means the MCU will be resetting at the frequency of Hall sensor while it is rotating.
The circuit proposed by @periblepsis simulated and works just like repeater for the input. This is mayby my fault: I don't know which values to set for resistors and capacitors. I set "rule-of-thumb" values...
In similar "repeater" way simulated the 1st idea of @Michal