4
\$\begingroup\$

enter image description here

  1. Assuming VCC is +5V, why would the input pin receive +5V, and not a reduced voltage (as controlled by the resistor)?

  2. When the circuit is closed (button is pressed), why doesn't the input pin have the same current as it would when the circuit is open? Isn't this effectively a kind of parallel circuit? If current flows through all available paths, why not through the input pin?

\$\endgroup\$
1
  • \$\begingroup\$ Ideally, the MPU pin as an input neither sources nor sinks current. Input is 5 volt if switch is open, and zero volts if switch is closed. No magic here. \$\endgroup\$
    – user105652
    Commented Apr 23, 2018 at 3:59

2 Answers 2

19
\$\begingroup\$

1) Because the input impedance of the input pin is EXTREMELY large compared to your pull-up resistor (R1 in your schematic R2 in mine). Try to solve this circuit below 5V in series with 10k and 3M. You will see that the voltage drop across R1 is extremely small. Thus, fixing an open state of 5V or logic 1.

2) By providing a ground at the input pin, you short out the input impedance of the circuit. If you put a ground somewhere you put that node to 0V. Therefore, the whole 5V is dropped by R1 (my R2) leaving you with a logic zero on the input.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
3
  • \$\begingroup\$ I'm going to need to read up on things like Voltage Drop and Impedance, but I think I get the basic gist: It is the high impedance of the input pin which effectively renders the resistor null, therefore allowing most of the current (produced by 5v) to pass. Connecting the input pin to ground eliminates the impedance, allowing the resistor to work as intended, limiting the current passing through ground and the input pin. Am I on the right track? \$\endgroup\$
    – M-R
    Commented Apr 23, 2018 at 4:10
  • \$\begingroup\$ Looking at @WesleyLee's schematic, let the resistance across switch SW1 be R_SW1. The voltage applied to the DIO pin is then given by VDIO = V1*REQ/(R2+REQ) where REQ = R_SW1||R1. When the switch is open circuit ("OFF"), R_SW1's value is very high--on the order of tens or hundreds of gigaohms (or more), and so REQ=~R1. When SW1 is closed ("ON") R_SW1's value is very small--probably on the order of tens or hundreds of milliohms, and so REQ=~R_SW1("ON"). Example: If R_SW1("ON")=0.1 ohms, then REQ = 0.1||3E6 ohms = ~0.1 ohms, and therefore VDIO = (5V)(0.1)/(10k+0.1) = 50uV = ~0V. \$\endgroup\$ Commented Apr 23, 2018 at 7:05
  • \$\begingroup\$ @JimFischer -- it is not my schematic :P -- I just approved an edit on the units (v to V, etc, however, I rejected k to K, since kilo is k and K is Kelvin). \$\endgroup\$
    – Wesley Lee
    Commented Apr 23, 2018 at 7:23
5
\$\begingroup\$

The input of the MCU is not open circuit or infinite impedance, but rather very high impedance. The input impedance will vary between MCU's, but it's usually on the order of several Mega-Ohms to approaching 100M Ohms.

Current does flow through all available paths and it's inversely proportional to resistance. The current that flows through the input pin is referred to as leakage current, and is usually on the order of micro-Amps.

If you hear that no current flows through the input pin, that's because in most cases micro-Amp leakage currents can be effectively ignored in circuit design.

The voltage after the pull up resistor will be a reduced voltage, however not by much. A voltage divider is still formed between the MCU input resistance and the pull up resistor.

For example: If you have a 5V input, a 10K pullup, and a 10M input impedance, you should expect to see around 4.995V on the input. The voltage drop exists, but it's small enough to generally write off and well within digital logic thresholds.

All your assumptions were correct. It's just that for common practical digital circuit design MCU inputs can be thought of as having infinite impedance and no current, but that's not technically correct and can be confusing if you're trying to understand how all the real math and physics work.

\$\endgroup\$
11
  • \$\begingroup\$ How does connecting the input pin to ground eliminate the high impedance? \$\endgroup\$
    – M-R
    Commented Apr 23, 2018 at 4:31
  • \$\begingroup\$ @M-R I'm not sure what you mean by that. Connecting the input pin to ground doesn't eliminate the high impedance of the input. It creates a low impedance path to a reference voltage of 0V. The internal MCU circuitry compares what it sees at the input to other know voltages (often input power and ground) to interpret the input signal voltage. \$\endgroup\$
    – Phil C
    Commented Apr 23, 2018 at 4:51
  • \$\begingroup\$ If the impedance is the same, then why does the voltage drop to low? Isn't the amount of current flowing as when the circuit is opened? Only difference being that the current now has another path to ground. \$\endgroup\$
    – M-R
    Commented Apr 23, 2018 at 4:56
  • \$\begingroup\$ Yes, but the input is concerned with voltage, not current. At least in terms of determining how to interpret the signal. If you look at the diagram in the other answer by Simon and apply the theories of series-parallel resistor circuits, I think you'll be able to sort it out. Some current will technically flow, but it will be nothing compared to the near-zero ohm path to ground created by the switch. This Sparkfun tutorial might be a good place to start if you need a refresher on the concepts. \$\endgroup\$
    – Phil C
    Commented Apr 23, 2018 at 5:20
  • \$\begingroup\$ Right, so the high resistance/impedance of the input pin causes a very low current, which using ohm's law produces virtually 5V. And when the switch is closed, as the current has a low resistance path, the voltage drops to around 0. Is that kind of right? \$\endgroup\$
    – M-R
    Commented Apr 23, 2018 at 5:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.