# Current Flow into MCU pin

If I have an MCU, e.g. ATTiny85, and I connect a 5V source to a pin on the MCU, what current is flowing?

My understanding is that the pin I'm connecting to will be at 0V and if I connect the 5V source then a large current will flow due to virtually no resistance, but this isn't true.

How is my understanding wrong?

• What is connecting a pin to a "5 V input"? This makes no sense. – Olin Lathrop Aug 14 '17 at 11:52
• @OlinLathrop If I have a wire going from a 5V source directly to a MCU pin – CS Student Aug 14 '17 at 11:54
• Then the 5 V is not a input. The pin might be configured as input, but the 5 V isn't somehow a "input". That makes no sense. – Olin Lathrop Aug 14 '17 at 11:55
• @OlinLathrop I've changed the wording in the question, its now a 5V source. – CS Student Aug 14 '17 at 12:02
• Also, "0V" at not connected pin doesn't mean "low resistance" (aka "short"). – Ale..chenski Aug 14 '17 at 12:27

Assuming you're talking about GPIO pins, it depends on how the pin is configured by the software. A pin configured as an input presents a high impedance, and very little current flows. A pin configured as an ​output and driven low presents a low impedance, and damaging current can flow.

This is why it's generally a good idea to use a series resistor to tie a pin high or low — if the pin is correctly configured, it has negligible effect, but if a software problem causes the pin to be misconfigured, it protects the MCU from damage.

• Yes I did mean GPIO pins, sorry I'm not an EE. So if I configure a pin on my MCU to be an input then somewhere inside the MCU attached to the input pin is a large resistor which causes the high impedance? (also, is high impedance the same as high resistance?) – CS Student Aug 14 '17 at 12:10
• You might want to add, that the MCU needs to be powered. If it is not powered but connected to ground, connecting 5 V to any pin will cause strange things (powering the chip over the protection diodes and other stuff). – Arsenal Aug 14 '17 at 12:16
• No, there's no "large resistor". A GPIO pin has two buffer circuits attached to it -- an input buffer that implicitly has a high impedance, and a "tri-state" output buffer that can be driven high, low, or off. In the "off" state, it also has a high impedance. – Dave Tweed Aug 14 '17 at 12:17
• @DaveTweed if there is no resistor involved then how is high impedance achieved? (from my understand high impedance is the same as high resistance) – CS Student Aug 14 '17 at 12:21
• The transistors used to construct the buffers inherently have a high input impedance. They also have a high output impedance when switched off. No resistors needed. – Dave Tweed Aug 14 '17 at 12:23

If I have an MCU, e.g. ATTiny85, and I connect a 5V input to a pin on the MCU, what current is flowing?

If that MCU pin is configured as an input, then there is almost zero current, for a static input voltage which is within the allowed voltage range for that IC (often, but not always, limited by the supply rails). Check the datasheet for your specific MCU - look for the "input leakage current" parameter, typically a few nA.

From page 161 (in the current version) in the ATtiny85 datasheet, I have edited one table to show only these relevant values:

Here you can see that typical input leakage current is < 0.05 uA (< 50 nA) for that device.

My understanding is that the pin I'm connecting to will be at 0V

No. An input is not a low resistance path to "0V", which would be required for a "large current" to flow (as you describe below).

and if I connect the 5V input then a large current will flow due to virtually no resistance, but this isn't true.

Yes, that isn't true because of the incorrect initial assumption that the input pin is at 0V.

How is my understanding wrong?

Ignoring some practical aspects (e.g. ESD structures and analog inputs, and assuming any internal pull-up or pull-down resistors are not enabled) a digital CMOS IC logic input is often internally a pair of complementary MOSFET gates - very high resistance. Therefore do your research about the characteristics of a MOSFET and how it switches.

• Why wouldn't the input pin be at 0V? – CS Student Aug 14 '17 at 12:30
• @CSStudent - Perhaps I see your confusion (although you seem to have already understood it now, during the comments on the helpful answer from Dave Tweed). Saying that a circuit node is "at 0V" can imply it has a low resistance path to 0V (then a large current would flow when voltage is applied, due to that low resistance) - that seems to be what you expected. However a CMOS digital input has a high resistance path to 0V (in this case, so high that it is effectively considered "floating"). Saying "at 0V" is ambiguous, and that seems to be where the confusion occurred. – SamGibson Aug 14 '17 at 12:57
• @CSStudent - To put it another way: a "floating CMOS input" (where you might measure 0V, but might instead measure other voltage values, depending on the exact circumstances) is not the same as "a circuit node with a low resistance path to 0V" (where you will measure 0V). This is effectively what Ali Chen says in this comment. That is why EEs would describe an unconnected CMOS input as "floating" and not as "at 0V", to "disambiguate" what is meant. – SamGibson Aug 14 '17 at 13:15
• Thanks for the follow up comments. They've greatly helped my understanding – CS Student Aug 14 '17 at 14:59