CYTHEIA AIOpen the editor

Transistor Switch

A small current into a transistor base switches a larger current through an LED.

Open this circuit and run it

Opens in your browser with the parts, wiring and code already in place. Press Run to watch it work, then change anything you like.

How it works

A pin on a microcontroller can only supply a few tens of milliamps, so anything that needs more is switched by a transistor. Here an NPN transistor sits between the LED and ground. The LED and its 330 ohm resistor run from the 5 volt supply down to the transistor collector. When the button is pressed, 5 volts reaches the base through a 10 kilohm resistor and a small current of about 0.4 milliamps flows into it.

That small base current lets a much larger one flow from collector to emitter, enough to light the LED at around 9 milliamps, and the transistor is fully on, or saturated. Release the button and the base current stops, so the LED goes out. The multimeter reads the base voltage, which sits near 0.7 volts whenever the transistor is on, the forward voltage of its base-emitter junction. No sketch is needed.

Parts

Wiring

Arduino code

// Transistor Switch
// Press Run, then hold the button: the multimeter shows the base voltage.
// There is no sketch to write: this is a circuit, so there is nothing for code to do.
void setup() {
}

void loop() {
}

Try changing it

Open this circuit and run it

Next challenge

More projects in Analog Electronics