Skip to content
Free public beta until December 4, 2026: every course is open, no card needed. After that, the first chapter of each course stays free and full access is a one-time $39 ($19 for up to 100 founding members chosen for helpful feedback). Your progress is kept. How the beta works

Every way to drive a load from a pin

Straight from the pin, through a BJT or a MOSFET, through a relay, or through a driver chip. The load's current, its supply and whether it is a coil decide which.

Start with two numbers: how much current the load needs and what voltage it runs on. Then ask whether it is a coil (a motor, a relay, a solenoid), because a coil kicks back when it switches off.

  • A few milliamps at the board's own voltage (an indicator LED, a module's input) → drive it straight from the pin, with a series resistor where the part needs one. Stay well under the pin's limit: 8 mA per pin on the Uno R4 Minima.
  • More current, or a higher supply, switched on and off → a low-side switch. A small NPN BJT is fine to a few tens of milliamps, as long as its base current fits the pin; for anything bigger use a logic-level N-channel MOSFET, one whose datasheet promises it fully on at your pin's voltage (3.3 V or 5 V).
  • A load on a separate circuit, or one that must be isolated → a relay, driven through a transistor with a flyback diode across the coil, or a solid-state relay whose output type (AC or DC) matches the load.
  • A motor that must reverse, brake or change speed → a motor driver IC (an H-bridge), on its own supply with a shared ground. Servos, steppers and addressable LED strips each take their own signal format, but still get their power from a separate supply, never from the pin.
  • Not enough pins → a 74HC595 shift register gives eight outputs from three pins, within its own per-pin and total limits.

Every coil gets a flyback diode, every separate supply shares a ground with the board, and every limit you design to is the working figure, never the absolute maximum.

Straight from the pin

Per-pin and total current limits, and why a coil on a pin can reset or damage the board.

The one load a pin drives directly every day, sized with R = (V_s - V_f)/I and rounded up to E12.

A pin sources current when it drives HIGH and current flows out; it sinks current when it drives LOW and current flows in.
A limit that must never be exceeded, even briefly, or the part may be damaged.

Example

The Uno R4 Minima's datasheet says its pins "can handle up to 8 mA": design to well under that, never at it.

A transistor switch

An NPN low-side switch, with the base current a tenth of the load current and the base resistor rounded down.

Section

MOSFETs

A logic-level N-channel MOSFET with a gate resistor and a gate pull-down; the threshold is not "fully on".

A switch placed between the load and ground.
A MOSFET that turns fully on from a 3.3 V or 5 V pin.
A transistor turned fully on, acting like a closed switch with only a small voltage across it.

A relay

A coil driven through a transistor, its contact ratings, and when a solid-state relay fits better.

Why a coil's current can't stop instantly, and the spike that follows.

A diode across a coil that gives its current a safe path when it is switched off.
A relay with no moving parts, switching a load with semiconductors controlled by light.

A driver for motors and strips

A separate motor supply, the bulk capacitor, the H-bridge's four useful states and shoot-through.

A driver IC such as the DRV8833, read from its truth table, with speed set by PWM.

Section

Servos

The pin sends only a pulse every 20 ms; the servo's power comes from its own supply.

Section

Stepper motors

A ULN2003A or a STEP/DIR driver between the pin and the coils.

One data wire from the pin, a separate 5 V supply for the strip, and a level shifter from a 3.3 V board.

Four switches around a motor that let firmware drive it in either direction.
Both switches on one side of an H-bridge on at once, shorting the supply.

More outputs than pins

Eight outputs from three pins with a 74HC595, within its per-pin and total current limits.

A chip that converts serial bits to parallel outputs, or parallel inputs to serial bits.