Bipolar junction transistor in TO-92 through-hole package. Available as NPN (BC547, 2N3904, BC337, 2N2222 — current flows C→E when base is high relative to emitter) or PNP (BC557, 2N3906, BC327 — current flows E→C when base is low relative to emitter). Used for low-current switching, signal amplification, and as a small-load driver (≤500 mA).
| Pin | Signal | Description |
|---|---|---|
B |
Base — control input, drive via 1k-10k resistor | |
C |
Collector — high side of switched current path (NPN: load side, PNP: GND side) | |
E |
Emitter — low side of switched current path (NPN: GND, PNP: Vcc) |
3-pin TO-92 component. Use componentId transistor-bjt and put the part number + polarity in the label, e.g. 'BC547 NPN', '2N3906 PNP', '2N2222 NPN'. Pins: B (Base), C (Collector), E (Emitter). NPN: load between Vcc and Collector; Emitter to GND; Base to Arduino pin via 1k-10k resistor. PNP: Emitter to Vcc; load between Collector and GND; Base to Arduino pin via 1k-10k resistor (active-low). Always include a base resistor — NEVER drive the base directly from a microcontroller pin.
| From | To | Wire |
|---|---|---|
board:D9 |
r1:1 |
green |
r1:2 |
x1:B |
blue |
x1:E |
board:GND |
black |
board:5V |
led1:ANODE |
red |
led1:CATHODE |
x1:C |
yellow |
This example was written and compile-checked for the arduino-uno. Codey Online adapts it to any other supported board for you.
const int transistorPin = 9;
void setup() {
pinMode(transistorPin, OUTPUT);
Serial.begin(9600);
Serial.println("BJT transistor example: blinking an LED through an NPN transistor.");
}
void loop() {
Serial.println("Transistor ON");
digitalWrite(transistorPin, HIGH); // Base driven HIGH through resistor
delay(1000);
Serial.println("Transistor OFF");
digitalWrite(transistorPin, LOW);
delay(1000);
}
Describe what you want to build. Codey Online writes the code, draws the wiring diagram, compiles it and flashes your board straight from the browser.
Start for free