☝ Measuring internal pull-up and pull-down internal resistance of the ESP32

Intro

So, you definitely know, that you can optionally enable or disable weak (because resistance is pretty high) pull-up (for positive) or pull-down (for negative) internal resistor to set stable logic level.

ImageImage

But what is the actual resistance have those pull-up/pull-down resistors? Let's find out this 🤨

Code

Using Arduino framework I configured GPIO1 pin as OPEN DRAIN with pull-up:

  1. #define GPIO_PULLUP 1
  2.  
  3. // the setup function runs once when you press reset or power the board
  4. void setup() {
  5. // initialize digital pin LED_BUILTIN as an output.
  6. pinMode(GPIO_PULLUP, INPUT_PULLUP);
  7.  
  8. pinMode(LED_BUILTIN, OUTPUT);
  9.  
  10.  
  11. }
  12.  
  13. // the loop function runs over and over again forever
  14. void loop() {
  15. digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
  16. delay(1000); // wait for a second
  17. digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
  18. delay(1000); // wait for a second
  19. }
  20.  

Pin States

So, after configuring GPIO1 now can have one of two states:

SINK LOW (GPIO: 0V)WEAK HIGH (GPIO: 3.3V)
ImageImage
  1.  

Measuring

It's easy to do measuring by using multimeter with uA regime, so I just connect positive probe to the GPIO1 and negative probe to the devboard GND.

Image

And this cause current flow through internal pull-up resistor, so we can see the real value:

Image

Calculations

Because MCU powering voltage is 3.3V (measured before) and the current is 73.4uA, the resistance is:

R = U/I = 3.3V/73.4 uA = 44.96 kOhm

Datasheet (Update from 2024/02/03)

Hah, I just found that resistance is openly written in the ESP32-S3 datasheet, and as you can see value 45kOhm is corresponds to the calculated resistance 44.96kOhm:

Image

Pull in deep-sleep (Update from 2026/03/03)

Looks like internal pull-up will work in deep-sleep (e.g. for buttons).

Conclusions

  • Earlier I expected weak internal resistors value ~47k, so the reality confirmed it 😎
  • Calculated value corresponds to the specified in the datasheet
9.29K
0
Federico 8 months ago #

Muhh!!

From  the following relation we can calculate the unknown value of the internal pull-up resistor associated to a GPIO  pin that is configured as an input pull-up in the Arduino's sketch. 

I= (Vcc — Vfb) / R

having :

Vcc = 3.3V esp32 MCU power supply

Vfb =? V Forward V of the built-in LED 

I = 73.4uA measured LED current 

the calculated internal pull-up resistor value or magnitude is equal to:

R =  (Vcc — ?) / I

R = ((3.3 — ?)/73.4)*10^3 =  ?? kOhm.

0
devanesh 5 months ago #

3mV

Cookies?