NPN transistor switch on a breadboard

Step-by-step 3D breadboard guide: BC547 or PN2222A driving an LED or a relay coil, base resistor, flyback diode and pinout.

🔒 Your data stays in your browser: nothing you type or upload is sent to a server.

How it works

Choose the transistor, the load (LED or relay coil), the supply and the current. The guide sizes the base resistor for saturation, gives the power in the transistor and shows the pin order, which differs between a BC547 and a PN2222A.

Formula

Rb = (Vin − 0.7 V) / (Ic / 10)

Common questions

Why Ic / 10 for the base current?

As a switch the transistor must be saturated, and datasheets guarantee that with a forced gain of about 10, much lower than the gain in linear use. It leaves margin for the spread between units.

Why a diode across the relay coil?

When the transistor opens, the coil forces its current to continue and the voltage spikes far above the supply. The 1N4007, with its cathode to the supply, gives that current a path and protects the transistor.

Related tools