# NPN transistor for switching electromagnetic relay

I have to switch on a relay based on a signal, and for this purpose, I am using an NPN transistor (BC-639G) in open-collector configuration, where the switching signal is applied to the base using a suitable current limiting resistor, and the relay coil sits between the collector and the power supply. Switching signal frequency is random and is very very low.

simulate this circuit – Schematic created using CircuitLab

We are observing that this transistor is failing very often. The full load current of the relay coil is only 30mA, and the transistor is rated for 1A. We have not been able to pin-point the cause for this apparent failure. An earlier design used MJE802G (NPN Darlington 4A) device, and this kind of failure was not observed then.

Need expert comments on this to get to the bottom of this. All pointers are welcome.

Update from comment to an answer on Sept 8, 2017:

I forgot to put the diode in the schematic, but there is a 1N4007 diode in that place to allow the relay coil to freewheel when the transistor switches off. The failure (C-E short, or C-E open) is inspite of the above diode.

• No flyback diode. Also, R2 doesn't appear to do anything useful. – Brian Drummond Sep 7 '17 at 12:31
• You were partly lucky with the MJE802G; that part also has built-in base - emitter resistors, so the two circuits (with different parts) are not analogous at all. – Peter Smith Sep 7 '17 at 12:35
• Aside from the other points/questions made, why is $C_1$ there? – jonk Sep 7 '17 at 16:53
• @jonk: C1 was put there to debounce the switch. – Vishal Sep 8 '17 at 9:37
• @PeterSmith : Also, MJE802G is a Darlington, with much higher Hfe than was needed for this application. Actually, C1 was also put so as to make sure there is no Click-Clock of the Relay because of stray voltages switching on MJE802G. If C1 is removed, while using a suitable NPN, non-darlington device like BC639, then R4 (above) should act like the Base-Emitter resistor, and R3 should act like the base-current limiting resistor...like they have in a digital-transistor. what else is required? – Vishal Sep 8 '17 at 9:48

Add a flyback diode. When the relay gets turned off the coil acts as an inductor which creates a voltage spike.

Adding a diode will let the coil dissipate the stored energy in something other than the transistor.

simulate this circuit – Schematic created using CircuitLab

• Thanks for the suggestion. I forgot to put the diode in the schematic, but there is a 1N4007 diode in that place to allow the relay coil to freewheel when the transistor switches off. The failure (C-E short, or C-E open) is inspite of the above diode. – Vishal Sep 8 '17 at 9:36
• 1N4007 may be a bad choice - you need a fast diode. Normal advice is a high speed 1A rectifier diode, but 30mA is well within a common 1N4148's ratings – Brian Drummond Sep 9 '17 at 10:47

Just add The Fly Back diode to the relay and the Circuit works perfect. NB Always check the pin assignment for the transistor, as some manufactures may confuse you .

• You said: "add The Fly Back diode to the relay". However perhaps you missed the comment by the OP in this answer where they say that they already have that diode. The OP said: "I forgot to put the diode in the schematic, but there is a 1N4007 diode in that place to allow the relay coil to freewheel when the transistor switches off". – SamGibson Nov 21 '17 at 15:00
• @sam: You really can't expect the volunteers writing answers here to read comments. If it's not in the question, it's not stated. So +1 to this answer, since it answers the question as actually asked. – Olin Lathrop Jan 6 '18 at 17:34

In addition to @RatchetFreak's comments, I recommend changing the push button RC debounce network as shown below in Figure 1. Fairchild Semi's data sheet for the BC639 uses a saturation beta of $\beta_{sat}=10$, so that's what I'll use in my calculations. If Q1's collector saturation current is $I_{C(sat)}=30\,mA$, then Q1's base current should be $I_{B(sat)}\approx3\,mA$ (n.b. $I_{B(sat)}=I_{C(sat)}/\beta_{sat}$) to ensure Q1 saturates. Looking again at the BC639's data sheet, $V_{BE(sat)}\approx 0.7V\;@I_{C(sat)}=30\,mA$. Solving for the value of base resistor R4 in my Figure 1:

$$R4=\frac{V1-V_{BE(sat)}}{I_{B(sat)}}=\frac{15\,V-0.7\,V}{3\,mA}=4.77\,k\Omega \;\;\;\;\;\;\;\;\;\;(1)$$

So choose R4 = 4.7k 5%, or 4.75k 1% with a power rating of 1/8W or higher.

The values for the R3 and C1 switch debounce circuit must be selected to suit your particular switch. You can experimentally obtain contact bounce data for your switch using a resistor, a DC power supply, and a digital oscilloscope (see Figure 2). [HIHT: Configure the oscilloscope's triggering system for either NORMAL mode or SINGLE capture mode to capture the single-shot contact bounce signal that appears across the resistor when you actuate the switch's contacts.]

simulate this circuit – Schematic created using CircuitLab

Figure 1.

simulate this circuit

Figure 2.

=== EDIT 2018-01-06 ===

@JimFischer: Your reply has enlightened me to the fact that, in the original circuit, a capacitor is directly connected to the base. So when the main power is taken away, this capacitor will try to discharge through the base-emitter junction of transistor. There is no current limiting mechanism there (except the internal resistance of the base-emitter junction). This probably is the main reason why the transistors are failing. The current path from an energy storage device to the transistor-base, must be through a current limiting resistor !!! – Vishal

Maybe. In your original figure, if the capacitor's value is small, then there is probably not enough energy stored in the capacitor to damage the transistor's base-emitter junction when the capacitor discharges into the transistor's base. Your figure indicates C1's value as 22 μF, which is pretty big; so in this case you could be right: the amount of energy stored in C1 could be sufficient to over-current Q1's base-emitter path, and that is causing, or is contributing to, Q1's failure. If testing of Q1 after it fails indicates the base-emitter diode is failing open circuit or short circuit, then the energy dump from capacitor C1 directly through Q1's base-emitter path is likely causing this failure mode.

That being said, you must also be sure to include a diode across the relay's coil (see @ratchet_freak's answer to your question) to manage the inductive voltage "kick" that occurs when Q1 shuts off, whereupon the magnetic flux stored in the relay's coil collapses rapidly, thereby inducing a massive, momentary voltage pulse across the coil (and therefore across Q1's collector-emitter path) that can be hundreds of volts in magnitude. That inductive kick, without a snubber diode in place, can greatly exceed transistor Q1's absolute maximum rating for collector-emitter voltage $V_{CEO}$, thereby damaging Q1. With a snubber diode installed, Q1 must endure a collector-emitter voltage of $V_{CE}=V1+V_{D1}$. (n.b. A diode that is used to suppress the coil's inductive kick is called by many names: snubber diode, flyback diode, kickback diode, etc. These names refer to the function the diode is performing (its purpose in the circuit), and not to a special kind of diode device.)

• Question, the equation for finding R4, is it for your schematic, or his? Also, is that okay (according to your schematic), that C1 is charged without a resistor? I mean, shouldn't there be a resistor in series to V1, or is it somehow charged by R3 or R4? – Eran Nov 25 '17 at 11:14
• My equation (1) yields a calculated value for base resistor R4 in my figure 1. When switch SW1 is closed, voltage source V1 charges capacitor C1 to 15 V. When switch SW1 is open, any charge stored on capacitor C1 discharges through resistors R3 and R4. Resistor R3 is necessary to ensure C1 discharges completely to ~0V, thereby ensuring transistor Q1's base-emitter voltage attains VBE ≈ 0 V, which ensures Q1's collector-emitter current path shuts off completely (Q1 enters into its shutoff mode), IC ≈ 0 A. – Jim Fischer Nov 25 '17 at 18:40
• @JimFischer: Your reply has enlightened me to the fact that, in the original circuit, a capacitor is directly connected to the base. So when the main power is taken away, this capacitor will try to discharge through the base-emitter junction of transistor. There is no current limiting mechanism there (except the internal resistance of the base-emitter junction). This probably is the main reason why the transistors are failing. The current path from an energy storage device to the transistor-base, must be through a current limiting resistor !!! – Vishal Jan 6 '18 at 7:52
• @JimFischer: Thanks for the confirmation. Regarding, Free-wheel diode, as mentioned in my comment to Ratchet Freak's answer, we do have a free-wheel diode (1N4007) as required in parallel with the relay coil. I missed showing it in the original post :( – Vishal Jan 31 '18 at 6:40