Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Comments on Driving relay, transistor keeps failing

Parent

Driving relay, transistor keeps failing

+4
−0

I'm trying to drive a relay according to a 5 V digital signal, using this circuit:

Image alt text

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?

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

0 comment threads

Post
+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:

Image alt text

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:

Image alt text

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.

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.

1 comment thread

General comments (4 comments)
General comments
Chupacabras‭ wrote over 4 years ago

Interesting. How much faster will relay switch off with resistor compared to alone diode?

Olin Lathrop‭ wrote over 4 years ago

@Chup: That depends on the relay. For some "fast" relays, it might make a difference. For relays that take 10s of ms to switch, it probably wouldn't matter anyway. You really have to check the datasheet or ask the manufacturer if switching speed is not specified.

timelyfiasco‭ wrote over 4 years ago

Hi, related question: if relays need diode why arent they fitted with it as a unit?

Olin Lathrop‭ wrote over 4 years ago

@tim: You should ask that as a real question.