Minimum current possible to pulldown digital pin?

Hello,

I am trying to de-bounce a switch with the hardware (not program) and wondering what is the largest resistor I could feasibly attach to my digital pin to reduce the current as much as possible.

hardware - I have a switch attached to ground when it is off, and the other end is attached to a digital pin pulled up high. I also have an RC circuit in between them. When I flip the switch, the digital pin is then sent low. I am wondering what the minimum current possible through the RC I can run to still pull the high digital pin, low. I want to increase the resistor as much as possible, then optimize my capacitor.

Apologies if I am not clear, I have never made one of these debouncers before. And yes, I know I can do this with the code as well, but I want a hardware solution.

After some testing and more research it turns out that a 20Kohm resistor is the max I can put between my G and 5V meaning that 250uA is the minimum I am able to push through the digital pin to turn it HIGH. Cheers

If higher resistance needed, switch internal pull-up off and use external resistor. Up to 100 MOHm

stevenette:
I know I can do this with the code as well, but I want a hardware solution.

Since the performance of the software version is immeasurably superior to (more reliable than) hardware, I find that a curious choice. :roll_eyes:

Mind you, what I mean by software de-bounce is different to what is commonly described. :grinning:

stevenette:
a 20Kohm resistor is the max I can put between my G and 5V meaning that 250uA is the minimum I am able to push through the digital pin to turn it HIGH.

That is one confused statement. What is "G", and what are you trying to "push through the digital pin"?

You need to explain your actual connections and whether you are using INPUT_PULLUP. It is not making any sense so far.

I have used 10M resistors as pull-up for a button, and the same for a reed contact. Works great so far, did a few tests lasting a few days each and no false triggers. I did add a 2n2 cap across the switch for stability, and a 330R current limiting resistor to the pin as it doesn't like the current spikes, and wires are short (<0.5m for the reed, same PCB for the button).

stevenette:
After some testing and more research it turns out that a 20Kohm resistor is the max I can put between my G and 5V meaning that 250uA is the minimum I am able to push through the digital pin to turn it HIGH. Cheers

That sounds very wrong.
In general the higher you make you pull up or down resistor the more prone to interference is the input. You should not have a pull up AND a pull down in operation at the same time for this sort of application.

Ah, yes, it might work today but will it work tomorrow?

If you want a good lesson in the why and how of debouncing switches, please read this:

stevenette:
Hello,

I am trying to de-bounce a switch with the hardware (not program) and wondering what is the largest resistor I could feasibly attach to my digital pin to reduce the current as much as possible.

Entirely depends on the amount of noise/interference the signal will be subject to. Nearby signals
couple into wiring via stray capacitance, and the voltages generated are proportional to the impedance
of the circuit being disturbed - so if your switch was wired remotely 1k to 5k might be good robust values,
if on the pcb close to the microcontrol and far from any high voltage circuitry then 100k will work.

The built-in pull-ups are spec'd as 20k to 50k (they are actually pFETs, not resistors), which is good for on-board
pullups, but should be bolstered with external pullups for more demanding situations.

Good debouncing though can make up for poor noise performance, since noise spikes are typically short lived,
so if the software is selective enough the pullups can be allowed to let noise through to some extent - but
why take the risk?

Or use Max16054 IC.