[TriEmbed] "Latching" device

Pete Soper pete at soper.us
Thu Apr 10 10:38:29 CDT 2014


In my browser the vertical bar from the cap is further to the right than 
you intended, but I think we get it.

So the capacitor will be discharged by the mcu pin's input resistance in 
series with the resistor. I agree this should work wonderfully as long 
as the cap is made large enough to keep the voltage high "long enough." 
If the latching action is only needed for a minute or two then a 
conventional cap may work well. For a longer time a supercap might be 
required.  The MCU (or expander port chip) data sheet and the resistor 
value could be used to calculate the time constant. But that's for a 
perfect cap: the super caps will approach this, but regular 
electrolytics will discharge faster where the other resistance involved 
is very large.

A key issue is whether the resistor helps or hurts. If the latch needs 
to stay valid for a couple days, for instance, then when the pin is set 
to output and driven to ground it could take a very long time to 
discharge the capacitor. The software also has to keep track of that 
discharge time, re-testing the pin to confirm it's discharged or 
ignoring the pin "long enough" to avoid being tricked by another button 
press happening too soon after the earlier one.

So the size of the capacitor in relation to how long the "latching" must 
last as well as how fast the discharge has to go would allow judging 
whether this circuit would meet Brian's requirements.  But it surely 
wins the simplicity award!

If two pins could be used a classic SR latch should work. This would be 
a pair of gates (such as two CMOS nor gates) where the pushbutton 
applies a potential to the "set" input and the mcu pin senses Q or Q bar 
and applies a potential to the "reset" input. Here's a description 
<http://en.wikipedia.org/wiki/Latch_%28electronics%29#SR_NOR_latch>.


-Pete

On 04/10/2014 09:31 AM, Bill Farrow wrote:
> I was wondering if there is a "tricky" way you could do this using
> only a single pin, a capacitor, and a resistor.
>
> When the push button connects it charges the capacitor. The MCU pin,
> configured as an input, can read the state of the capacitor. When the
> MCU wants to reset the latch it can change the pin to an output and
> set it to 0 (low) which discharges the capacitor to ground via the
> resistor.
>
> Let's see how bad my ascii art is:
>
> mcu pin --- resistor --- switch --- 3.3v
>                               |
>                         capacitor
>                               |
>                             GND
>
> Bill
>
> _______________________________________________
> Triangle, NC Embedded Computing mailing list
> TriEmbed at triembed.org
> http://mail.triembed.org/mailman/listinfo/triembed_triembed.org
> TriEmbed web site: http://TriEmbed.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.triembed.org/pipermail/triembed_triembed.org/attachments/20140410/d0fc5d56/attachment.htm>


More information about the TriEmbed mailing list