[SOLVED] Transistor as switch - 3.3V to switch a 5V relay.

Originally I wanted to switch a 5V relay with a 3.3V output of a microcontroller.

It didn’t work, and I tried to isolate the cause, so I ended up with the attached circuit.

Okay, maybe I could use a 3V relay without a transistor, I know. But I really want to understand what’s going on here:

The regulator works, it has 3.25V on it’s Vout pin. The relay works, I can switch it with 5V. I checked the polarity. The transistor works (the multimeter sais it’s ok) and I tried different ones (also a 2N2222).
R1 was 1K but I also tried 100R and no resistor at all.

I guess it’s the 3.3V which cause the problem. I can see max 50µA flowing through R1, which is too little for the transistor to go low resistance.

What can I do?

EDIT:

Oh no…

After staring at the drawing, I realize, the coil limits the flow from the transistor’s base to ground.

I’m sorry for the post…

Relay.PNG

767a231be75f03038fe7a05806b3dbe92d63ab62.png

Mmm, did you change the picture?

Presuming that the thing marked “3.3 V regulator” is in fact the 3.3 V Arduino with its regulator, what is wrong is that the transistor emitter can only ever pull up to 0.7 V less than the base - this is called an “emitter follower” circuit.

It is the wrong circuit.

You need to connect the transistor emitter to ground and the collector to the relay, which then goes to the 5 V supply. That way, when the transistor switches on, almost all of the 5 V will be across the relay.

The resistor R1 should be about 470 ohms.

You need a diode across the relay, cathode to 5 V, anode to the transistor collector.