# How much current is used with a μC GPIO input and pullup resistor?

I'm trying to understand power budgets a bit better and I have a question regarding pullups. I have a input to a microcontroller that needs to be logic high at all times. The micro goes to sleep now and again, so the internal pullup isn't an option. Looks like so (wow that's big).

simulate this circuit – Schematic created using CircuitLab

I'm dealing with a low power, battery-operated system here (2 AA batteries), so every bit of power savings counts. My question is how to figure out how much current this draws. If I just look at V = IR, we're talking 30μA, which is actually a lot for this application.

What I don't really understand is how to factor in the microcontroller. I'm assuming there's something I need to factor in from the datasheet, but I don't know which elements are relevant.

The 100k resistor is from a reference design, but is there anything stopping me from putting a much bigger resistor to cut down on current draw?

These are probably basic questions, but I'm a software guy out of his element here, so bear with me.

Leakage

Based on some comments, it looks like leakage current is the microcontroller spec I should be interested in. Below is what I found in the datasheet. Is 3 nA the magic number?

• Related thread. Not a duplicate, though. – Nick Alexeev Jan 13 '14 at 21:44
• Why is internal pullup not an option because the uC occasionally goes to sleep? In the uC's I know the pull-up configuration is static, independent of any clock. – Wouter van Ooijen Jan 13 '14 at 21:51
• @Wouter - Interesting. I assumed that when it goes into a deep power-down state, you can't rely on the internal pullups/pulldowns. I'll explore it further. – BabaBooey Jan 13 '14 at 22:06
• You mention a datasheet but provide no further info. Is the question related to a specific mcu model/family? – alexan_e Jan 13 '14 at 22:32
• At the power levels you hint at, you simply can't have pullup resistors working against the normal state of signals. You are going to have to figure out how to adapt the design so that pullups only work against briefly temporary states, and use something else for things which can be in either state for meaningful time. – Chris Stratton Jan 13 '14 at 22:43

You need the input leakage current. This question has a good discussion of what's actually happening. Basically, the input transistors present an effective resistance of megaohms to gigaohms and the current flowing will be extremely small. That discussion also says you can usually increase it to 1Mohm.

• But as the external pullup must have a much lower resistance than the input resistance (presumably to ground), it makes little sense to increase the external pullup. It will only increase the sensitivity to disturbances (but maybe the input level is never read). – Wouter van Ooijen Jan 13 '14 at 21:49
• Agree with @WoutervanOoijen. In fact, assuming that the microcontroller pin in always an input, making the pull-up zero ohms to 3.3V would not significantly change power consumption. The 100K resistor protects you in case you accidentally drive the pin low. – DoxyLover Jan 13 '14 at 22:44
• @pjc50 - Added leakage info – BabaBooey Jan 13 '14 at 22:49

Internal Pullups are 20 to 50kΩ. Typical Characteristics are measured with pins as inputs and internal pullups enabled. Sleep modes affect input pin logic state, and current consumption. They can and are used in sleep modes. Only difference is the value. Your 100kΩ is larger and has a better fixed/known value.

Relevant sections. All these are pulled from the ATTinyx5 series MCU Datasheet, but are typical of most ATTiny and ATMegas

There is a trade-off on high resistors values. That turn inputs more susceptible by noise.

• This answer could need some basic explanation. – Rev1.0 Jan 14 '14 at 8:20

Your calculation of 10$\mu$A assumes that the microcontroller input is at ground and the full supply voltage is across the resistor. But the resistor will pull the input pin high and there will be virtually no voltage across the pullup resistor (most of the time). Therefore, the current through the resistor would be zero for an ideal CMOS input pin, after a few microseconds of charging time.

The key parameter is the input leakage current, as you have seen from the datasheet. If you are pulling the pin high then it is the high-level leakage current that is important, and the typical value of this parameter is 3nA. I wouldn't use that value if you really care about power consumption, I would try to find a worst-case value in the datasheet or use the 20nA figure (worst-case if the input is pulled up to 5V).

In fact, if the pullup resistor is on a pin that is always an input then the value of the pullup resistor is hardly important. You could use 10k$\Omega$ instead and feel better about noise immunity.

I've been through this problem, and I've found that the best thing is to use the internal pullup. You must consider that if you put the external resistor, it will be drawing 30 uA every time you force the output low. In the future you might need to keep it low for longer times, and you may have forgotten that resistor that will suck your precious power.

I said that I've been through this - I also had a very low power device to work on, and every current was measured to the uA-nA range in order to reduce the power demand to the minimum. When you use the internal pull-up resistor you can forget it's there. If I recall correctly, when you force a logic level in the output you should disable the pull-up.

• Good point about current draw when configured as an output. This line actually does get turned into an output after the micro boots up and acts as an address line to external RAM. It's not a huge concern since it's the sleep current that is most important, but it's still good to take into account. – BabaBooey Jan 20 '14 at 19:16