0
\$\begingroup\$

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?

\$\endgroup\$
  • \$\begingroup\$ Have you got emitter and collector the right way round - it'll still work in reverse but current gain will be crap. If you do get it working you will be applying 5v to a 3v relay. \$\endgroup\$ – Andy aka Dec 2 '14 at 15:52
  • \$\begingroup\$ As the datasheet states the transistor is in the right way. 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. \$\endgroup\$ – bitbang Dec 2 '14 at 16:10
  • \$\begingroup\$ That's the problem. I'll leave an answer... \$\endgroup\$ – Andy aka Dec 2 '14 at 17:55
2
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ So, I have to cut out the resistor? \$\endgroup\$ – bitbang Dec 4 '14 at 11:52
  • \$\begingroup\$ Is the transistor at the end of the cable where the relay is? If so then cutting out the resistor should be OK but, if you shorten the cable too much you might damage the transistor or the Pi IO line. Best to try a smaller resistor like 100 ohms. \$\endgroup\$ – Andy aka Dec 4 '14 at 12:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.