Hello,
I have an Arduino micro and I would like to fit a push-button to send an interrupt. In a schematic, a resistor of 1000 ohms is placed between the source of 5 V and the button. Since I would like to use the 3 V source so to keep available the 5 V for other things, shall I reduce the size fo the resistor to 600 ohm? (5/1000=3/x -> x=600)
Thank you
I would expect the value to be 10000Ohms, not 1000Ohms. The exact value does not matter, your maths is reasonable but really just use 10000Ohms.
The normal way of connecting a button is between the pin and 0V, use the internal pull up resistors and don't use an external resistor at all.
Using an interrupt is not generally appropriate for detecting a button press, look in the examples in the IDE under 02. Digital / button and debounce and digital input pullup and state change detection. All these are relevant to how you use a button as an input.
Beginner's mistake to assume you need interrupts for push-buttons.
Just poll the pin in loop().
That should be more than fast enough for human-operated buttons.
Connect the button between pin and ground, and enable internal pull up with pinMode in setup.
pinMode(buttonPin, INPUT_PULLUP);
No resistors needed.
Leo..
thank you!
Some uses of resistors are non-critical - here the pull-up or pull-down resistor for a button just has to be
much larger in resistance than the switch and much lower in resistance than allows noise pick-up. Since switches
are 0.1 ohms or so, and noise pick-up starts at around 1M for short wires and perhaps 100k..30k for longer
wires its typical to see pull-up and pull-down resistors of 1k to 10k range. Supply voltage is immaterial.
If you were choosing a resistor to limit current to an LED the value is much more important, but high
precision isn't needed at all. The difference between 5V and 3V supply would impact this choice.
If part of a wheatstone bridge measuring circuit the resistor value would be extremely important as would
its stability with time and temperature. You'd be using a calculator.