How calculate a PULLDOWN/-UP resisitor?

Hey falks,

I have to questions, but first, I wanna ask one question, and than, the other:

how do you calculate the PULLUP or PULLDOWN resistor for an IC ?

You know, sometimes I use IC's with 3.3V, and sometimes with 5V. So, how do you calculate this ?

I will use those PULLUP or PULLDOWN pins, only for a pushbutton. Therefore, there won't flow to much amps. Only a pushbutton.

Sometimes I use PULLUP, and sometimes PULLDOWN.

For an I2C pull-up you can read this

Thanks, will read this. can I aska you, if there are some questions ??

You can ask the forum whoever knows will answer

1 Like

If you are looking for a formula, there is none.
The value of the pull-up will depend on your paticular set-up.
Even then, it's more of a good engineering estimate of what would work best.

1 Like

most processors these days have options to enable internal pull-up/down resistors on their GPIOs which are of course appropriate for their design

Arduino digital pins can be configured as INPUT_PULLUP to enable their internal pull-up resitor (Arduinos don't have pull-down resistors)

1 Like

Okay, I've read it. And no surprise: I barely understood this :smiley:

Is there maybe a way, to try it out ? for example, with a Potentiometer ??

Okay, it is too complicated :smiley: maybe just give me an example, for an ESP8266-12E Pushbutton with a PULLUP pin.

Use 10K

1 Like

code that toggles several LEDs, each associated with a button configured with a pullup (see pinMode)

// check multiple buttons and toggle LEDs

enum { Off = HIGH, On = LOW };

byte pinsLed [] = { 10, 11, 12 };
byte pinsBut [] = { A1, A2, A3 };
#define N_BUT   sizeof(pinsBut)

byte butState [N_BUT];

// -----------------------------------------------------------------------------
int
chkButtons ()
{
    for (unsigned n = 0; n < sizeof(pinsBut); n++)  {
        byte but = digitalRead (pinsBut [n]);

        if (butState [n] != but)  {
            butState [n] = but;

            delay (10);     // debounce

            if (On == but)
                return n;
        }
    }
    return -1;
}

// -----------------------------------------------------------------------------
void
loop ()
{
    switch (chkButtons ())  {
    case 2:
        digitalWrite (pinsLed [2], ! digitalRead (pinsLed [2]));
        break;

    case 1:
        digitalWrite (pinsLed [1], ! digitalRead (pinsLed [1]));
        break;

    case 0:
        digitalWrite (pinsLed [0], ! digitalRead (pinsLed [0]));
        break;
    }
}

// -----------------------------------------------------------------------------
void
setup ()
{
    Serial.begin (9600);

    for (unsigned n = 0; n < sizeof(pinsBut); n++)  {
        pinMode (pinsBut [n], INPUT_PULLUP);
        butState [n] = digitalRead (pinsBut [n]);
    }

    for (unsigned n = 0; n < sizeof(pinsLed); n++)  {
        digitalWrite (pinsLed [n], Off);
        pinMode      (pinsLed [n], OUTPUT);
    }
}
1 Like

okay, should I use a higher resistor ? to be sure, that there is no distrubance to gurantee a stable pin-status :smiley:

by the way: I allways use PULLUP as a button-pin.

thanks mate :smiley:

Did you read post 5

1 Like

Then use INPUT_PULLUP in pinMode() and job done

yes I did. But my question has no particular circuit. As I said: I simple PUSHBUTTON... like this sheme here...

Except the ones that do.

Using results from a search, your MCU's GPIO pin max current:

The esp8266 and esp-12e both use the same ESP8266 chip, with the only difference being the number of pins. The maximum current that can be drawn from a single GPIO pin is 12mA.

Wetting current is the minimum amount of DC current necessary to keep a mechanical switch contact on a dry loop in good health. Typically, 1-20 mA in copper wire loops. If a mechanical switch contact is operated with too little current, the contacts tend to accumulate excessive resistance and may fail prematurely.

Wetting current (Wikipedia)

I would suggest getting the pullup/pulldown current to within 1-5mA range.

  • Using R = V / I, where V = 3.1, I = 0.001, then R = 3.1K
  • If I = 0.005, then R = 620Ω

Therefore, I would suggest using a 1K to 3.3K pullup/pulldown resistor. This should result in a more robust solution with high noise immunity and high reliability.

That is a particular circuit. You have a single pushbutton on a breadboard and it's only a few inches away from the ESP. So 10K would be fine.
If it's 3 feet away and susceptible to electrical interference I would probably suggest something different. If you use 32 switches again maybe something different.

Do you see my point?

Re post#13 showing 220Ω pulldown resistor. This works out to 14mA current when the button is pressed. I would bump this up to at least 270Ω to get the current calculation within spec.

buttons are typically connected between the pin and ground, the pin configured as INPUT_PULLUP to use the internal pullup resistor which pulls the pin HIGH and when pressed, the button pulls the pin LOW.

Wait a minute, wait a minute. Now I will drop a big`egg right into your nests, falks :smiling_face: it is rather a bomb, than an egg:

okay, I really thought, that this will be an easy-to-answer question. I was wrong :smiley:

Yes, it is a single push_button. But it is only one, on each pin (4 pins in total). All other pins are in also in use. For example:

  • 4 pins with a single push_button (but not all pins are pushed at the same time)
  • 1 pin with LDR sensor
  • 2 pins which controlls an L293D DC driver

okay, do you again recommending me, to use a 10K resistor for the push_button-pins ?

Okay, falks, here is my shematic.

The motor is for an RC robot. All resistors does have 10K Ohms.

Do you guys agree with my shematic ?