LED GURUcosycom.com
PAGE 109 OF 150 · MICROCONTROLLERS & LEDS

Driving LEDs with a Transistor from a Pin

A small pin controls a larger load safely.

LED SYMBOLTriangle points from anode to cathode; the arrows show light leaving the part.

Boosting a pin

When an LED needs more current than a pin can give, let the pin drive a transistor and let the transistor carry the load.

Example

A 5 V pin through a 2.2 kilohm base resistor gives a base current of (5 − 0.7) ÷ 2,200 ≈ 2 mA. That saturates an NPN transistor carrying about 20 mA, with the LED and its resistor in the collector.

For strips and power LEDs use a logic-level MOSFET, with a 10 kilohm resistor from gate to ground to keep it off at start-up.

REMEMBER
The pin signals; the transistor supplies the power.

Try it yourself

Sketch the circuit on paper first, calculate the values, then build it on a solderless breadboard using a low-voltage supply. Measure with a multimeter before you make anything permanent.

Explore LED clocks, stopwatches and electronics at cosycom.com.

Watch: COSYCOM channel videos

www.youtube.com/@cosycom