1 Introduction
The pull-up resistor is typically used in a microcontroller and some digital logic devices to connect a switch or a button to indicate the state of the input.
For example, enter as "High" ("1") when the button is turned on, and enter as "Low" ("0") when the button is off.
When the button is pressed, if there is no pull-up resistor, the GND will be connected directly to VCC, resulting in a short circuit , which also proves the necessity of the presence of the pull-up resistor from the opposite side.
2 Resistance value
The value of the pull-up resistor needs to meet the following two conditions:
1) When the button is off, theR1 controls the current value of GND, VCC , so the value of R1 cannot be too small (too small, too large, and meaningless power consumption increases).
2) When the button is turned on, the voltage at theR1 control input pin is "high", so the value of the R1 can not be too large (too large the voltage on the R2 is too small, resulting in the inability to determine whether the input is "1" or "0")
Considering the above two conditions to take R1/R2≈1/10, and the input resistor at the microcontroller input pin is usually 100kω~ 1MΩ, so the value of the pull-up resistor is generally 10kω
3 calculation
Example: Assuming VCC = 5 V, the required limit current is about 1mA when the button is pressed, and the R1 value is obtained.
According to Ohm's law, R1 = vcc/ir = 5v/1ma = 5 KΩ
It is also important to note that the higher the pull-up resistor value, the more slowly the pin responds when the input voltage is switched high and low.
Pull-up resistor