Q&A

# Driving relay, transistor keeps failing

+2
−0

I'm trying to drive a relay according to a 5 V digital signal, using this circuit: It works for a while, but then the transistor fails. When I replace the transistor, it works for a while again, then fails again. The transistor is rated for 600 mA and 40 V. I'm only running 63 mA thru it, and the supply is only 5 V. The base current is about 2.9 mA. I'm only asking for a gain of 22, when the gain should be at least 40 at this current according to the datasheet.

What's going on?

Why should this post be closed?

+4
−0

The reason the transistor is dying is because you didn't put a flyback diode across the relay coil.

Relay coils have significant inductance. This means the current can't change instantly without the voltage being infinite.

It takes voltage applied over time to change the current thru an inductor:

A = V s / H

Where A is the current change in Amps, V the applied voltage, s the time the voltage is applied in seconds, and H the inductance in Henries.

This can be flipped around to find how high a voltage must be applied over a specific time for a specific inductance:

V = A H / s

After the relay has been on for a while, the coil current will be 63 mA. Let's say the transistor turns off over 1 µs (a long time for such a transistor), and that the relay coil inductance is 1 mH. (63 mA)(1 mH)/(1 µs) = 63 V. Your transistor is rated for 40 VCE absolute maximum, so it would clearly be abused. And, that was assuming the rather long turn off time of 1 µs and that the applied voltage would be steady during that time. Both of those assumptions are unrealistic.

What really happens is that the voltage rises quickly to the point the transistor breaks down and allows some current anyway. This damages the transistor each time the relay is switched off, eventually to the point of failure.

The solution is to add a diode across the relay coil: When the transistor turns off, even if instantaneously, the diode allows the coil current to keep flowing. The bottom of the coil will only go one diode drop above the 5 V supply level. This reverse voltage and the resistance of the coil cause the coil current to drop, which opens the relay.

The diode drop and the DC resistance of the coil are usually sufficient to drop the magnetic field and open the relay contact in about the time it takes the contacts to move, or less.

For applications where speed is important, an additional resistance can be added in series with the diode: This causes a higher initial reverse voltage across the coil, reducing its current, and thereby its magnetic field, more quickly. Note that the reverse voltage caused by the coil is still known and limited. We know that the coil current never exceeds 63 mA, so the voltage across the resitor will not exceed (63 mA)(82 Ω) = 5.2 V. In this example, right after switch off, the collector voltage of the transistor will be about 10.9 V. This comes from the 5 V the top of the relay coil is being held at, 700 mV for the voltage across the diode, and 5.2 V across R2. Since the transistor is rated for 40 V, this is well within spec. 