목차 보기
  1. 핀이 낼 수 있는 전류와 부하
  2. 구동 소자 선택
  3. 플라이백(자유 회전) 다이오드
  4. 릴레이 고르기
  5. 모터 구동 요령
  6. 제작과 점검 요령
  7. 정리
Table of contents
  1. Current a pin can supply, and loads
  2. Choosing the driving device
  3. The flyback (freewheeling) diode
  4. Choosing a relay
  5. Tips for driving motors
  6. Build and check tips
  7. Summary

마이크로컨트롤러나 로직 IC의 출력 핀은 LED 한두 개를 켜는 정도의 전류만 낼 수 있습니다. 모터, 릴레이, 솔레노이드, 큰 램프 같은 부하는 수십~수백 mA에서 수 A까지 필요해 핀에 직접 연결하면 핀이 망가집니다. 이 글에서는 작은 신호로 큰 부하를 켜는 구동 회로의 구성, 트랜지스터와 MOSFET 선택, 코일 부하에 반드시 필요한 플라이백 다이오드, 전원 분리와 접지 공유 요령을 정리합니다.

핀이 낼 수 있는 전류와 부하

부하필요한 전류(대략)
LED 한 개5~20mA
소형 5V 릴레이 코일약 40~100mA
소형 직류 모터100~500mA(회전 시작·정지 때 더 큼)
솔레노이드200mA 이상
부저(능동)약 10~30mA

마이크로컨트롤러 핀 하나가 줄 수 있는 전류는 보통 20mA 안팎 이하입니다. 정확한 값은 칩의 데이터시트에서 확인하세요(데이터시트 읽는 법). 큰 부하는 드라이버(트랜지스터·MOSFET·전용 IC)를 거쳐 전원에서 직접 전류를 받아야 합니다.

구동 소자 선택

소자특징용도
NPN 트랜지스터(2N3904 등)간단하고 저렴. 약 200mA까지소형 릴레이, 작은 모터, LED 묶음(트랜지스터 스위치 회로)
달링턴 어레이(ULN2003 등)7채널, 채널당 약 500mA, 플라이백 다이오드 내장릴레이, 스텝 모터, 여러 부하를 한 번에
로직 레벨 N채널 MOSFET켜졌을 때 전압 강하가 작고 전류가 큼큰 전류 모터, 램프
H-브리지 IC(L298N, TB6612, DRV8833 등)모터 방향 전환과 속도 제어모터 정·역회전

트랜지스터로 릴레이 구동하기

5V 릴레이의 코일 전류가 70mA이고 마이크로컨트롤러 출력이 3.3V라고 합니다.

  • 컬렉터 전류 Ic = 70mA, 베이스 전류 Ib ≈ Ic ÷ 10 = 7mA
  • R_B = (3.3V − 0.7V) ÷ 7mA ≈ 370Ω → 330Ω을 씁니다.
  • 마이크로컨트롤러 핀이 7mA를 줄 수 있는지 확인합니다. 어렵다면 ULN2003이나 MOSFET을 쓰세요.

MOSFET 사용 요령

  • 로직 레벨 MOSFET을 쓰세요. 게이트 전압 3.3V에서 충분히 켜지는 제품(IRLZ44N, 작은 신호용 2N7000·AO3400 등)을 고릅니다. 일반 MOSFET(IRF540 등)은 10V 근처의 게이트 전압이 필요해 3.3V에서는 제대로 켜지지 않습니다.
  • 게이트와 핀 사이에 100~220Ω을 직렬로 두고, 게이트와 GND 사이에 10kΩ 풀다운을 둡니다. 마이크로컨트롤러가 부팅되는 동안 핀이 떠 있어도 부하가 켜지지 않게 합니다.
  • 부하는 MOSFET 드레인과 +V 사이에, 소스는 GND에 연결합니다(로우사이드).

플라이백(자유 회전) 다이오드

코일 부하(릴레이, 모터, 솔레노이드)는 전류가 흐르다가 끊기면 코일이 에너지를 방출하며 순간적으로 높은 역전압(수십~수백 V)을 만듭니다. 이 전압이 트랜지스터를 파괴하거나 마이크로컨트롤러를 리셋시킵니다.

  • 코일과 역방향으로 병렬로 다이오드를 달면 이 전류가 다이오드로 순환해 안전하게 사라집니다.
  • 다이오드의 캐소드(띠)는 +V쪽, 애노드는 트랜지스터(컬렉터·드레인)쪽입니다.
  • 소형 릴레이는 1N4148이나 1N4007, 큰 모터는 정격이 더 큰 다이오드를 씁니다(다이오드와 제너 다이오드).
  • ULN2003 같은 드라이버 IC에는 이 다이오드가 들어 있습니다(COM 핀을 부하 전원에 연결).

릴레이 고르기

  • 코일 전압: 5V, 12V, 24V. 회로의 전원과 맞춥니다.
  • 접점 정격: 10A 250V AC 같은 표기는 접점이 견딜 수 있는 한도입니다. 하지만 교류 220V 같은 전원을 직접 스위칭하는 작업은 감전과 화재 위험이 크므로 초보자는 하지 마세요. 코일은 저전압, 접점도 저전압 부하(12V 램프 등)에만 쓰는 것이 안전합니다.
  • 릴레이 모듈: 광커플러로 제어 회로와 분리되어 있고 드라이버와 다이오드가 포함된 모듈이 편합니다. 신호가 Low일 때 켜지는 제품이 많으니 설명서를 확인하세요.

모터 구동 요령

  • 전원 분리: 모터는 전원 잡음과 큰 전류를 만듭니다. 가능하면 마이크로컨트롤러와 별도의 전원을 쓰고, 접지는 공유하세요(전원 레일과 접지 설계).
  • 정지 전류: 모터가 멈춘 상태(회전 못 함)에서 흐르는 전류는 평소의 3~10배입니다. 드라이버의 정격은 이 값을 기준으로 고르세요.
  • 모터 단자에 100nF 세라믹을 달아 브러시 잡음을 줄입니다. 큰 전원 입구에는 470~1000µF 전해 커패시터를 답니다.
  • 속도 제어: PWM으로 켜고 끄는 비율을 바꿉니다. 방향을 바꾸려면 H-브리지 IC가 필요합니다.
  • 배선: 모터 선은 굵고 짧게, 신호선과 떨어뜨립니다.

제작과 점검 요령

  1. 먼저 부하 없이 드라이버 입력과 출력을 확인합니다.
  2. 전류 제한 전원으로 처음 켭니다(실험용 전원 공급기 고르는 법).
  3. 드라이버나 트랜지스터가 뜨거워지지 않는지 짚어 봅니다.
  4. 부하를 켤 때마다 마이크로컨트롤러가 리셋되면 전원 분리, 커패시터, 다이오드를 의심합니다.

정리

큰 부하는 마이크로컨트롤러 핀이 아니라 트랜지스터·MOSFET·드라이버 IC가 전원에서 직접 전류를 받아 구동하게 하고, 코일 부하에는 플라이백 다이오드를 반드시 다세요. 모터는 별도 전원을 쓰고 접지는 공유하며, 교류 전원을 직접 다루는 작업은 하지 마세요. 기본 원리는 트랜지스터 스위치 회로에서 이어서 볼 수 있습니다.

The output pin of a microcontroller or logic IC can supply only enough current to light an LED or two. Loads like motors, relays, solenoids, and big lamps need tens of mA up to several amps, and connecting them straight to the pin destroys it. This article covers the arrangement of a driver circuit that switches a big load with a small signal, choosing between transistors and MOSFETs, the flyback diode that coil loads absolutely need, and tips on separating power and sharing ground.

Current a pin can supply, and loads

LoadCurrent needed (approx.)
One LED5–20 mA
Small 5 V relay coilAbout 40–100 mA
Small DC motor100–500 mA (more at start and stall)
Solenoid200 mA or more
Buzzer (active)About 10–30 mA

The current one microcontroller pin can supply is usually around 20 mA or less. Check the exact value in the chip's datasheet (How to Read a Datasheet). A big load must get its current straight from the supply through a driver (transistor, MOSFET, or dedicated IC).

Choosing the driving device

DeviceCharacteristicsUse
NPN transistor (such as 2N3904)Simple and cheap. Up to about 200 mASmall relays, small motors, groups of LEDs (Transistor Switch Circuits)
Darlington array (such as ULN2003)7 channels, about 500 mA per channel, built-in flyback diodesRelays, stepper motors, several loads at once
Logic-level N-channel MOSFETSmall voltage drop when on and large currentHigh-current motors, lamps
H-bridge IC (L298N, TB6612, DRV8833, and so on)Motor direction reversal and speed controlForward and reverse motor rotation

Driving a relay with a transistor

Say a 5 V relay's coil current is 70 mA and the microcontroller output is 3.3 V.

  • Collector current Ic = 70 mA, base current Ib ≈ Ic ÷ 10 = 7 mA
  • R_B = (3.3 V − 0.7 V) ÷ 7 mA ≈ 370 Ω → use 330 Ω.
  • Check that the microcontroller pin can supply 7 mA. If it cannot, use a ULN2003 or a MOSFET.

Tips for using a MOSFET

  • Use a logic-level MOSFET. Pick one that turns on fully at a 3.3 V gate voltage (the IRLZ44N, or small-signal ones like the 2N7000 and AO3400). A regular MOSFET (such as the IRF540) needs a gate voltage near 10 V and does not turn on properly at 3.3 V.
  • Put 100–220 Ω in series between the gate and the pin, and a 10 kΩ pull-down between the gate and GND. That keeps the load from turning on even if the pin floats while the microcontroller boots.
  • Connect the load between the MOSFET drain and +V, and the source to GND (low side).

The flyback (freewheeling) diode

When the current through a coil load (relay, motor, solenoid) is cut, the coil releases energy and creates a momentary high reverse voltage (tens to hundreds of volts). That voltage can destroy the transistor or reset the microcontroller.

  • If you attach a diode in reverse, in parallel with the coil, this current circulates through the diode and dies away safely.
  • The diode's cathode (band) goes to the +V side and its anode to the transistor (collector or drain) side.
  • For small relays use a 1N4148 or 1N4007, and for big motors a diode with a higher rating (How to Use Diodes and Zener Diodes).
  • Driver ICs like the ULN2003 include this diode (connect the COM pin to the load supply).

Choosing a relay

  • Coil voltage: 5 V, 12 V, 24 V. Match it to the circuit's supply.
  • Contact rating: markings like 10 A 250 V AC are the limits the contacts can withstand. But switching mains such as 220 V AC directly carries a high risk of shock and fire, so beginners should not do it. It is safer to use the coil at low voltage and the contacts only for low-voltage loads (such as a 12 V lamp).
  • Relay modules: modules that are isolated from the control circuit with an optocoupler and include a driver and a diode are convenient. Many turn on when the signal is Low, so check the instructions.

Tips for driving motors

  • Separate power: motors create supply noise and large currents. If possible, use a separate supply from the microcontroller, and share ground (Power Rails, Grounding, and Decoupling Capacitor Placement).
  • Stall current: the current when the motor is stopped (cannot turn) is 3 to 10 times the normal. Choose the driver's rating based on this value.
  • Put a 100 nF ceramic across the motor terminals to reduce brush noise. Put a 470–1000 µF electrolytic at the large power entry.
  • Speed control: change the on-off ratio with PWM. To reverse direction you need an H-bridge IC.
  • Wiring: keep motor wires thick and short, and away from signal lines.

Build and check tips

  1. First check the driver's input and output with no load.
  2. Turn it on for the first time with a current-limited supply (Choosing a Bench Power Supply).
  3. Touch the driver or transistor to check that it is not getting hot.
  4. If the microcontroller resets each time the load turns on, suspect power separation, capacitors, or the diode.

Summary

Have a big load driven by a transistor, MOSFET, or driver IC taking current directly from the supply, not by a microcontroller pin, and always attach a flyback diode to coil loads. Use a separate supply for motors and share ground, and do not work directly with AC mains. Continue with the basic principle in Transistor Switch Circuits.

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