1

I'm wondering why pull up resistors in text books are told such that they pull up the voltage to \$V_{CC}\$. Here is a diagram:

enter image description here

When the button is open what will be the input voltage to the micro controller? \$V_{CC}\$? No voltage drop at \$R_1\$?

Null
  • 7,448
  • 17
  • 36
  • 48
user16307
  • 11,802
  • 51
  • 173
  • 312
  • 2
    The input to the microcontroller does not "drive" current, and it has extremely high input impedance (megaohms) so if you pretend there is a 'circuit' to ground through the input pin, R1 allows VCC to be seen on the input, through a voltage divider but because R1 is so small in comparison to the high input resistance it's effectively not there, but DOES allow the voltage to 'pull' up to the VCC potential. You do not actually need the resistor, it's only there to stop a dead short-circuit through the button/switch when it's pressed, and to make sure the switch can properly set the voltage to 0. – KyranF Oct 24 '14 at 21:43
  • ok i got it! thx – user16307 Oct 24 '14 at 21:48

1 Answers1

6

If the button is closed then the MCU input pin is shorted to ground. There is a path from \$V_{CC}\$ to ground with resistance \$R_{1}\$ and a current flows through \$R_{1}\$. By Ohm's Law $$V = IR$$ so the current \$I\$ through \$R_{1}\$ is $$I = \frac{V_{CC}}{R_{1}}$$ and is non-zero.

If the button is open and the MCU input pin has a high impedance then very little current will flow through \$R_1\$. Since \$I \approx 0\$ in this case the voltage across the resistor is approximately \$0\$. The voltage at the MCU input is therefore "pulled up" to \$V_{CC}\$.

Without the resistor (i.e. \$R_{1} = 0\$) the MCU pin would simply be shorted to \$V_{CC}\$ and could never be "pulled down" by the button switch. If the button switch was closed then the current drawn from \$V_{CC}\$ would be $$I = \frac{V_{CC}}{R_{1}} \approx \frac{V_{CC}}{0} = \infty$$

Null
  • 7,448
  • 17
  • 36
  • 48
  • if the MCU input pin has a very high impedance, the current will still be tiny, so why would we need a series R1 then? – user16307 Oct 24 '14 at 21:39
  • @user16307: For when the button is pressed. – Ignacio Vazquez-Abrams Oct 24 '14 at 21:44
  • oh i got ur point, it prevents the shorting. but does it also have contribution to make the current smaller in general.Lets say if one just applies directly 5V to the microcontr. pin can input resistor handle it? the real reason is then not to make the current small when HIGH, but to prevent the short circuit when LOW? – user16307 Oct 24 '14 at 21:45
  • applying 5V to a microcontroller pin usually results in a few microamps. – KyranF Oct 24 '14 at 21:49
  • @user16307 You can use a larger resistor to make the current through the resistor smaller when the button switch is closed The main issue is to have a non-zero resistance so \$V_{CC}\$ and ground aren't shorted together. With the pullup resistor you don't need a 5V source to apply 5V to the MCU input pin -- just "release" the pin by opening the button switch and the input is pulled up to 5V. – Null Oct 24 '14 at 21:51