# MCU Pull-up resistors maximum value

#### cmartinez

Joined Jan 17, 2007
7,360
Question, what is the recommended maximum value for biasing an input in an MCU? In this case, I'm talking about the PIC16LF1823.

Of course, said MCU has its own internal pull up resistors, if one wishes to activate them. But I've discovered that they consume an unacceptable amount of power. My guess is that the distance between the MCU, the pull-up and (in this case) the switch is important. For instance, I'm sure it's not the same if the switch is only a few mm away from the MCU than if it's located one meter away.

In my case, the switch is located only about 2mm away. It's extremely close. Would a 1M resistor do the trick? Would 4M be too high? Or is it a question of trial and error?

#### Ian0

Joined Aug 7, 2020
2,599
A good choice would by a tenth of the "off" resistance of the switch. At a guess the switch will measure at least 10M when new, so 1M should be fine. But what happens after a period of use? Is the switch still as good? Is there moisture on the pcb, or any other conductive contaminants.
Use a switch with gold-plated contacts, otherwise it needs some current through it to keep the contacts clean. If not they oxidise and then don't switch ON properly.
Is it a momentary switch? If so, how do the PIC's pull up resistors manage to consume any current? If the switch is OFF there is nowhere for the current to go. If I remember correctly, PICs can have pullups switched on and off individually. Are you sure that you are not switching on pullups that are permanently pulled down?

#### jpanhalt

Joined Jan 18, 2008
11,088
Noise seems to be a limiting factor. Very low noise environment would allow a weaker P/U.

Input leakage current (D060) max is 125 nA. That current across an 8 MΩ pullup would give about a 1V drop. A pullup resistor of 8 MΩ seems huge.
The above table suggests that the minimum designed (but not tested) P/U current is 25 uA @ 5V ≈ 200kΩ

If that's acceptable for design, maybe your external P/U could be that big or a little more.

#### KeepItSimpleStupid

Joined Mar 4, 2014
4,894
Leakage current will vary with temperature.

#### cmartinez

Joined Jan 17, 2007
7,360
Thanks for the advice, John and Ian.

My device is working at 3.3V and the switch in question is a reed, which is encapsulated in glass, so no contamination will ever reach it. It's being powered by a set of four AAA batteries, and I'd like them to last as long as possible. Right now its drawing 14.7 µA and that means that good quality batteries will last for about up to 7 years... every micro amp counts...

In my design, the pull ups are only needed for biasing the MCU's inputs, so the datasheet's minimum current of 25 µA seems unnecessarily large to me. Thanks for pointing the appropriate section in the datasheet that I should've looked up. Of course I always check them but I'm not as experienced as other people and some nuances escape me.

I've tested a 4MΩ pull up and things seem to be working fine. Current has gone up by only 0.8µA after that. Now I'm going to buy 6, 8 and 10 MΩ resistors to test them and see how things work out. The device is in a very low noise environment so I'm fairly optimistic.

Again, many thanks for your help.

#### ericgibbs

Joined Jan 29, 2010
13,205
hi cm,
Also take this into consideration. battery shelf life.
E

#### Attachments

• 14.4 KB Views: 5

#### cmartinez

Joined Jan 17, 2007
7,360
hi cm,
Also take this into consideration. battery shelf life.
E
Duly noted, Eric. Thanks. Your list doesn't mention the latest generation of non-rechargeable Lithium batteries, which have a shelf life of up to 20 years.

#### ericgibbs

Joined Jan 29, 2010
13,205
hi cm,
I have had some poor experiences with Lithium batteries some years ago, after a couple of years or so. leaking a corrosive liquid.
I would advise checking with the battery manufacturer.

E

#### cmartinez

Joined Jan 17, 2007
7,360
They had better be telling the truth:

#### Kjeldgaard

Joined Apr 7, 2016
451
Depending on the function of the Reed Contact, I could suggest using the internal Pull Up function - disabled except for a few Micro Seconds to read Contact Status.