Can I speed up this debouncer's rise time? - Page 1
Forum section: electronics / beginners

author: vmallet
author_rank: Regular Contributor
timestamp: June 06, 2019, 02:15:54 pm
content: As an exercise to understand Schmitt triggers a bit better I am trying to implement a discrete hardware switch debouncer and what I came up with has a rise time that's too slow (~500ns).Question: is it possible to speed up that rise time and if so where should I start looking?(context: I was putting together a little test circuit to play with a TTL shift register (74LS164) directly driving a common-anode 7-segment display and the switch will drive the chip's CLK so I can manually key in all the segments)Here's the low-tech circuit:Also, I realize the 74LS164 must have a max rise time for the clock edge. Can I find that out in the datasheet? (I tried looking but didn't find it):http://www.ti.com/lit/ds/symlink/sn74ls164.pdfThanks!

author: rstofer
author_rank: Super Contributor
timestamp: June 06, 2019, 11:51:26 pm
content: Figure 1 Note A discusses the rise and fall times for which the tests are done. It doesn't say you have to meet them or even come close. Everything seems to be based on Vref

author: T3sl4co1l
author_rank: Super Contributor
timestamp: June 07, 2019, 12:54:48 am
content: The last NPN, change the resistors from "pull-down then series base" to "series base with pull-down". That is, a resistor from proceeding C, to B; then a resistor B-E. Typical values for 5V would be 4.7k and 2.2k.Repeating this change throughout the circuit should help with response time as well (not that that's a big deal for a mere switch, but it's a good lesson for general logic).Tim

author: vmallet
author_rank: Regular Contributor
timestamp: June 08, 2019, 10:23:49 pm
content: Thanks much for the suggestion. This is how I updated the circuit, did I understand you correctly?The new version is a bit faster, just enough that the 74LS164 is not confused anymore and I can click my button all day and it does what I thought it should do. Yay!Here's a view of the rise time the way I had it initially:Here's the rise time with the change above:One more question: could you explain what happens differently between the two versions that makes it rise faster in the second case?Vince.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: June 09, 2019, 01:53:18 am
content: The B-E junction acts like a diode, and a diode stores charge much like a battery.This is actually very apt, if a bit unusual because of scale:- A battery stores and releases charge (current * time).- The voltage drop is exponential with charge state. (Ever had a phone where the charge indicator is on 4-5 bars, then it suddenly tanks? Yeah, that's running down the exponential slope as it runs out of charge. Proper indicators are supposed to account for this, but linear voltage scales are still very common...)- The battery self-discharges.- The battery self-discharges at high voltage, usually through alternative reactions (like electrolysis of water, which is what creates the explosion hazard for lead-acid batteries for example, when charged rapidly).In this case, the amount of charge stored is very small, maybe 100pC.In steady state, stored charge depends on forward base current.There is no alternate reaction in silicon, just regular current draw. In effect, the self-discharge is exponential with voltage. BJTs are charge-dependent devices like any other, but because of this current draw, they can be treated as current-controlled for certain purposes (mainly as saturated switches).The self discharge is extremely rapid, about 20us for lightly doped silicon. You can see this by using no GND resistor at all -- the transistor will stay on surprisingly long, until it eventually clears charge from the B-E diode, and in this case also from the capacitance of the driving transistor.So, what you're doing is discharging that "battery", much faster than it would by itself. Any B-E resistance path helps, which is why your original wasn't too bad. Best performance is around where Ib2 = Ib1, with Ib1 being forward base current and Ib2 being reverse (turn-off) base current. The base voltage dwells around 0.6V as it's discharged through the B-E resistor (again, it's a battery, more or less) -- the B-E resistor continues to carry current even after the driving source has turned off.So, you want to dimension things so that the pull-up resistor delivers 2*Ib, and the B-E resistor draws Ib at Vbe = 0.6V or so. Or,Rpu = (Vcc - Vbe) / (2*Ib)Rbe = Vbe / IbIb is determined by what collector current you need to handle, and what saturated hFE you choose, usually around 20. (Most datasheets still use a standard figure of 10, but high-hFE parts have been spec'd at 80 or more -- good performance indeed!) So,Ib = Ic(max) / hFE(sat)Alternately, you want to use a resistor divider such that:Supply voltage = VccThevenin output voltage Vth = 2*VbeThevenin output resistance Rth = Vbe / IbThese in turn use,Rth = R1*R2 / (R1 + R2)Vth = Vcc * R2 / (R1 + R2)and some algebraic rearrangement.Tolerance: don't worry about it, Vth can be much higher (which after all, is what you had originally, Vth = Vcc and Rth = some kohms).Note this doesn't account for capacitances, which are real, and not quite the same as the  stored charge. The capacitances are there regardless of current flow, so you can't expect good performance if you run at, like, 10uA and use 100k+ resistors. It's going to be slower of course. In that case, the capacitance dominates, and you just use RC time constants (and risetime = 2.2RC or thereabouts) as they are dominant.That's probably the next thing you're up against, assuming you want/need a still sharper waveform -- a stiffer pullup will charge the collector capacitance faster.It's practical to get edges down in the 50, even 20ns range from 2N3904s and such; but you do need to spend a few mA doing it. You can save a few in turn by using a more complicated circuit, like replacing pull-up resistors with current sources, using "speed-up" caps across series resistors, using cascode connections and such; but this shouldn't be necessary for present application, at least.Tim