Transistor Switch
A small current into a transistor base switches a larger current through an LED.
- Intermediate
- Analog Electronics
- 8 parts
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
- DC Supply
- Push Button
- 2 × Resistor
- LED
- NPN Transistor
- GND
- Multimeter
Wiring
- DC Supply + → Push Button A
- Push Button B → Resistor 1 A
- Resistor 1 B → NPN Transistor Base (B)
- DC Supply + → Resistor 2 A
- Resistor 2 B → LED Anode (+)
- LED Cathode (-) → NPN Transistor Collector (C)
- NPN Transistor Emitter (E) → GND
- DC Supply - → GND
- Multimeter V/Ω → NPN Transistor Base (B)
- Multimeter COM → GND
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
- Hold the button down and read the multimeter: the base voltage stays close to 0.7 volts however you change the resistor, because it is a diode drop.
- Change the base resistor Rb to 100000 and the LED gets dimmer, since less base current means less current is allowed through the collector.
- Change the collector resistor Rc to 100 and the LED gets brighter, as the transistor now allows more current.
Next challenge
More projects in Analog Electronics
- Voltage DividerTwo resistors share a supply voltage in proportion to their values. Measure the middle…
- Voltage ReaderAn Arduino reads a two-resistor divider with analogRead and prints the voltage. Change a…
- Thermistor ThermometerA thermistor and a fixed resistor form a divider the Arduino reads. The sketch turns the…
- LED Current LimitingA resistor sets how much current an LED carries. Put a multimeter in series and see it.