Pull-up or pull-down resistors on ESP32

Hi there.
I'm working on a ESP project where I have several switches as inputs. I was wondering if I needed to actually use external resistors, considering that most of the pins on the ESP have internal pull-up and pull-down resistors, don't they? I just need to define them in pinMode as INPUT_PULLUP or INPUT_PULLDOWN.
Which of the two should I go for?
Considering that the ESP boards work at 3.3V, should the HIGH value be 3.3V or it's still 5V?
I'm using an ESP32 WROOM 32 and a WEMOS D1 Mini, and both do very similar things.

If you have a choice still go for pull up.

Thank you. Can I use the 3.3V pin from the ESP itself to connect these pull-up resistors? I have no other 3.3V source.
Would a 100k ohm resistor be a good value?

Dude, the ESP32 on portA has internal pullup/pulldown resistors.

pinMode(BUTTON_PIN, INPUT_PULLUP); sets the internal pullup resistor.

That's what I said in my first message, but I misunderstood what Mike said and for some reason I understood he said I should go for external pull-up resistors.
What do you mean by portA?

ESP32 port info read all about it:
API Reference - ESP32 - — ESP-IDF Programming Guide latest documentation (espressif.com)

pull ups. Then you don't have to run live Vcc power wires away from the board where they could short the whole system if they touch a ground.

Thank you. So I really only need to connect the switches to GND and the related pins and that's all, right?

Correct, for individual switches that is the best and easiest way. Only a matrix can't work that way, in that case the switches have to connect to column drivers instead of ground.

Also realize that the input logic will be reversed, LOW when the switch is closed. That is trivial to change in software.

1 Like