Blog
ESP32 GPIO Pins: Safe Pins, Pull-ups, Limits
Which pin is safe, which one bites at boot, and what the pull-up situation actually is. The pinout looks random until you know three rules: strapping pins, input-only pins, and current limits.
What Pin Is Built in LED on ESP32?
On most classic ESP32 dev kits the built-in LED hangs off GPIO2 — a board decision, not a chip one. ESP32-S3 DevKitC-1 boards use GPIO48; C3 Super Minis use GPIO8. Start with the LED_BUILTIN constant and trust the silkscreen if it stays dark. New to flashing? Our getting-started FAQ.
Is D18 Pin 18 ESP32?
Yes. The D prefix is a digital label; the number is the real GPIO, so D18 = GPIO18. On every board I’ve wired the mapping held — if a clone disagrees, suspect the silkscreen before the chip.
How to Read a Digital Input on ESP32?
Two calls: pinMode(pin, INPUT) then digitalRead(pin). Use INPUT_PULLUP for buttons wired to GND, debounce anything mechanical, and loop a pin array to read multiple GPIOs at once. A “random” reading is almost always a missing pinMode — pins float until configured.
How to Set Input Pins on ESP32?
pinMode(pin, INPUT), INPUT_PULLUP, or INPUT_PULLDOWN; the pull versions use internal resistors around 45kΩ — the official docs are vague on the exact value. Exception: GPIO34-39 are input-only, no output and no pull resistors, so “can i use pin 35 esp32 for input pullup” gets a no — external 10kΩ, or move to GPIO32/33.
Is GPIO0 Safe to Use as Output on ESP32?
After boot, yes — as long as nothing holds it low during reset, or the chip boots into download mode instead of your firmware. GPIO0 is a strapping pin with an onboard pull-up; the classic trap is an LED to GND that lights at boot. GPIO2 is a strapping pin too, and GPIO4 is a strapping pin as well — the club is 0, 2, 4, 5, 12, 15. GPIO12 held high at reset switches flash to 1.8V and the module won’t boot.
How Do You Reference ESP32 Pinouts?
Trust your board’s silkscreen first, Espressif’s DevKitC pinout PDF second — 30-pin clones drop GPIO37/38 and relabel pins. A schematic jumper between GPIO20 and GPIO23 is vendor-specific; nothing on the chip requires it. Most peripherals remap anyway: Serial2.begin(115200, SERIAL_8N1, 16, 17) moves U2RXD/U2TXD anywhere. The KB has a per-board table.
Do I need external pull-up resistors?
For buttons, no — INPUT_PULLUP is enough. For I2C on a breadboard, mostly no: SDA/SCL default to GPIO21/GPIO22, and internal resistors carry short runs. Long wires, many devices, or open-drain at speed: add 4.7kΩ. Internal pull-ups are weak by design; a line that only misbehaves sometimes wants the external resistor.
Can I drive an LED straight from a GPIO?
A single LED with a 220-330Ω series resistor, yes. The datasheet allows 40mA per pin absolute max, but keep LEDs at 10-20mA — the 3.3V regulator’s total budget matters more. Should you use transistors for ESP32 LED switching? For one or two LEDs, no; for strips or relays, use a small MOSFET. I ran eight LEDs off one WROOM and the regulator ran warm.
How to Toggle GPIO in ESP32?
Setting a pin high in ESP32 code is digitalWrite(pin, HIGH); toggling is digitalWrite(pin, !digitalRead(pin)). For timed toggles, millis() beats delay(). A toggle that never works on 34-39 isn’t the code — those are input-only.
Where is the VIN pin?
VIN is a power pin, not a GPIO — it has no pin number. It’s the 5V USB rail behind the regulator, a corner pin on most dev boards, and it expects 5V; the onboard regulator handles 9-12V poorly. Searched “what number pin is the vin pin on esp32”? The answer is none — it’s never digital.
Watch GPIO Behave — Analog, Digital, Event — In Your Browser
Pin rules make sense the moment you watch them work. Both of these run free in our browser simulator, no hardware:
- Joystick on ESP32 — two ADC pins and one digital input, all visible live:
ESP32 Joystick ready
X= 512( 50%) Y=2048( 99%) BTN=---
X= 512( 50%) Y=2048( 99%) BTN=PRESSED
Drag the virtual knob and the raw counts track it — that is input-only ADC GPIO doing its job, with the button flipping a plain digital pin between high and low.
- PIR motion sensor on ESP32 — an input that signals events, not levels:
ESP32 PIR Motion Sensor
Ready!
[15234 ms] Motion detected! (count: 1)
No motion.
Run these two and the safe-pin question stops being abstract: power from 3V3, keep the strapping pins out of your circuit unless you mean it, and give input-only pins jobs that never ask them to output.