C5 · Lesson 36 · Sandbox
Choosing parts so devices do what you want
A microcontroller pin can deliver a few milliamps at 3.3 or 5 V. That's enough for an LED, with the right resistor, but not for a motor that wants half an amp at 12 V. A transistor bridges the gap: the pin drives the base (or gate), and the transistor switches the heavy current. Getting it right means checking currents at both ends: enough base current to switch fully on, not more than the pin can give, and a diode to absorb the motor's kick (C2.8).
Play
- A logic output (5 V) drives an NPN transistor through ; the transistor switches a small DC motor (20 Ω, 10 mH) from 12 V, with a flyback diode across it.
- Raise until the transistor stops saturating. What happens to the collector voltage, and to the power the transistor burns ()?
Predict
The motor needs 0.6 A and the transistor's β is 200. What's the least base current that will switch it fully on?
3 mA, plus a margin. mA is the bare minimum; β varies between parts and falls at high current, so designers drive the base with two to five times the minimum to be sure the transistor saturates. That's still within what most logic pins can supply; for bigger loads, a MOSFET (no gate current at all) or a Darlington pair is used instead.
Name it
Driver design
LED from a logic pin. , keeping within the pin's limit (often 10 to 20 mA).
BJT low-side switch. The load goes between the supply and the collector; the emitter goes to ground.
- Load current: (less a little for ).
- Base current: at least , times a margin of 2 to 5.
- , with about 0.7 to 0.9 V when saturated.
- Check that is within the pin's rating.
- Check the transistor's power: when on, which is small. A transistor that's only half on burns far more.
- A flyback diode across any inductive load (motor, relay, solenoid).
MOSFET low-side switch. Gate driven straight from the pin (through a small resistor to limit ringing); choose a "logic-level" MOSFET that's fully on at the pin's voltage. No steady drive current, and a much lower drop at high currents.
Worked example
A 3.3 V logic pin drives a red LED ( = 2.0 V) at 10 mA. What resistor?
Show the solution
- Resistor.
- Check the pin. 10 mA is within a typical pin's 10 to 20 mA limit.
Answer use 130 Ω.
Worked example
The same pin must switch a 12 V, 200 mA motor through a BJT with a forced β of 10. What base resistor, and is that wise?
Show the solution
- Base current.
- Base resistor.
- Is it wise. 20 mA is more than most pins should source, so a logic-level MOSFET, which needs no steady gate current, is the better switch.
Answer it needs 125 Ω, but the 20 mA of base current is more than most pins should source, so a logic-level MOSFET is the better choice.
Check
A 5 V pin drives a red LED through . Choose to set the LED current to 10 mA.
Type values the way you would write them on a schematic: 4.7k, 100n, 10m. Then try them: the circuit runs with your values and is measured.
Check
Choose so the transistor fully switches on the 0.6 A motor ( below 0.3 V) while the 5 V pin supplies less than 5 mA.
Type values the way you would write them on a schematic: 4.7k, 100n, 10m. Then try them: the circuit runs with your values and is measured.
Check
A 5.1 V Zener regulator runs from 9 V and must hold its output above 5 V with a 20 mA load, without drawing more than 40 mA from the supply. Choose .
Type values the way you would write them on a schematic: 4.7k, 100n, 10m. Then try them: the circuit runs with your values and is measured.
Explain why
Why is a transistor switch driven with several times the minimum base current it needs?
The minimum base current is the load current divided by β, but β varies widely between transistors of the same type, changes with temperature and falls at high currents. If the base current were set exactly at the minimum for a typical β, a transistor with lower β wouldn't saturate: it would sit partly on, with several volts across it while carrying the full current, burning a lot of power. Driving it with two to five times the minimum guarantees saturation, keeping the transistor's voltage, and its power, low.
Practice
Keep practicing
4 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.