combining protection / clamping diodes and switch debouncing

Thread Starter

areslagae

Joined Jun 10, 2017
6
Hi all,

I am experimenting with input circuits for microcontrollers.

I am trying to combine protection / clamping diodes and switch debounding for a 24V pushbutton input. I am trying to figure out whether to first do the clamping and then the deboucing or first the debouncing and then the clamping. I am espectially interested in the case where the switch is on the +24V.

(This is kind of a follow-up of this thread where I did the same using an optocoupler but several told me galvanic separation does not make sense in that case and a designer would typically not use an optocoupler. Most other sources seem to recommend external protection / clamping diodes so I am now looking into this.)

Both cases seem to have disadvantages:
- first clamp then debounce (first two scematics): R1 needs to be large to limit the current through D1 with offsets the voltage, it seems to be difficult to select correct resistor values.
- first debounce then clamp: debouncing in 24V works fine but the input to the Schmitt trigger is then clamped at 5 of the 24V which seems to be incorrect, at least the schmitt trigger does not switch at the same point in time as if the waveform would be scaled.

My questions:
1/ Is this the correct solution for this problem assuming I want to do hardware debouncing?
2/ If yes, are these circuits correct?
2/ If no, what is the "standard" solution for combining protection / clamping diodes and switch debouncing?
3/ I also came across the last circuit in this Maxim app note. Is it correct? It seems it is missing a connection from the C to the Schmitt trigger input? Why are the zener diode and 220 resistor needed?

Many thanks in advance,

Ares





 

#12

Joined Nov 30, 2010
18,224
I am espectially interested in the case where the switch is on the +24V.
OK. That's what I'll pay attention to.
Why are the zener diode and 220 resistor needed?
Talking about the Maxim Circuit:
The zener is there because of the 220 ohm resistor. Without the resistor, you don't need the zener. Why the resistor? To protect from over voltage attack coming from the power supply. And yes. There should be a connection from the capacitor to the diodes.
D1 with offsets the voltage
Talking about Fig. 2:
What offset? D1 suppresses inputs higher than 5.6 volts. Meanwhile, you have R1 and R2 making a voltage divider which can be used to remove the extra 0.6 volts. Looks like a non-problem to me. How about 1.8K and 470 ohms (or some multiple thereof) for R1 and R2?
the Schmitt trigger is then clamped at 5 of the 24V which seems to be incorrect,
Talking about Fig. 4:
The input to the trigger is clamped at Vcc+ a forward diode voltage. I had to get out a real book from 1989 to find the limits. JEDEC standard #7 says Vcc +0.5 volts and Harris says RCA parts can survive Vcc+1.5V limited to 2 ma. "When the input diodes (in the chip) are used for logic level translation the input current should be kept to 2 ma or less." So R4 should be at least 12k.
The input protection diodes in the 74HC family that can survive a 1.5KV ESD test which is 100pf containing 1500 volts, limited by 1500 ohms for a pulse current of 1 amp. OK. Not a deal killer. So, if R4 is 12k and C2 is 0.1 uf for a time constant of 1.2 millisecond,
at least the schmitt trigger does not switch at the same point in time as if the waveform would be scaled.
Why is a millisecond or two a bit too slow to recognize a human pressing a button?
Is this the correct solution for this problem assuming I want to do hardware debouncing?
Looks good to me after I looked up all the criteria.

Wow! Ask many questions?:D
Edit: If you keep your verbiage down a a hundred words or so, and your questions few, you will find more people willing to attempt an answer. This cost me nearly 2 hours, and I wouldn't even try if I wasn't already having a good day.
 

Attachments

Last edited:

#12

Joined Nov 30, 2010
18,224
Sensacell came up with these today. 50ma for 1 usec stops the input.
There might be better chips for low voltage inputs at Bournes.
 

Attachments

Last edited:

Thread Starter

areslagae

Joined Jun 10, 2017
6
Hi all,

Thanks for your input so far!
I do appreciate your time and effort very much.

@#12:
- With “To protect from over voltage attack coming from the power supply” do you mean a raise in voltage due to current diverted to the power supply by the upper clamping diode? Or an unrelated fault in the power supply?
- About clamping the input of the Schmitt trigger: I may be wrong, but I have observed small spikes in the output at the C of a debounced switch in 24V due to contact bounce (cheap usb scope). When clamping the 24V to 5V these spikes remain the same magnitude against a much lower voltage of 5V and thus larger relatively to the Schmitt trigger threshold. That was what I was worried about (hence my comment that I intuitively felt the input signal had to be scaled not clamped). But it depends on the specific circuit I guess. The extra ms indeed do not matter.

@Bordodynov:
Many thanks for that circuit you kindly designed for me! I’ll definitely look into it. It seems like M1 and M2 form a current limiter. I assume the MAX6816 does the debouncing, the C is for decoupling, and all the rest is protection? Not cheap though, the MAX6818. Also, not clear to my why the extra input protection is needed given that the MAX has 15 KV ESD protection.

@all:
I started looking at the combination of clamping diodes and debouncing as a substitute for the circuit below after several people pointed out that the optocoupler is not needed and this is not how such a circuit would be designed by and electrical engineer. However, I do find that the optocoupler circuit has nice properties: it provides some level of protection, it only seems to require a few mA, it can be used with different input voltages and supply / gnd line switching, it does a good level shifting job, can easily be combined with debouncing, and is relatively low component - low cost. Galvanic isolation is indeed probably overkill for switches but maybe not for other sensors I want to interface (fire system, motion, my ventilation unit, ...) especially since it provides some level of protection agains my own stupidity at times ;-) I do not want te end up ruining the interface of the ventilation unit or unintentionally disabling fire sensors ;-) If I do not need hw debouncing I'll probably just use external clamping diodes.

 

#12

Joined Nov 30, 2010
18,224
Or an unrelated fault in the power supply?
Unrelated. Current spikes driven through the protection diodes are usually insignificant compared to the filtering capacitors in the power supply. External forces, like power line spikes carry a lot more power.
I assume the MAX6816 does the debouncing,
Why assume when you can look it up in about 4 clicks?
not clear to me why the extra input protection is needed given that the MAX has 15 KV ESD protection.
The input protection diodes in the 74HC family that can survive a 1.5KV ESD test
Consider that aspect!
I do find that the optocoupler circuit has nice properties:
Every design is a pile of compromises. You have the right to decide which compromises you choose. If you're designing for a production run, your opinion counts less because of cost. If you're designing for yourself, your opinion is God.
 

Attachments

Top