# Electrical – Driving a 6V relay from an 3.3v GIO pin of Raspberry PI3

driverraspberry pirelay

I want to drive this 6v relay (RT314F06) from a 3.3v output gate of an GIO pin of a R-PI3.

–edit–

There is already this answer on SO, but it is incomplete in the way that it does not tell which discrete components to use. I my case this is important since I'm too novice to decide which components to choose myself.

–edit–

Given that I have also a 6v power-supply, what component should I use to upshift the 3.3v to 6v?

The relay requires 6V and has an internal resistance of 55 Ohm. So, if I am correct, the driver needs to be capable of driving about 100mA.

Can I use a converter like this? I think it can shift only to 6v and I can't find how much current it can drive.

Thanks for the advice.

#### Best Answer

The item you linked in your question is a logic level converter and so this would probably be unsuitable as it wouldn't be designed to work with currents around 100 mA.

The simplest implementation I can think of is this: -

It shows a 5 volt supply and relay but this will work with a 6 volt supply and relay. D1 is there to "catch" back emfs from the relay coil when you turn it off (MCU out = 0).

Choosing the base resistor at 1 kohm ensures that the transistor properly turns on when the collector load is only 49.5 ohms (55 ohm - 10%). The 2N2222 has a current gain guaranteed to be 100 at a collector current of 150 mA hence, with about 2.5 mA flowing into the base, the collector could deliver 260 mA should the load be much lower resistance. In this configuration I would expect the transistor to fully turn on to less than 0.5 volts and properly operate the relay.

Short story: You need to drive the BJT's base with enough current and choose a transistor that is rated for a decent hFE at currents in excess of 100 mA.