0
\$\begingroup\$

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?

\$\endgroup\$
2
\$\begingroup\$

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.

\$\endgroup\$
  • 1
    \$\begingroup\$ Added a circuit schematic to make sure you don't go wrong. \$\endgroup\$ – horta Apr 8 '14 at 21:41
  • 1
    \$\begingroup\$ The coil has a certain built in resistance. It also has certain power limitations. Without a spec sheet on the relay, I assume 200mA is the maxium current that it can take. When you apply 43mA to the base of the transistor, you have the ability to allow 43mA*35 = 1.5 Amps through the relay. That will not only blow up your 2n2222, you'll very likely blow up your relay. The relay itself won't have any protection from overcurrent besides its inherent resistance so max of 5V/Rrelay=Rcurrent. If its internal resistance is low (and it should be) it will allow any amount of current through. \$\endgroup\$ – horta Apr 9 '14 at 20:28
  • 1
    \$\begingroup\$ No, if the LED is meant to have a turn-on voltage of around 0.7V (a typical red LED). If you drop 2V across it, it will likely consume all 2 amps your source gives. That is before it releases its magical smoke... That is why normal LEDs (non-power LEDs) always have a resistor in place to prevent over current through the LED. \$\endgroup\$ – horta Apr 9 '14 at 20:42
  • 1
    \$\begingroup\$ I think the quote you gave "consumer will draw as much current as it needs" applies to linear elements (resistors, caps and inductors). This follows through Ohm's law: V=I*R. An LED is non-linear device, and your relay will likely have a virtually 0 Ohm resistance. That means, if you have a 2V, 2A power supply to it, it will try and consume all the current you offer. 2V/0ohms = infinite. So the practical limit is the maximum 2A that your power supply offers. \$\endgroup\$ – horta Apr 9 '14 at 20:46
  • 1
    \$\begingroup\$ (1V - Diode-turn-on-voltage)/resistance = Current. So if the diode operates at 20mA and the diode turns on at ~0.7V then you have 0.3V/0.02A = 15 Ohms. And what do you mean by thd value? \$\endgroup\$ – horta Apr 9 '14 at 21:04
2
\$\begingroup\$

You should be able to run the relay from either a BJT or a MOSFET. For this application the important thing to remember are; the voltage / current requirement of the relay coil, the operating voltage of your circuit and the voltage of the control signal.

When choosing components with so many parameters i usually use a suppliers parametric search feature, and input the characteristics i want from the component.

See:

BJT: http://uk.farnell.com/transistors-bipolar-bjt-single

MOSFET: http://uk.farnell.com/mosfets

For BJTs it's usually; Collector-Emitter voltage (Vce), Collector current (Ic) and Base-Emitter Current (Ibe). So in your case; Vce > 5 | VIc > 200 mA

And for MOSFETs it's usually; Drain Current (Id), Drain-Source Voltage (Vds), and the threshold Gate-Source Voltage (Vgs). So in your case; Id > 200 mA | Vds > 5 V | Vgs 5V (you want to operate in saturation)

Don't worry if for the current and voltage ratings the component you select has a much higher value, the important values are the switch on thresholds.

You can just connect the output of your uP to the gate of the FET or BJT but this is a bad idea (It usually ends in the magic smoke escaping from your expensive IC). Ideally you should have a current limiting resistor and a pull-down. You can (and probably should) calculate values for these resistors, though in practice I've found that 1k and 10k work for 99% of situations.

Here are some examples of circuits i use / have used to control relays in the past. All of these are low side switching examples, and a +ve signal from the uP will switch on the relay.

Using a NPN BJT

schematic

simulate this circuit – Schematic created using CircuitLab

Using a N-MOSFET

schematic

simulate this circuit

Hope this helps,

-- EP

\$\endgroup\$
  • \$\begingroup\$ Can you explain please how did you got the value of 1k on the base? Does the calculation is the same for FET and BJT? Also, what is the 20k resistor you have between the gatd and gnd? \$\endgroup\$ – gabi Apr 9 '14 at 19:48
  • \$\begingroup\$ The 1k & 10k values where 'pulled out of thin air' i have just found that over the years they work for most situations. \$\endgroup\$ – EmpiricalPython Apr 13 '14 at 14:15
  • 1
    \$\begingroup\$ If you remember BJTs are current controlled and FETs are voltage controlled. For BJT the base input resistor needs to be calculated such that the input current Ib is high enough to saturate the transistor. For FETs the gate voltage needs to be high enough to saturate the transistor. 'R2' is just a pull down, and also limits total input current. I'll update my answer to explain this better \$\endgroup\$ – EmpiricalPython Apr 13 '14 at 14:22

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.