Hello,
If I configured a input pin as INPUT_PULLUP, what's the maximum resistance I can have between the ground and the input pin when running at 5V? What about 3.3V?
I'm asking because I would like to use a 3.3V nano if possible. The buttons I'm using give pretty high resistance when pressed, unfortunately. Is something like 1K ohm OK? What about 10k ohm?
The internal pullup is ~30k. With buttons that have 1k resistance when pressed, you're okay. With 10k... it should still work, though it makes me a little uncomfortable. If worse comes to worse, you could always use analogRead() on them (assuming you have enough analog pins) - that would easily distinguish between them.
My interpretation is that he has the internal pullup enabled on the pin, and the pin connected to one side of a button, and the other side of the button connected to ground. The usual configuration - complicated by the fact that he is using a highly non-ideal button (because it's flexible, or super thin, or is in a wearable connected with conductive thread) with >1k of resistance while "on".
Highest voltage still considered a valid "low" is 0.3 x Vcc.
So 0.99V with Vcc = 3.3V.
So it becomes a simple voltage divider question, Vout = Vin x R2/(R1 +R2), Vout the junction of the internal pullup R1, R2 the switch resistance, fed by the Vin, the Vcc of the chip.
solving for R2: R2 = Vout x R1/(Vin - Vout)
0.99V x 20000 ohm/(3.3V - 0.99V) = 8571 ohm
So R2, resistance of the switch, can be pretty large and still get a valid low reading.
Low switch point is 0.3VCC, so pullup is the remaining 0.7VCC
The 20k pull-up resistor is the 0.7 part.
(20/7)*3
I guess it't how your brain works.
Leo..
DrAzzy:
My interpretation is that he has the internal pullup enabled on the pin, and the pin connected to one side of a button, and the other side of the button connected to ground. The usual configuration - complicated by the fact that he is using a highly non-ideal button (because it's flexible, or super thin, or is in a wearable connected with conductive thread) with >1k of resistance while "on".
Yup yup, that was my question. The circuit is correct, just a non-ideal button. Thanks!