An NPN transistor is a fundamental electronic component used in various applications to amplify or switch electronic signals. It is a type of bipolar junction transistor (BJT) consisting of three layers of semiconductor material with different doping levels. The acronym 'NPN' refers to the arrangement of these layers: a layer of P-type material is sandwiched between two layers of N-type material. In the CBE (Collector-Base-Emitter) configuration, the transistor's collector (C) is connected to the base (B) through a resistor, which is a common setup for amplification circuits.
Pin Number | Name | Description |
---|---|---|
1 | Emitter (E) | Emits electrons into the base region. Connected to ground in NPN circuits. |
2 | Base (B) | Controls the transistor's operation. A small current to the base allows a larger current to flow between the collector and emitter. |
3 | Collector (C) | Collects electrons from the base. Typically connected to the load and power supply. |
// Example code to use an NPN transistor to switch an LED on and off with Arduino UNO
const int basePin = 2; // Pin connected to the base of the transistor
const int ledPin = 13; // Pin connected to the collector of the transistor
void setup() {
pinMode(basePin, OUTPUT); // Initialize the base pin as an output
pinMode(ledPin, OUTPUT); // Initialize the LED pin as an output
}
void loop() {
digitalWrite(basePin, HIGH); // Turn on the transistor
delay(1000); // Wait for 1 second
digitalWrite(basePin, LOW); // Turn off the transistor
delay(1000); // Wait for 1 second
}
Note: The above code assumes that there is a suitable resistor in series with the LED to limit the current and that the LED is connected to the collector of the transistor with the emitter grounded. The base resistor is also assumed to be of a suitable value to limit the base current.