The RST pin of your micro controller is not the most exciting of the bunch, but is one of the most important (and potentially dastardly). When I dive into a design I’m concerned with the big picture and what grandiose tasks my mighty micro is destined to accomplish… My enthusiastic efforts when beginning a project often cause me to overlook some details until a couple weeks or revisions later.
Only then do I begin to examine the small details of the user interface. For example, when my iPhone freezes (yes, I own one Apple product), I can expect to hold down the power button for a few seconds and it will confirm I want to shutdown my phone. This operation has become a loose convention in the consumer world.
Likewise, I want my micro to behave in a similar fashion. I found there are many dedicated chunks of silicone for this exact task and to my surprise, they command a decent price for such a simple process ($0.76 FT7521L6X or $1.36 TPL5010DDCT). I tried a few out of curiosity and they worked as expected. One prevailing feature of such components were their incredibly small footprint. Simple operation generally means small real estate. However many of the products I encountered were obviously designed for mobile devices: phones especially. Fitting this functionality in a 1mm X 1mm space is not my concern. I want reliable operation for a budget price…
My next revision fell back to basic circuits knowledge: the RC circuit. I want to trigger a reset after a time delay and a resistor and capacitor could easily do that. So below, I implement a 10uF cap with a 1.8M resistor (with an extra couple diodes D1 & D2 and mosfet M1 to provide other functionality specific to my application). As the switch closes, the cap slowly charges through the resistor. Once the voltage reaches the threshold of the reset transistor, my micro resets. Circuits 101 at work – certainly not rocket surgery!
This is great. My slightly overlooked feature is addressed and I can move on. But I always like to test all use cases… What if I press the button many times in a row? Well, obviously, the cap will charge incrementally upon each press. After enough cumulative charge built up, my simple duo would reset my micro. However this is not the intended operation. Perhaps the user will also use my button to set other features/modes of my project? I don’t want it to reset inadvertently after a few presses!
One tweak provides a simple solution to my problem: charge the cap slowly when the button is pressed, but discharge quickly when not pressed. To accomplish this my circuit simply needs a diode across the resistor.
Now my reset circuit behaves just like the iPhone, without the cost or hassle of a 1mm x 1mm package and at ~1/6 the cost!