How to ensure debouncing a contact ?

Thread Starter

Externet

Joined Nov 29, 2005
2,628
Hi.
Expensive equipment I would prefer not to experiment with has a factory firmware flaw, but would like to explore options to correct the problem before tampering.

Its display is usually off, and there is a single momentary pushbutton to enable it and scroll trough ~8 parameter readings.

At first press, it very briefly flashes the first parameter and jumps to show the second parameter.
Any subsequent press of the button advances one step to the next parameter, another press advances to the next and so on for a total of 8 readings and to the first that did not show at first press before.

It is a firmware flaw the manufacturer denies needing fixing and says "press it 8 times to reach the first reading"

I have to assume the button has a pullup or pulldown and triggers a microcontroller line that turns the display on and steps trough next sequential readings at every push. Do you agree ? What would you try to ensure that the fist push stays at the first reading ? Once in about a dozen of tries, it does display the first parameter when by chance, the first push is briefly enough.

Found a video at time stamp 0:23 ---->
: first button press ignores showing the first reading "Power" and continues to "Etoday" which is the second reading.
 
Last edited:

WBahn

Joined Mar 31, 2012
32,783
The fact that it only does it on the first push makes me think that it is NOT a debouncing issue. That would tend to be much more erratic and you would see it intermittently as you advance the settings.

Instead, and I'm guessing here, I think that that first push is causing a few things to happen (bringing it out of sleep or standby condition?) and there is a race condition. The behavior you see depends on who wins the race, which is usually the one that causes it to think the button was pushed after it woke up and went to the first state, but occasionally the button-push detection is over by the time that has happened.
 

Thread Starter

Externet

Joined Nov 29, 2005
2,628
Thanks. Totally valid suspicion. Perhaps I should explore producing a much shorter first pulse when the display is asleep.
How dumb would it be to put a trial and error 'small' capacitor in series with the button ? That I would dare to modify... :oops:
 

crutschow

Joined Mar 14, 2008
38,435
Methinks also, it is not a switch bounce problem, and more likely a software bug.

The only way I can think of to possibly correct that without modifying the software, would be to add a circuit that closes the switch contact 8 times the first time the switch is operated, and then subsequently only once for each button press.
The circuit would somehow have to reset when the device was restarted.
 

WBahn

Joined Mar 31, 2012
32,783
Methinks also, it is not a switch bounce problem, and more likely a software bug.

The only way I can think of to possibly correct that without modifying the software, would be to add a circuit that closes the switch contact 8 times the first time the switch is operated, and then subsequently only once for each button press.
The circuit would somehow have to reset when the device was restarted.
Of course, then on the few occasions when the thing DOES work correctly, it will leave you one short of the right position. But, at least that would mean that misbehavior is the exception rather than the rule.
 

Thread Starter

Externet

Joined Nov 29, 2005
2,628
Thanks.
The crutschow solution of hitting 8 pulses at wake-up is not convenient from a detail I did not disclose. When by chance, the initial wake-up pulse works as it should by turning on and staying at the first reading, it continues to a self scrolling mode trough all the ~8 readings, showing them all sequentially every ~3 seconds with no button press. When the same is selected at the eight button press, it does not auto scroll. In other words, there is two ways the unit responds to the first display. (when first press and when manually scrolling to it.

Will digest daring to shorten the pulse with a series capacitor. The way it is now, the misbehavior is the rule and exceptionaly works correctly.
 

Ian0

Joined Aug 7, 2020
13,123
This would normally be corrected by the manufacturer by rewriting the manual, so that the second reading is relabelled as the first reading etc.
 

Alec_t

Joined Sep 17, 2013
15,112
If the added cap produces the correct polarity pulse when the button is pressed, won't it produce the wrong polarity pulse when the button is released? That might be a problem.
 

WBahn

Joined Mar 31, 2012
32,783
If the added cap produces the correct polarity pulse when the button is pressed, won't it produce the wrong polarity pulse when the button is released? That might be a problem.
That's normally dealt with by using a diode to short out the wrong-going pulse.
 

upand_at_them

Joined May 15, 2010
939
While the manufacturer sounds like a bonehead, is there any reason to not do as they say and just treat the first reading as the last? Does the order matter? If it didn't flash the first one first and just started with #2 would you think it was a problem? Could you then just delay the startup display so you don't see #1 first?
 

MisterBill2

Joined Jan 23, 2018
27,385
Indeed! If the problem is indeed a mechanical switch contact bounce, then a capacitor will solve that. And if it is not switch bounce it will not solve the problem.
 

MisterBill2

Joined Jan 23, 2018
27,385
Taking on a capacitor is not cutting in. And adding a series capacitor will not solve a contact bounce problem, anyway. That is because the boounce rate is much faster than the capacitive time constant.
 
Top