Author Topic: How to size external pull up resistor?  (Read 871 times)

0 Members and 1 Guest are viewing this topic.

Offline pacmannTopic starter

  • Contributor
  • Posts: 31
  • Country: jp
How to size external pull up resistor?
« on: April 28, 2023, 08:54:59 am »
How do you size the external pull up resistor that connects to a GPIO input? The other side is  an open drain comparator to indicate if a cable is connected, not high speed switching. Does it depend on microcontroller GPIO properties?
 

Offline peter-h

  • Super Contributor
  • ***
  • Posts: 3700
  • Country: gb
  • Doing electronics since the 1960s...
Re: How to size external pull up resistor?
« Reply #1 on: April 28, 2023, 10:24:52 am »
Yes; check the CPU data sheet for any permanently connected pullups or pulldowns, and check your init code to see whether any of these are being enabled by software. If you can enable a pullup in software, you may not need one externally (although the internal ones tend to have a really wide tolerance).

Apart from the above, your external resistor can be almost any reasonable value, within limits of leakage. Use whatever resistor you have lots in stock, like 100k ;)
Z80 Z180 Z280 Z8 S8 8031 8051 H8/300 H8/500 80x86 90S1200 32F417
 

Offline Picuino

  • Frequent Contributor
  • **
  • Posts: 730
  • Country: 00
    • Picuino web
Re: How to size external pull up resistor?
« Reply #2 on: April 28, 2023, 10:28:20 am »
10k Ohm works well and does not draw too much current. If you want higher rise speed, put a smaller resistor.
 

Offline jpanhalt

  • Super Contributor
  • ***
  • Posts: 3479
  • Country: us
Re: How to size external pull up resistor?
« Reply #3 on: April 28, 2023, 10:45:55 am »
As for value, if your MCU shows typical current for an internal weak pull-up (WPU), you can calculate the equivalent resistance.  For PIC's, that current is given.  For example, if the WPU current is 100 uA at 5V = 50k.  That's an "equivalent" resistance and doesn't mean the MCU actually uses a resistor.  It's my understanding it may actually be a mosfet (https://electronics.stackexchange.com/questions/109074/internal-pullup-for-input-in-pic-microcontroller )

You can also look at the impedance of an input and use that to calculate how much current you want the pull-up to allow.  Of course, lower values may be needed depending on the purpose.  For example, I2C would likely need something lower than 50k to 100k.
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 8178
  • Country: fi
Re: How to size external pull up resistor?
« Reply #4 on: April 28, 2023, 04:41:32 pm »
Things to consider
* Noise immunity (higher the R, higher the coupled noise voltage)
* Switching speed (higher the R, slower the charge of parasitic C)
* Margin for low level logic threshold (the lower the R, the higher the voltage when transistor is pulling it to GND because transistor has on-state R, say ~50 ohms for an open drain IO pin)
* Power consumption (during low state, I = U/R)

TLDR:
Hundreds of k for battery operated things (careful with noise and speed).
4.7k - 10k general purpose
1k high speed I2C etc. (lower than that and '0' state voltage quickly becomes a problem)
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14487
  • Country: fr
Re: How to size external pull up resistor?
« Reply #5 on: April 28, 2023, 06:15:15 pm »
TLDR: it depends. ;D
 

Online temperance

  • Frequent Contributor
  • **
  • Posts: 452
  • Country: 00
Re: How to size external pull up resistor?
« Reply #6 on: April 29, 2023, 12:25:07 pm »
And in case of mechanical contacts such as connectors and switches, the minimum wetting current should be considered.
Some species start the day by screaming their lungs out. Something which doesn't make sense at first. But as you get older it all starts to make sense.
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19528
  • Country: gb
  • 0999
Re: How to size external pull up resistor?
« Reply #7 on: April 29, 2023, 01:21:51 pm »
And in case of mechanical contacts such as connectors and switches, the minimum wetting current should be considered.
A small capacitor in parallel, say 100nF, can help with that.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf