NPN·PNP 트랜지스터를 스위치로 쓰는 방법, 베이스 저항 계산, 부품마다 다른 TO-92 핀 배열(EBC·CBE)을 확인하는 요령을 정리했습니다.How to use NPN and PNP transistors as switches, calculating the base resistor, and checking the TO-92 pinout (EBC or CBE), which differs between parts.
마이크로컨트롤러나 로직 IC의 출력 핀은 LED 한두 개 켜기에도 벅찰 만큼 전류가 작습니다. 이럴 때 작은 신호로 큰 전류를 켜고 끄는 부품이 트랜지스터입니다. 이 글에서는 가장 흔한 바이폴라 트랜지스터(BJT)를 스위치로 쓰는 방법과 베이스 저항 계산, 부품마다 다른 핀 배열을 확인하는 요령을 정리합니다.
트랜지스터의 세 단자
BJT는 이미터(E), 베이스(B), 컬렉터(C) 세 단자가 있습니다. 베이스에 흐르는 작은 전류로 컬렉터에서 이미터로 흐르는 큰 전류를 조절합니다.
NPN: 베이스에 전류를 넣으면(High) 컬렉터에서 이미터로 전류가 흐릅니다. 이미터를 접지(GND)에 둡니다.
PNP: 베이스에서 전류를 빼면(Low) 이미터에서 컬렉터로 전류가 흐릅니다. 이미터를 +V에 둡니다.
스위치로 쓸 때는 완전히 켜는 포화 상태와 완전히 끄는 차단 상태만 씁니다. 포화되면 컬렉터-이미터 전압이 약 0.1~0.3V까지 낮아져 거의 닫힌 스위치처럼 동작합니다.
핀 배열은 부품마다 다릅니다
같은 TO-92 패키지라도 부품에 따라 다리 순서가 다릅니다. 납작한 면을 앞으로 보고 다리를 아래로 둔 상태에서 왼쪽부터 읽습니다.
가장 큰 사고 원인이 핀 배열 착오입니다. 2N3904와 2N3906은 E-B-C, BC547과 BC337은 C-B-E, 일부 일본 부품(2SC1815 등)은 E-C-B입니다. 데이터시트의 핀 배치를 반드시 확인하세요(데이터시트 읽는 법). 패턴도에서는 트랜지스터마다 NPN·PNP 극성과 핀별 역할(E·B·C)을 직접 고를 수 있어 실제 부품의 핀 배열에 맞춰 배치할 수 있습니다.
부하를 +V와 컬렉터 사이에 넣고 이미터를 접지에 연결하는 구성입니다. 입력이 High이면 베이스에 전류가 흘러 부하가 켜집니다.
베이스 저항 계산
베이스 전류는 포화를 보장하도록 컬렉터 전류의 약 1/10로 잡습니다(강제 베타 10). 입력 전압에서 베이스-이미터 전압(약 0.7V)을 뺀 값을 베이스 전류로 나눕니다.
Ib = Ic / 10
R_B = (입력 전압 - 0.7V) / Ib
컬렉터 전류
베이스 전류
R_B (5V 입력)
R_B (3.3V 입력)
10mA
1mA
4.3kΩ → 4.7kΩ
2.6kΩ → 2.2kΩ
50mA
5mA
860Ω → 820Ω
520Ω → 470Ω
100mA
10mA
430Ω → 390Ω
260Ω → 220Ω
2N3904와 2N3906의 연속 컬렉터 전류 한도는 약 200mA입니다. 입력 핀이 줄 수 있는 전류(보통 수 mA~20mA)도 확인하세요. 100mA급 부하를 켜려면 베이스 전류 10mA가 필요하므로 핀 허용 전류에 맞는지 봐야 합니다.
예를 들어 5V 로직 신호로 LED를 10mA에 켜려면, LED 저항 (5 − 2 − 0.1) ÷ 0.01 ≈ 300Ω, 베이스 저항 4.7kΩ이면 됩니다.
PNP 스위치 회로
이미터를 +V에, 컬렉터를 부하를 거쳐 접지에 연결하는 하이사이드 스위치입니다. 베이스를 접지 쪽으로 당겨야 켜지므로 입력이 Low일 때 켜집니다. 꺼 둘 때는 베이스가 이미터와 같은 전압(+V)이 되어야 하므로 베이스와 +V 사이에 10kΩ 정도의 풀업 저항을 둡니다.
흔한 실수
실수
결과
예방
베이스 저항 생략
베이스 전류가 폭주해 입력 핀이나 트랜지스터 손상
항상 직렬 저항 사용
핀 배열 착오
동작하지 않거나 발열
데이터시트로 확인
유도성 부하에 다이오드 없음
역기전력으로 트랜지스터 파손
부하에 역방향 병렬 다이오드
접지 공유 누락
신호 기준이 달라 동작 안 함
마이크로컨트롤러와 부하 전원의 GND 연결
전류 한도 초과
과열
큰 전류는 MOSFET이나 전용 드라이버
패턴도에서 확인하기
패턴도에는 2N3904(NPN), 2N3906(PNP) 트랜지스터가 있어 연결 방향과 극성이 맞는지, 베이스에 전압이 걸리면 LED가 켜지는지 시뮬레이션으로 확인할 수 있습니다. 다만 시뮬레이션의 트랜지스터는 베이스와 이미터 사이 전압이 약 0.5V를 넘으면 켜지는 단순한 스위치 모델이어서 전류 증폭률(hFE)이나 포화 정도는 반영하지 않습니다. 그래서 베이스 저항을 아주 크게 바꿔도 LED가 어두워지지 않습니다. 베이스 저항 값은 이 글의 계산식으로 직접 구하고, 실제 부품에서 밝기와 발열을 확인하세요. 시뮬레이션 사용법은 패턴도 시뮬레이션 사용법에 있습니다.
정리
NPN은 이미터를 접지에 두고 High로 켜며, 베이스 저항은 (입력 전압 − 0.7V) ÷ (컬렉터 전류 ÷ 10)으로 구합니다. 핀 배열은 부품마다 다르니 데이터시트를 확인하고, 유도성 부하에는 반드시 플라이백 다이오드를 달아야 합니다. 큰 부하의 예는 모터·릴레이·솔레노이드 구동, 직접 만들어 보려면 트랜지스터 2개로 만드는 LED 깜빡이를 보세요.
The output pin of a microcontroller or logic IC supplies so little current that even lighting one or two LEDs strains it. In that situation, the part that switches a large current on and off with a small signal is the transistor. This article covers how to use the most common bipolar junction transistor (BJT) as a switch, how to calculate the base resistor, and how to check the pinout, which differs between parts.
The three terminals of a transistor
A BJT has three terminals: emitter (E), base (B), and collector (C). A small current in the base controls a large current from the collector to the emitter.
NPN: when current is put into the base (High), current flows from collector to emitter. Put the emitter on ground (GND).
PNP: when current is drawn out of the base (Low), current flows from emitter to collector. Put the emitter on +V.
As a switch you use only the fully-on saturated state and the fully-off cut-off state. When saturated, the collector–emitter voltage falls to about 0.1–0.3 V, and it behaves almost like a closed switch.
The pinout differs between parts
Even in the same TO-92 package, the lead order differs by part. Read from the left with the flat face toward you and the leads pointing down.
The biggest cause of accidents is getting the pinout wrong. The 2N3904 and 2N3906 are E-B-C, the BC547 and BC337 are C-B-E, and some Japanese parts (such as the 2SC1815) are E-C-B. Always check the pinout in the datasheet (see How to Read a Datasheet). In Patterndo you can pick the NPN or PNP polarity and the role of each pin (E, B, C) for each transistor, so you can lay it out to match the pinout of the real part.
The NPN switch circuit
An NPN low-side switch. The load (LED and resistor) goes between +V and the collector, and the emitter goes to ground.
This arrangement puts the load between +V and the collector and connects the emitter to ground. When the input is High, current flows into the base and the load turns on.
Calculating the base resistor
Set the base current to about 1/10 of the collector current to guarantee saturation (forced beta of 10). Subtract the base–emitter voltage (about 0.7 V) from the input voltage and divide by the base current.
Ib = Ic / 10
R_B = (input voltage - 0.7V) / Ib
Collector current
Base current
R_B (5 V input)
R_B (3.3 V input)
10 mA
1 mA
4.3 kΩ → 4.7 kΩ
2.6 kΩ → 2.2 kΩ
50 mA
5 mA
860 Ω → 820 Ω
520 Ω → 470 Ω
100 mA
10 mA
430 Ω → 390 Ω
260 Ω → 220 Ω
The continuous collector current limit of the 2N3904 and 2N3906 is about 200 mA. Also check the current the input pin can supply (usually a few mA to 20 mA). To switch a 100 mA load you need 10 mA of base current, so check that it fits the pin's allowed current.
For example, to light an LED at 10 mA from a 5 V logic signal, the LED resistor is (5 − 2 − 0.1) ÷ 0.01 ≈ 300Ω and a 4.7 kΩ base resistor will do.
The PNP switch circuit
This is a high-side switch with the emitter on +V and the collector going through the load to ground. The base has to be pulled toward ground to turn it on, so it turns on when the input is Low. To keep it off, the base has to be at the same voltage as the emitter (+V), so put a pull-up resistor of about 10 kΩ between the base and +V.
Common mistakes
Mistake
Result
Prevention
Leaving out the base resistor
Base current runs away and damages the input pin or transistor
Always use a series resistor
Wrong pinout
Does not work, or gets hot
Check against the datasheet
No diode on an inductive load
Back-EMF destroys the transistor
A reverse parallel diode across the load
Missing shared ground
The signal references differ so it does not work
Connect the GND of the microcontroller and the load supply
Exceeding the current limit
Overheating
Use a MOSFET or dedicated driver for large current
Checking in Patterndo
Patterndo has the 2N3904 (NPN) and 2N3906 (PNP) transistors, so you can check by simulation that the connection direction and polarity are right and that the LED lights when voltage is applied to the base. However, the transistor in the simulation is a simple switch model that turns on when the voltage between base and emitter exceeds about 0.5 V, and it does not reflect current gain (hFE) or the degree of saturation. So even if you change the base resistor to a very large value, the LED does not dim. Work out the base resistor value yourself with the formulas in this article, and check brightness and heat on the real part. How to use simulation is in Using Patterndo Simulation.
Summary
An NPN has its emitter on ground and turns on with High, and the base resistor is (input voltage − 0.7 V) ÷ (collector current ÷ 10). The pinout differs between parts so check the datasheet, and inductive loads must have a flyback diode. For examples with big loads, see Driving Motors, Relays, and Solenoids, and to build one yourself, An LED Flasher with Two Transistors.
에디터에서 직접 해 보기Try it in the editor
읽은 내용을 패턴도 에디터에서 바로 확인해 보세요. 회원가입 없이 열리고, 납땜 전에 배치와 배선을 몇 번이고 고쳐 볼 수 있습니다.Try what you just read right in the Patterndo editor. It opens without sign-up, and you can rework the layout and wiring as many times as you like before you solder.
이 글은 학습 목적의 일반적인 안내입니다. 부품마다 규격과 핀 배열이 다를 수 있으니 실제 작업 전에는 사용하는 부품의 데이터시트를 확인하세요. 안전과 관련된 작업은 항목별 주의 사항을 먼저 읽고 진행하세요.This article is general guidance for learning purposes. Specifications and pinouts differ between parts, so check the datasheet of the part you use before real work. For safety-related work, read the cautions for each item first.