Relay Driver That Will Not Pull In: Base Drive Versus Transistor Gain
A student interfaces a 12 V relay to a 3.3 V microcontroller GPIO using an BC547 in common-emitter configuration. The relay coil measures 400 Ω, so the collector current needed in saturation is about (12 − 0.2)/400 ≈ 29.5 mA. A 1N4007 is fitted across the coil, cathode to +12 V. The datasheet gives hFE(min) = 110 at 25 °C for the grade used, Vbe(on) ≈ 0.75 V at a few mA, and Vce(sat) ≈ 0.2 V at 30 mA. The student picks Rb = 10 kΩ because a textbook example used that value. On test the relay buzzes and sometimes fails to close. Measured with a DMM: Vbe = 0.68 V, Vce = 4.8 V, supply 12.0 V. The GPIO is specified to source at most 8 mA and to output at least 3.1 V when high. The student's plan is to buy a transistor with a higher hFE.
1. From the measurements, prove which region the transistor is in and explain why the relay misbehaves.
Read the worked answer
Base current actually flowing: Ib = (3.3 − 0.68)/10 kΩ = 2.62/10 000 = 0.262 mA.
Collector current with the measured Vce: Ic = (12 − 4.8)/400 = 7.2/400 = 18 mA.
So the realised current gain is 18/0.262 ≈ 69, well below hFE(min) = 110. The device is in the active region, not saturation, which is confirmed by Vce = 4.8 V (a saturated switch would show 0.2–0.3 V).
Why the relay fails. The coil sees only 7.2 V, i.e. 60 % of its 12 V rating. A 12 V relay typically must-operate at about 75 % of rated voltage (≈ 9 V) and only guarantees release below about 10 %. At 7.2 V it is in the uncertain band, so it chatters, picks up on some units and not others, and is temperature-sensitive.
Necessary base current for saturation. With an overdrive factor of 10, Ib must be 29.5/10 ≈ 2.95 mA. The 10 kΩ resistor gives 0.262 mA, more than ten times too small. Note also that 4.8 V × 18 mA = 86 mW is being dissipated in a part that was intended to dissipate almost nothing as a switch.
2. Calculate a suitable base resistor and check it against the GPIO current limit.
Read the worked answer
Target base current. For hard saturation, choose Ib = Ic(sat)/10 = 29.5/10 ≈ 2.95 mA (an overdrive factor of 10 covers unit-to-unit hFE spread and low temperature).
Resistor value. At 3 mA the base-emitter drop is nearer 0.78 V than 0.68 V, so use the worst case: Rb = (Voh − Vbe)/Ib = (3.1 − 0.78)/2.95 mA = 2.32/0.00295 ≈ 786 Ω.
The next standard value below that is 680 Ω (giving Ib ≈ 3.4 mA, forced beta ≈ 8.7) and the nearest is 820 Ω (Ib ≈ 2.83 mA, forced beta ≈ 10.4). Choose 820 Ω: it keeps the overdrive factor at about 10 while drawing less from the port.
Port check. 3.1 V/820 Ω gives ≈ 2.8 mA, comfortably under the 8 mA limit. Resistor dissipation = (3.1 − 0.78)²/820 ≈ 6.6 mW, so an ordinary 0.25 W part is fine.
Verification after the change. Vbe should rise slightly (more base current), Vce should fall to 0.2–0.3 V, and the coil should see about 11.7 V. If Vce stays above 0.5 V, the transistor is faulty or the coil is drawing more than the assumed 29.5 mA (a 12 V relay coil often measures nearer 250–300 Ω when it is a high-current type).
3. The student proposes simply fitting a transistor with higher hFE. Evaluate this plan and state one other component check the circuit needs.
Read the worked answer
Why the plan is unsound. hFE is a loosely specified parameter: it is quoted at a particular Ic and Vce, spreads by 2:1 to 3:1 between units of the same type, falls at low temperature (roughly 0.5 %/°C) and falls at high collector current. A design that saturates only because a particular transistor happened to have high gain will fail again on the next batch or in a cold room. The correct design fixes the base current with a resistor, then the transistor's gain only decides how much overdrive margin you have.
If a higher-gain part is used anyway, it must still be verified at worst-case hFE(min), not the typical value, and the base resistor recalculated. A Darlington such as the TIP120 would work (hFE ≈ 1000) but its Vbe(on) is about 1.4 V and Vce(sat) about 1 V, so the coil would see only ~11 V - acceptable for a 12 V relay but a needless loss.
Component to check: the freewheeling diode. Confirm the 1N4007 is present and fitted with its cathode to +12 V and anode to the collector. Without it, the coil's turn-off back-EMF (tens of volts, limited by the coil's own capacitance) exceeds the BC547's Vceo of 45 V and destroys the transistor within a few operations. This also explains many 'the transistor keeps dying' reports that get misdiagnosed as gain problems. Check the diode with the DMM diode test out of circuit.