← Back to Electronics

Calculator

Select platform:
LED colour (sets typical Uf):
V
HIGH output voltage of the GPIO pin
V
Check LED datasheet
mA
5–20 mA typical. Check GPIO limit!

GPIO current limits — quick reference

PlatformGPIO voltageMax per pinMax totalNotes
Arduino Uno / Nano5 V40 mA200 mASafe limit: 20 mA per pin to avoid damage
Arduino Mega5 V40 mA200 mASame ATmega family limits
ESP323.3 V40 mA~1200 mA total chipRecommended ≤ 12 mA per GPIO for reliability
ESP8266 (NodeMCU)3.3 V12 mAStrictly 12 mA max per pin
Raspberry Pi (all)3.3 V16 mA50 mAVery sensitive — use a transistor for higher currents
STM323.3 V25 mADepends on package; check datasheet
Arduino Pro Mini 3.3V3.3 V40 mASame ATmega328 but 3.3 V supply

Good to know

Formula

R = (Vgpio − Uf) / If

P = (Vgpio − Uf) × If
  = If² × R

Current recommendations

  • 5 mA — dim status indicator, minimal GPIO load
  • 10 mA — standard indicator, safe for all platforms
  • 15–20 mA — bright; only for Arduino 5V, with care
  • Modern high-efficiency LEDs are bright at 5–10 mA
  • Never connect LED directly to GPIO without a resistor!

Driving multiple LEDs

  • Each LED needs its own series resistor
  • Total GPIO current = sum of all LED currents
  • If total > 50 mA, use a transistor or MOSFET driver
  • For many LEDs: use a shift register (74HC595) or LED driver (MAX7219)

Active HIGH vs active LOW

  • Active HIGH — LED anode to GPIO, cathode via R to GND (common)
  • Active LOW — LED cathode to GPIO, anode via R to Vcc (LED ON when GPIO = LOW)
  • Active LOW slightly reduces GPIO source current — sometimes preferred
  • Built-in LED on most boards is active LOW (connected to GND through LED)