MICROCONTROLLERS · BEGINNER

Keep ESP32 GPIO pins within safe limits

GPIO pins are signal outputs, not power supplies. A correct circuit keeps voltage within the board's limits and controls load current with a resistor, transistor or dedicated driver.

Open the ESP32 GPIO example

Three rules before connecting a GPIO

  1. Use only logic-level voltage. ESP32 GPIO is designed for approximately 0–3.3 V; never connect a 5 V or 9 V source directly to a pin.
  2. Limit current. An LED needs a series resistor. A GPIO should not power a motor, relay, lamp or high-power LED directly.
  3. Share a ground reference. A driver circuit and ESP32 need a defined common ground for the signal to have meaning.

Driving an LED safely

Connect the GPIO to a resistor, then to the LED, with the LED return connected to ground. Choose the resistor from the supply voltage, LED forward voltage and a modest target current. In the simulator, select the ESP32 to see a GPIO-current warning when the limit is exceeded.

R = (VGPIO − VLED) ÷ ILED

When to use a transistor

For loads that need more current or a different supply voltage, use the GPIO as a control signal. An NPN transistor or MOSFET switches the load; the load supply provides its current. Inductive loads such as relays and motors also need a flyback diode.

Simulation warning versus hardware safety

The GPIO warning is a useful design check, not a certification of a real board. Confirm the exact board pinout, boot-strapping pins, per-pin and total GPIO-current limits in the manufacturer documentation before building hardware.

More circuit learning topics