Calculating a Pull-up Resistor Value
Let's say you want to limit the current to approximately 1mA when the button is pressed in the circuit above, where Vcc = 5V. What resistor value should you use?
It is easy to show how to calculate the pull-up resistor using Ohm's Law:
Referring to the schematic above, Ohm's Law now is:
Rearrange the above equation with some simple algebra to solve for the resistor:
Remember to convert all of your units into volts, amps and Ohms before calculating (e.g. 1mA = 0.001 Amps). The solution is to use a 5kΩ resistor.