Logic thresholds... switch contact resistance, ooops New
« on: February 24, 2013, 11:49:34 PM »
One difference between building onsey-twosey and larger runs is that cumulative errors, and last minute decisions can reach out and bite you months or more later.

My last minute decision was to use carbon ink, instead of gold plated pcb patterns for my dome switches...  I researched it as rigorously as I could , and since carbon ink was a common production technique I took my chances...

It took me a while to recognize what was going on, but after a few months I started getting unreliable switch action but from only one switch position, all the rest work perfectly. The balky switch also happens to be the on/off switch that has some extra circuitry to start up the power supply and hold it up long enough for the micro to start and take over.  This extra active circuitry was dumping a few hundred uA through the switch closure to ground. Also a steering diode was needed between the switch and the micro input port so when off, the open switch could float up to battery voltage while the micro sits completely turned off input protected by the reverse biased diode.

Apparently over time the carbon ink wears off and the resistance goes up, the internal pull up current source dumps another few hundred uA into the contact resistance so that plus the diode forward voltage was just enough to give marginal logic lows.

Looking at the data sheet the worst case threshold is .2x Vdd so  0.66V... 

This will be easy enough to design around for the next generation PCB, but I don't feel like doing any serious cut and patch rework on boards in stock.

The beauty of software based embedded designs is I can easily alter the programming before final assembly.

First thing I tried was turning off the active pull-up... If the logic input port was high enough impedance I could selectively turn the pull up on only when needed to reset the port, but noooooo the input leakage, rated at +/- 1 or 2 uA was apparently negative and more than the leakage through the reverse biased diode that should be pulling it up so it would report false lows...

My current working software solution is to strobe the active pull-up off but only for a few clock ticks during a frequently occurring  service routine. This way I don't turn off the pull up long enough to get a false logic low, but turn it off frequently enough to help any marginal switch presses register low without the diode drop being fully biased on by the pull up current. 

Since my new boards already work fine (when new) I tested this on my development unit, that has over a year of pretty serious wear on it. The on/off switch action is now dramatically improved, almost like new. Without the strobed pull up, I have to really push hard to get a good switch closure.

I probably need to do some more testing, to see how wide of a sample window I can get away with, but this works good enough that I should be able to get away without any cut and patch rework.

Just another day in the office...  8)


[follow-up]   I did some more tests and it turns out it takes between 4k and 8k service routine calls for the input port to drift low, with the internal pull-up turned off. So now instead of turning it off for a few clock ticks during the interrupt, I turn it on for only a few clock ticks, to keep the port high, and leave the pull-up off for all the rest of the time.   [/follow-up]
« Last Edit: February 25, 2013, 01:05:57 PM by JohnRoberts »
Don't only half-ass tune your drums. Visit to hear what properly "cleared" drums sound like.


Related Topics

  Subject / Started by Replies Last post
6 Replies
Last post July 06, 2005, 02:29:17 PM
by matta
6 Replies
Last post December 08, 2006, 04:42:38 PM
by guavatone
4 Replies
Last post March 13, 2012, 01:48:14 PM
by abbey road d enfer
62 Replies
Last post June 22, 2014, 11:04:27 AM
by JohnRoberts