Circuit Debounce

I am wondering if their are predetermined values for R & C , that are common for most switches ?

I don't know about common, but I have a graphic here:

That shows a 1 µF capacitor giving about at 36 mS debounce, which may possibly be slightly long.

The schmitt trigger buffer will eliminate any error pulses when the button is released resulting in a cleaner edge.
I can now omit the resistor. this schematic & use Nicks technique at the link provided.

Thanks Nick

The resistor is primarily there to protect too much current discharging through the button each time it's pressed, without it, it's a dead short when you press the button to discharge the cap.

JB_AU:
I am wondering if their are predetermined values for R & C , that are common for most switches ?

RC = time constant in seconds, R limits current drain. For 20ms R=1M, C=22nF would work, as would 1k and 22uF

If using larger C values a second resistor to limit current through the switch becomes needed to avoid the risk of it welding
shut. It can be R/10 or so.

This is an usefull circuit allowing high current throw the circuit breaker to do it more resistant against electric noise.
No problem with welding kontakts.
100K + 0,1µF also protect against ESD up to 1000 volts (check maximum input current)
100K 0,1µF are enough for most switches but 100K can be higher

pelle

cjdelphi:
The resistor is primarily there to protect too much current discharging through the button each time it's pressed, without it, it's a dead short when you press the button to discharge the cap.

Are you looking at the same circuit? Looking at the one on top with 74LS14 buffers, the resistor does nothing to limit button current, it is there as a pull-up.

JB_AU:
The schmitt trigger buffer will eliminate any error pulses when the button is released resulting in a cleaner edge.
I can now omit the resistor.

Thanks Nick

If you are talking about the schematic you provided, you still need pull up resistors. Otherwise, the caps will only charge from leakage currents, if at all, and to the circuit the buttons will always appear to be pressed.

Nicks link showed how to achieve this with INPUT_PULLUP.

This was a smaller part to my first pcb, controlling 2 stepper motors with the ATTiny85. Im doing my best not to rely on the mcu to do everything & started tackling cmos / ttl ic’s.

Such as the attachment.

I am unsure if the VDD & VSS traces are too narrow ?

At the moment my unipolar steppers are 12v 600ma, but later i wish to drive 7A motors.
And yes i will be using heatsinks & cooling :slight_smile:

I am controlling each stepper with two outputs, the DIR is held HIGH for forward & held LOW for reverse.
By pulsing STEP from LOW to HIGH to LOW with a 2ms pulse, the binary 4bit counter(s) either increment/decrement, which is in turn fed to the DECODER and switches the NPN’s in the order they are incremented/decremented.

Are there any design rules or really good books or guides on the subject of making circuit boards ?

Tiny2Step.pdf (29.7 KB)

I’m talking about this circuit and the fact, the resistor stops the very fast discharge…

with the resistor there, having a LOW value until the cap discharges prevents the bouncing on the Arduino’s input, even if it took 100ms to empty (via a 1k resistor) is acceptable.

See the Circuit, is that the circuit we both see?

I opted for this approach;

In this case the capacitor is charged by the pull-up resistor. When the switch is pressed it discharges, and takes a moment to charge again. This delay effectively debounces the switch, so the simpler code above (without the debounce) could be used.

This oscilloscope graphic shows the capacitor charging once the switch is released, and since about 50% through is considered HIGH, it has given us about a 36 mS debounce. Thus a smaller capacitor could be used if faster debouncing was wanted.

Still, you may damage an a hardware pin, you need to limit the current.

Why will it damage it? The input to the capacitor is just an input pullup.

JB_AU, OK, so nothing to do with the schmidt trigger.

cjdelphi, are you saying that shorting the capacitor with a pushbutton will cause a short burst of high current which may damage the contacts?

If so, the resistor in the first circuit does NOT limit that current. That resistor pulls the pin high, while limiting current from Vcc as compared to simply connecting the input to Vcc directly. The pushbutton still shorts the capacitor, unrestricted by any outside resistors. No more so than Nick's circuit.

What is the typical ESR of such a capacitor, and how much energy is stored in there? I think it is E^2 x C / 2 = joules. What is the resistance of the switch contacts? It is a valid worry, until we know otherwise. Merely 10 ohms in series with the switch would drop the max current to 500mA (assuming superconducting switch and capacitor) and not have any appreciable effect on even a 1k pullup, much less the 30k (?) internal pullup resistance.

I'm not sure it is necessary.

I'm concerned with the rate of charge discharge.

Let's say you dis charge the cap by shorting, just how much current will i draw from the arduino pin? I see no resistor?

I simply emulated a 1uf cap , obviously i let it draw as much current as possible, the arduino has a 40ma limit si. So ard we not risking damage?

Ok if that circuit emu is right, it’s going to be fine…

Fun tool to play with…

Let's say you dis charge the cap by shorting, just how much current will i draw from the arduino pin? I see no resistor?

It's an input pin. You won't "draw" a huge amount of current, any more than your iPhone charger draws a lot of current from the power station when you plug it in.

cjdelphi:
I simply emulated a 1uf cap , obviously i let it draw as much current as possible, the arduino has a 40ma limit si.

As an output.

It's clearly safe, if it was to draw current 100ua id hardly going to kill yhe switch i fully agree.

But ok i'm dense at times, but how's this cap charge if not via a pin?