Electronic – arduino – NPN BJT Relay Circuit will not turn off

arduinomicrocontrollernpnraspberry pirelay

I'm applying a 3.3V signal with my Raspberry Pi to the base of an NPN transistor to activate a SPDT 6V relay (relay data sheet, model G2R-1-S-DC6(S)). The relay pickup/dropoff voltage is 4.4/0.9V. The transistor activates the circuit like it should when the signal is applied, but it does not turn off when the signal is removed.

The relay coil resistance is 68.7 ohms, as shown in the simulation. The 161 ohm resistor was added to dissipate some power because the transistor is rated for 600 mW. When adding the emitter resistance, I calculated that it needed to be under 40.7 ohms. I used a 33 ohm because that is what I had on hand. The 24Vdc supply is used here because it is what is available in the system. I am using a 2N2222 transistor from Radio Shack with a Beta=200. The 3.3V ground and 24V ground were tied together when the circuit was constructed.

I've experimented with adding a resistor from base to ground; I tried this with 10k, 33k, and 100k resistances. I have tried a diode in parallel with the relay pointing up. I used a new transistor every time I tried a new circuit to ensure the transistor was not burned up from the previous test. I also tried multiple different combinations of Rb and Rc with the same result. The strange part is, when experimenting with Rc values, the Beta calculated from test measurements ranged from 50-500, which is very odd. In all trials, the current through the relay was as calculated in the simulation; it did not change upon application and after removal of the signal.

I saw another post where someone used a small capacitor in parallel with Rb to sweep voltage off the base emitter, we also tried this but it didn't work (link – it is the third diagram from the top).

Any advice will be will be greatly appreciated.

Simulation of Circuit with no Signal

Simulation of circuit with 3.3V Signal

Best Answer

Add a fly-back diode.

When switching the current off, a coil will reduce the voltage until something starts to conduct so it can continue to let the current flow, as long as it has magnetic energy inside. Sadly, the conductive path is provided by your transistor -- after it was fried.

That negative pulse can reach thousands of volts. Seriously!