3v Relay raspberry

3.3vraspberry pirelay

I'm trying to drive a 3v Relay with a schematic like this:

raspberry driving a 5v relay

Relay is a HWE JRC-21F and transistor is a PN2222A instead of a BC337.
This won't work unless I connect 3.3v directly to transistor base, without resistor.

Maybe resistor is too high?

Best Answer

No problem to apply 5v to a 3v relay because it will be far distant from the PI so relay is calculated to receive about 3v due to long cables

It took a comment to shed light on the problem. If the cables are dropping ~2V then the emitter has effectively been given an emitter resistor of possibly 10 ohms. I say 10 ohms because this would drop 1 volt at a relay coil current of 100mA. The 100mA comes from the coil power dissipation in the data sheet of 0.3 watts - 0.3 watts / 3V = 100mA. The data sheet states a power dissipation range of 0.2 watts to 0.36 watts so I've gone possibly a little cautious of dead centre.

To drive a known current into the base you have to know what voltage the emitter is at and seemingly it's at 1V. Therefore the base is probably about 1.8 volts with respect to ground shown on the diagram. This means that with 3V3 applied to one side of the 1k base resistor and 1.8 volts on the other side, the base current is 1.5mA. There may even be some voltage dropped down the base drive cable which might lower things a bit more and also the IO of the PI may not be exactly at 3V3 - it might be 3V2 lowering the base drive a tad more.

Is this enough to turn on a PN2222A transistor and power the relay - possibly not given that Hfe might be as low as 50 at a collector saturation voltage of 1 volt and it's going to be less for lower saturation voltages.

At a Hfe of 50, the collector current is going to be 75mA and quite possibly not enough to activate the relay.

There's another clue that makes sense too: -

This won't work unless I connect 3.3v directly to transistor base, without resistor.

You'd likely blow up the base-emitter junction if you fed 3V3 across it but, as stated earlier, there is an emitter resistor due to the long cable and this protects the transistor.