목차 보기
  1. 트랜지스터의 세 단자
  2. 핀 배열은 부품마다 다릅니다
  3. NPN 스위치 회로
  4. PNP 스위치 회로
  5. 흔한 실수
  6. 패턴도에서 확인하기
  7. 정리
Table of contents
  1. The three terminals of a transistor
  2. The pinout differs between parts
  3. The NPN switch circuit
  4. The PNP switch circuit
  5. Common mistakes
  6. Checking in Patterndo
  7. Summary

마이크로컨트롤러나 로직 IC의 출력 핀은 LED 한두 개 켜기에도 벅찰 만큼 전류가 작습니다. 이럴 때 작은 신호로 큰 전류를 켜고 끄는 부품이 트랜지스터입니다. 이 글에서는 가장 흔한 바이폴라 트랜지스터(BJT)를 스위치로 쓰는 방법과 베이스 저항 계산, 부품마다 다른 핀 배열을 확인하는 요령을 정리합니다.

트랜지스터의 세 단자

BJT는 이미터(E), 베이스(B), 컬렉터(C) 세 단자가 있습니다. 베이스에 흐르는 작은 전류로 컬렉터에서 이미터로 흐르는 큰 전류를 조절합니다.

  • NPN: 베이스에 전류를 넣으면(High) 컬렉터에서 이미터로 전류가 흐릅니다. 이미터를 접지(GND)에 둡니다.
  • PNP: 베이스에서 전류를 빼면(Low) 이미터에서 컬렉터로 전류가 흐릅니다. 이미터를 +V에 둡니다.

스위치로 쓸 때는 완전히 켜는 포화 상태와 완전히 끄는 차단 상태만 씁니다. 포화되면 컬렉터-이미터 전압이 약 0.1~0.3V까지 낮아져 거의 닫힌 스위치처럼 동작합니다.

핀 배열은 부품마다 다릅니다

2N3904 · 2N3906납작한 면Flat sideEBCBC547 · BC337납작한 면Flat sideCBE2SC1815납작한 면Flat sideECBE 이미터 · B 베이스 · C 컬렉터 (왼쪽부터)E emitter · B base · C collector (from the left)
같은 TO-92 패키지라도 부품에 따라 다리 순서가 다릅니다. 납작한 면을 앞으로 보고 다리를 아래로 둔 상태에서 왼쪽부터 읽습니다.

가장 큰 사고 원인이 핀 배열 착오입니다. 2N3904와 2N3906은 E-B-C, BC547과 BC337은 C-B-E, 일부 일본 부품(2SC1815 등)은 E-C-B입니다. 데이터시트의 핀 배치를 반드시 확인하세요(데이터시트 읽는 법). 패턴도에서는 트랜지스터마다 NPN·PNP 극성과 핀별 역할(E·B·C)을 직접 고를 수 있어 실제 부품의 핀 배열에 맞춰 배치할 수 있습니다.

NPN 스위치 회로

+VR_C (LED 저항)R_C (LED resistor)LEDC (컬렉터)C (collector)E (에미터)E (emitter)R_BB입력InputHigh면 LED 켜짐LED on when HighGND
NPN 로우사이드 스위치. 부하(LED와 저항)는 +V와 컬렉터 사이에, 이미터는 접지에 둡니다.

부하를 +V와 컬렉터 사이에 넣고 이미터를 접지에 연결하는 구성입니다. 입력이 High이면 베이스에 전류가 흘러 부하가 켜집니다.

베이스 저항 계산

베이스 전류는 포화를 보장하도록 컬렉터 전류의 약 1/10로 잡습니다(강제 베타 10). 입력 전압에서 베이스-이미터 전압(약 0.7V)을 뺀 값을 베이스 전류로 나눕니다.

Ib = Ic / 10
R_B = (입력 전압 - 0.7V) / Ib
컬렉터 전류베이스 전류R_B (5V 입력)R_B (3.3V 입력)
10mA1mA4.3kΩ → 4.7kΩ2.6kΩ → 2.2kΩ
50mA5mA860Ω → 820Ω520Ω → 470Ω
100mA10mA430Ω → 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

2N3904 · 2N3906납작한 면Flat sideEBCBC547 · BC337납작한 면Flat sideCBE2SC1815납작한 면Flat sideECBE 이미터 · B 베이스 · C 컬렉터 (왼쪽부터)E emitter · B base · C collector (from the left)
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

+VR_C (LED 저항)R_C (LED resistor)LEDC (컬렉터)C (collector)E (에미터)E (emitter)R_BB입력InputHigh면 LED 켜짐LED on when HighGND
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 currentBase currentR_B (5 V input)R_B (3.3 V input)
10 mA1 mA4.3 kΩ → 4.7 kΩ2.6 kΩ → 2.2 kΩ
50 mA5 mA860 Ω → 820 Ω520 Ω → 470 Ω
100 mA10 mA430 Ω → 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

MistakeResultPrevention
Leaving out the base resistorBase current runs away and damages the input pin or transistorAlways use a series resistor
Wrong pinoutDoes not work, or gets hotCheck against the datasheet
No diode on an inductive loadBack-EMF destroys the transistorA reverse parallel diode across the load
Missing shared groundThe signal references differ so it does not workConnect the GND of the microcontroller and the load supply
Exceeding the current limitOverheatingUse 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.

이 글은 학습 목적의 일반적인 안내입니다. 부품마다 규격과 핀 배열이 다를 수 있으니 실제 작업 전에는 사용하는 부품의 데이터시트를 확인하세요. 안전과 관련된 작업은 항목별 주의 사항을 먼저 읽고 진행하세요.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.