I'm using 4.7kOhm resistor as pullups for GPIOs 2,0,2,16, CH_PD and RESET, and also 4.7kOhm pulldown for GPIO 15. The ESP8266 boots and works fine. Would it be okay for a long shot? Should I use 10kOhm instead of 4.7kOhm?

  • I use 10k and have never had an issue - Note: I don't use any pullup for RESET (I think it's reset, it's one of CH_PD or RESET in any case), as all my ESP modules (07/12E/12F based) have "on board" pullup. I've also never had a pullup for GPIO16 because I've never used it for anything, and it's state at power on is irrelevant - only reset and ch_pd (obviously) and 0/2/15 are "important" at power on Feb 19 '18 at 1:57
  • Would it be okay for a long shot? - what is a "long shot" in this instance?
    – Nick Gammon
    Feb 19 '18 at 4:54
  • @NickGammon "in the future"
    – JFetz2191
    Feb 19 '18 at 6:36
  • @JFetz2191, that should be "long haul" ... as in "Would it be ok in the long haul?"...... "long shot" means "something that is most likely to fail"
    – jsotola
    Feb 19 '18 at 7:09
  • Oh, OK, I thought it might have meant "over a long distance".
    – Nick Gammon
    Feb 19 '18 at 8:37

In general it makes little or no difference what the value of resistor you use is.

The only things it can affect are:

  • The current consumption while a button is pressed - a lower value resistor will cause more current to flow while for the time the button is pressed (it makes no difference at other times).
  • The LOW voltage (VIL) read at the IO pin if the button has a high resistance (for example if it's on the end of a 500m length of cable).
  • Noise immunity - a lower value resistor will pull the pin up "harder" making it more difficult for noise induced in a long wire (see the previous point, too) from causing a false button press (although this is less of a concern with modern digital inputs that tend to all have Schmitt triggers).

10k is often chosen not because it's "better" than any other value, but purely because it's more common that many other values, and it's in the right kind of ball-park for most setups. It's low enough to give good noise immunity while being high enough to not cause undue current flow while the button is pressed. But more importantly, it's a resistor that everyone has in their kit, and is most likely the most common resistor used in a number of other places in the circuit as well. It's a good all-rounder as far as resistors go.

To take a closer look at the current flow aspect - if you are running (as with an ESP8266) at 3.3V and you have a 10k resistor the current flow, when the button is pressed and the resistor connected directly to ground, though the resistor would be (I=V/R) 3.3/10,000 = 330uA. If you used a 4.7k resistor (as you are doing at the moment) the current rises to 3.3/4,700 = 702uA. Yes, that's just over double the current, but twice peantus is still peanuts. So 4.7k, under most general circumstances, is perfectly fine.

However if power consumption is a real concern and you want to keep all consumption to an absolute minimum switching to 100k (as you often see in low-power circuits) would be beneficial, since 3.3/100,000 is 33uA.

If your input is connected to a momentary button which will be pressed for fractions of a second at a time it's not that much of an issue. But if the input is connected to a switch that could be activated for days or weeks at a time it obviously becomes of greater interest.

So in short: when running on batteries higher value pullup resistors are better, but when running off a power supply it really makes no difference.

  • If you need pull-up just for buttons and similar inputs, 100k is pretty fine. But if you use open-drain bus (e.g. I2C), then resistor values have to be calculated properly. If you want to achive 400kHz speed on I2C, even 4k7 might not work and you may need 3k6 or even lower. It depends on the total capacitance of all traces and devices attached.
    – rastik
    Aug 15 '19 at 19:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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