I am building new project, which I will power up the water tank heater from my smartphone. I have few safety though I want to ask here to get your opinion.

I am going to use AVR to run a relay, that will be connected to the main AC line. my heater takes about 11-12Amp on 240VAC.

I want to use MOSFET n-channel, instead of NPN (2N2222) transistor, to make sure it will be able to handle the 2 relays (I need 2 relays for safety, 1 on each main AC line). Do you think I am right? Did someone think I should use the BJT? What is the advantage of a BJT (I can see the MOSFET is better in any section, beside price and size)

I am still not sure if I am going to use Mechanical relay (T9A) or SSR.

  • \$\begingroup\$ Why do you think a BJT is better? Knowing your reasoning helps others answer the question. \$\endgroup\$
    – jippie
    Commented Mar 20, 2014 at 19:14
  • \$\begingroup\$ I am not sure if it better, but i see it in a lot of tutorials of relays and Arduinos or AVRs.. \$\endgroup\$
    – gabi
    Commented Mar 20, 2014 at 19:19
  • \$\begingroup\$ Neither is necessarily better, it all depends on power supply voltage, current that can be drawn from the controller, current that the relay requires, cost and availability of the parts (none of which you have mentioned in your question). \$\endgroup\$
    – jippie
    Commented Mar 20, 2014 at 19:23
  • \$\begingroup\$ I will get all the data and update here \$\endgroup\$
    – gabi
    Commented Mar 20, 2014 at 19:25
  • \$\begingroup\$ Thanks for the improvement on your questions, gabi. It's great to have new users here that care. Welcome. \$\endgroup\$
    – JYelton
    Commented Mar 20, 2014 at 20:30

1 Answer 1


Whether the 2N2222 will be able to do the job depends on the current drawn by the relay coils. I would guess it would be no problem. There is no fundamental benefit of BJT's over MOSFET's (or vice-versa) in this application: you just need to switch the current; any transistor capable of handling the current & voltage needed to energize the coil will do.

However, make sure you install a fly-back diode over the relay coil leads, and a current-limiting resistor on the AVR output, otherwise you will fry your circuit. A coil stores magnetic energy, and switching the current off will result in a large negative voltage over the coil. Basically, the voltage will drop indefinitely until something starts conducting; if no fly-back diode is present this will be your poor transistor, and perhaps the AVR driving it.

Safety in this application is determined by:

  • Ensuring through other means that even when the AVR keeps the heater on for ever, no damage will be done.
  • Using a relays capable of handling the HV voltage and current with at least a 30% safety margin (preferably more: don't squibble on safety).
  • Proper separation of the HV and low voltage cabling.
  • Proper insulation of the HV part.
  • Using cables suitable for the HV current and voltage, again with a wide safety margin.
  • Using proper fuses for when there are short circuits.
  • Especially the HV connections to the relays switches are important: ensure that a proper insulation distance is maintained (at least half a centimeter from any conductor for 240V). Also ensure that the wires won't detach, even when the cable is pulled!

As always, working with 240VAC can get you killed or set your house on fire! Be sure that you know what you are doing.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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