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
| Platform | GPIO voltage | Max per pin | Max total | Notes |
|---|---|---|---|---|
| Arduino Uno / Nano | 5 V | 40 mA | 200 mA | Safe limit: 20 mA per pin to avoid damage |
| Arduino Mega | 5 V | 40 mA | 200 mA | Same ATmega family limits |
| ESP32 | 3.3 V | 40 mA | ~1200 mA total chip | Recommended ≤ 12 mA per GPIO for reliability |
| ESP8266 (NodeMCU) | 3.3 V | 12 mA | — | Strictly 12 mA max per pin |
| Raspberry Pi (all) | 3.3 V | 16 mA | 50 mA | Very sensitive — use a transistor for higher currents |
| STM32 | 3.3 V | 25 mA | — | Depends on package; check datasheet |
| Arduino Pro Mini 3.3V | 3.3 V | 40 mA | — | Same 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)