Karnataka KSEAB II PUC Electronics and Hardware (Vocational) study materials
Karnataka KSEAB II PUC Electronics and Hardware (Vocational) study resources

Relay Driver That Works on the Bench but Chatters in the Cabinet

Karnataka KSEAB II PUC Electronics and Hardware (Vocational) · Put your knowledge to work in context.

All case studies

Relay Driver That Works on the Bench but Chatters in the Cabinet

A student uses a 3.3 V microcontroller GPIO to drive a 12 V relay through a 2N2222A. The relay coil measures 400 Ω, so it needs about 30 mA at 12 V. The base resistor is 10 kΩ, and the transistor's datasheet gives hFE(min) = 100 at 30 mA and VCE(sat) = 0.3 V at 150 mA. On the bench the relay clicks reliably when the room is cool. Inside a closed cabinet, after ten minutes, the relay chatters and the transistor case feels warm. A DMM shows VCE = 1.8 V when the relay is supposed to be on. There is no diode across the coil. The GPIO can source 4 mA comfortably and 20 mA absolute maximum. The student has 220 Ω, 470 Ω, 820 Ω, 1 kΩ, and 10 kΩ resistors, plus 1N4007 and 1N4148 diodes.

1. Calculate the base current with the 10 kΩ resistor and the forced beta. Explain why VCE = 1.8 V is consistent with insufficient base drive.

Read the worked answer

IB = (3.3 − 0.7)/10 kΩ = 0.26 mA. IC = 12/400 = 30 mA. Forced beta = 30/0.26 = 115.

The datasheet hFE(min) = 100 at 30 mA, so the transistor is only just at the edge of saturation; any tolerance or temperature change pulls it into the active region. VCE = 1.8 V means Vcoil = 10.2 V and PT = 30 mA × 1.8 V = 54 mW. The relay may chatter because the coil voltage is below its must-operate threshold, especially when warm. The 1.8 V reading is consistent with insufficient base drive, not a faulty transistor.

2. Choose a base resistor from the available values for a forced beta of 10, check GPIO current and resistor power, and state the expected VCE and coil voltage.

Read the worked answer

For forced beta 10, IB = 30/10 = 3 mA. RB = (3.3 − 0.8)/3 mA = 833 Ω; use 820 Ω. Actual IB = (3.3 − 0.8)/820 = 3.05 mA, within the GPIO's 4 mA comfortable source and far below 20 mA. Resistor power = (2.5)²/820 = 7.6 mW; a 0.25 W part is fine.

Expected VCE(sat) ≈ 0.2–0.3 V, coil voltage about 11.7 V, and transistor dissipation about 9 mW. This gives a forced beta of 10, the usual design rule for hard saturation.

3. Explain the missing flyback diode and select a diode. What failure would you expect without it?

Read the worked answer

The relay coil is inductive. When the transistor turns off, the coil current cannot change instantly, so V = L di/dt drives the collector far negative, avalanching the transistor. A flyback diode across the coil, cathode to +12 V, clamps this to about 0.7 V and gives the current a path.

Use a 1N4007 (1000 V, 1 A) for robust margin; a 1N4148 (100 V, 200 mA) may work for a 30 mA coil but has less surge and reverse-voltage margin. Fit the diode close to the coil, not at the transistor. Without it, expect the transistor to fail short or open after repeated switching, and possibly damage the GPIO.