Recipe
Can this pin drive it directly?
Use when: you want a pin to turn something on, and need to know whether it may connect straight to the pin
Goal: a yes with a calculated current under the pin's limit, or a clear no that sends you to a switch
Taught in GPIO is not a power supply
Quick recipe
-
1
If the load is a motor, relay coil, solenoid, speaker or anything else built around a coil, the answer is no.
Example
A vibration motor, however small: no, because it kicks back a spike when switched off.
Why: a coil's kickback is the danger even when its current is small, so no calculation can make it safe on a bare pin.
-
2
Calculate it with Ohm's law, or read it from the load's datasheet.
Example
A red LED with 470 Ω on a 5 V pin: (5.0 - 2.0)/470 \approx 6.4 mA.
Why: the load sets the current; the pin can't hold it back.
-
3
Use the board's or chip's datasheet; never a number from memory or another board.
Example
Uno R4 Minima: 8 mA (Arduino datasheet, section 9.3). ESP32-S3: about 20 mA at the default drive setting (Espressif datasheet, Table 5-4).
Why: limits differ by chip, and a number from another board can be off by several times.
-
4
The load should sit comfortably under the limit.
- it does — it may connect directly; also add up every loaded pin against any total limit.
- it doesn't — put a switch between the pin and the load (the next three sections).
Why: parts vary from their typical values, and a pin run at its limit sags and heats.
Common mistakes
- Using a typical figure for a part that varies, then landing over the limit.
- Checking each pin alone and forgetting that many loaded pins share one supply.
- Reading a stress rating such as an absolute maximum as a safe working value.