Transistor to run relay

avrbjtmosfetrelaytransistors

In addition to my last post I have more information and details.

I want to run 240V Relay (5V Coil) from my AVR chip (ATmega328P).

My EMR relay takes up to 200mA on it peak.

I have 2N2222 transistor, and I have MOSFET (IRFZ44N power MOSFET).

What is the criteria to deiced which transistor to use?

The BJT can allow up to 800mA (which is ok for me), and the IRFZ44N can take up to 50A (which looks too much), but I also find some MOSFETs that runs 1A.

It looks like the MOSFET is easier, just connect the output pin from the IC to the gate and that's it, while the BJT has some calculations involved. Am I right?

Best Answer

schematic

simulate this circuit – Schematic created using CircuitLab

The IRFZ44N would likely work, but it may be slower in switching and definitely overkill for your project. The 2n2222 transistor should work fine. I would take 200mA divided by the minimum gain of the transistor (hfe=35) and you'd get the current that you need to send into the base of your transistor. 200mA/35=5.714mA into the base of the transistor. The Vbe (voltage between the base and emitter) when on is generally around 0.7V. So you have 5V-0.7V = 4.3V. Then you need that 4.3V to push 5.7mA of current. Using ohm's law you get 4.3/0.0057 = 754 ohms of resistance.

In summary, you'll have about 6mA of current flowing through the base to the emitter which with minimal gain of 35 you'll end up with 200mA of current from collector to emitter. Attach the collector to the 5V relay coil, the other side of the relay coil to Vdd, and you should be set.