1
\$\begingroup\$

I have a device plugged into the wall with a 40W bulb on it.

  (40W bulb) ----Trans---- (wall ac source)
                   |
                   |
             (ardunio 5v dc)

my transitor is a IRFML8244TRPBF (little tiny thing)

I hooked up the transistor and to my surprise, the light turned on right away (it's supposed to wait until I supply current to the gate from the arduino).

Is it possible that this transistor is not the proper rating to stop the wall a/c?

if it isn't the proper transistor, could someone recommend one that is strong enough to block that will still allow me to control it with the arduino?

just to note, there are no short circuits, everything is hooked up properly.

\$\endgroup\$
11
  • 24
    \$\begingroup\$ Please do not do any more work with wall power until you understand how electronics works. You can seriously hurt yourself. \$\endgroup\$
    – markrages
    Jun 14, 2012 at 0:04
  • 10
    \$\begingroup\$ Please note that it isn't just about the voltage rating of the transistor! You seriously need to stop until you understand how to control those kinds of voltages and currents SAFELY! \$\endgroup\$
    – W5VO
    Jun 14, 2012 at 1:13
  • 3
    \$\begingroup\$ It's not as simple as just needing a single MOSFET because 120V AC is both positive and negative relative to the neutral line and MOSFETs can really only handle positive drain voltages. What you need is something designed to switch AC, and a requirement that protects YOU is isolation between the switching electronics and the load. Suitable devices may include Relays, Solid State Relays, and opto-coupled Triacs. \$\endgroup\$
    – W5VO
    Jun 14, 2012 at 1:55
  • 3
    \$\begingroup\$ There is no human shown on the circuit diagram with 3 wired "Trans". Why worry about human ? \$\endgroup\$
    – user924
    Jun 14, 2012 at 2:46
  • 6
    \$\begingroup\$ @RocketSurgeon - The human can not be seen on the diagram as it is lying horizontally on the floor out of sight, smoking gently. Smoking is usually bad for your health, but in this case the smoke is a sign of a complete lack of health. The Arduino is also smoking, but it is magic smoke and can be rendered inconsequential by replacement of all active parts, plus the charred PCB, plus some of the passive parts. The transistor will never smoke again. \$\endgroup\$
    – Russell McMahon
    Jun 14, 2012 at 2:53

4 Answers 4

11
\$\begingroup\$

Obviously the other guys beat the safety issue to death, so I won't repeat it here other than to say that they are absolutely correct.

What I want to focus on is why a MOSFET won't work. Even a MOSFET with proper voltage and current ratings. Take a look at the first page of the datasheet for the MOSFET you selected. There is a drawing showing the symbol for a MOSFET inside of the SOT-25 package. If you look closely, there is also a diode between the source and the drain.

That diode goes by several names: parasitic diode, body diode, etc. The diode is not a separate part of the MOSFET that someone put in there, it is a side effect of how a MOSFET operates. All MOSFET's have them, both N and P channel MOSFETs. The diode is not always shown in the diagrams and schematics, but it is always in the real device.

That diode is why MOSFETs are not suitable for switching AC signals. Even if the "switch" part of the MOSFET is turned off, the diode will conduct when the voltage is reversed. In the case of your bulb, if the MOSFET is turned "off" the bulb will still be on for 50% of the AC cycle since the diode will be conducting.

That diode is not a very good diode. It is not fast, and has limited current handling ability. Sometimes you will see a MOSFET with a separate diode in parallel. This is done for circuits where that parasitic diode is wanted, but it doesn't work well enough. You normally see this in high current switching applications like power supplies and motor control.

There is a another reason why your circuit won't work, aside from the voltage spec of the MOSFET and the safety stuff.

It is likely that the +5v power supply for the Ardunio is isolated from the AC mains. This is done for the same safety reasons that everyone was yelling at you for. But the effect of that is that the Arduino is floating with respect to the AC mains (and the source and drain of the MOSFET). And that means that the Arduino cannot generate the proper Gate To Source voltage to actually switch on the MOSFET.

The "Fix" for this is to connect the source pin of the MOSFET to the GND of the Arduino. BUT DON'T DO THAT UNLESS YOU HAVE A DEATH WISH! I only mention this so you can better understand what's going on. If you really did connect this would would have certainly blown up your Arduino and possibly killed yourself.

Now that I've given you a hopefully useful answer, I must address the non-technical part of this Q&A. It is unfortunate that this Q&A quickly degenerated into a semi-rude shouting match. People on both sides could have acted in a more civil way. But you have to understand this: what you were doing could have killed you, started a fire, or done other bad things and it was super important that you stopped doing it as quickly as possible. In cases like this a certain amount of rude yelling is understandable. Not ideal, but understandable. Every parent has yelled very loudly when they see their toddler climbing onto the stove or doing something equally dangerous. But this yelling due to imminent danger doesn't really translate well in a forum like this.

Sorry, I don't mean to compare you to a toddler! The point is this: Sorry for the shouting, but the people here only had your best interest in mind.

There are very few things that will get an Electrical Engineer's blood pumping faster than to see someone inexperienced hooking things up directly to the AC mains. When you do that things can very quickly degenerate into something very tragic. Like the time I decided I could juggle knives when I could barely juggle balls. It ended badly. True story!

\$\endgroup\$
10
\$\begingroup\$

I'm glad we still can talk to you. Or not ;-).

"there are no short circuits"

Sure there's one, inside the transistor. Frankly I'm surprised it didn't explode.

Yes, there are high voltage transistors, but they're still unsuitable for the mains' AC. Like Russell says, use a relay, either an electromechanical one, or a solid state (SSR).

enter image description here

This is how it works. The side left of the blue line is low voltage DC. You can see +12 V which is used for the relay, and +5 V coming from the microcontroller. That part is fed via a power supply which uses a transformer to isolate it from the mains. That's the safe part, touching won't hurt you.
At the right side everything is connected to the mains. Touching any part of it when powered may be the last error you make. The relay bridges the barrier between both sides in a safe way, i.e. with enough clearance so the mains voltage will never accidentally penetrate the low voltage part.

I'm not suggesting you build this circuit, you have to learn a couple of things first, how a transistor works for one thing.

Use a ready-built module you can connect to your Arduino, like this one:

enter image description here

The part below the relays is the safe, low voltage part, which you connect to the Arduino with the connector bottom right. The connectors at the top are for connecting your bulbs.

\$\endgroup\$
8
\$\begingroup\$

Sorry, I'm not trying to be difficult, really.. Please enlighten me!

  • Death of the Arduino is close to certain if you continue on this path.

  • Death of the user is a reasonably high possibility.

Switching mains electricity directly using direct drive from a microcontroller etc is NEVER done professionally.

Your use of a transistor as a switch in this example is unsuitable, but that is a secondary issue.

Working with low voltage will let you learn enough to live long and prosper.
Obtain a low voltage DC power supply and play with that to start.

Once you have even a small degree of competence with that we can guide you re how do drive a 40W AC mains bulb correctly and safely.

Trying to do it as your first attempt makes it possible it will be your last attempt.

This page at Mouser shows you the sort of off the shelf devices that would allow you to do what you want safely. Proper care and some knowledge will still be needed.

This Mouser part is a good fit to your need

What country are you in?


Current ciruit:

  • The transistor is not suitable for switching AC. It is a DC switch

  • The transistor voltage rating is too low

  • The chance of feeding AC back into your computer system is high.

  • The chance of feeding AC back into you is high

  • "Real" circuits use an isolation barrier and a proper AC switch.


Arduino Shield & Relays

You asked if this Arduino "relay shield" would be suitable as an interface. As there were no specs I've turned the photo from here around so the relay markings can be read. They are marked 3A 120VAC, and 3A 24 VDC so they would be suitable for controlling a 40 W bulb. 3A x 110 VAC = 330 Watt, so while you would ideally not run them at the limit, each of thos relays should esily control a 100 Watt bulb on 110 VAC (100W, 110 VAC ~= 1 A). These are $19.50 each for 4 channels of %5/channel, which compares favourably with the costs of the SSR's (solid state relays) from Mouser.

HOWEVER the Tianbo HJR-4102 relay - data sheet here that is used utilises physical metallic contacts and a coil rather than solidstate components as in an SSR. The data sheet says they are rated for 300,000+ operations at 1 A on AC. Operate and release times are a usefully low 5 ms each - but you'd not want to operate them that fast under load very often.

300,000 operations
= once a second for 3.5 days
or once a minute for 7 months
or once an hour for 30+ years.

A solid state relay has the advantage of sensibly unlimited lifetime if run within its ratings.

enter image description here

http://www.tianbo-relay.com/bigimg/15.pdf

enter image description here

\$\endgroup\$
4
  • \$\begingroup\$ Start on low voltage . Start with DC. Once reasonably happy with that we can try the "more exciting" stuff. \$\endgroup\$
    – Russell McMahon
    Jun 14, 2012 at 2:54
  • \$\begingroup\$ Yes, the relay shield should work, but AGAIN, you need a lot more understanding of AC circuitry before using it. If you wire it wrong, you'll blow the relay apart as soon as you turn it on. Do your homework and don't skip steps. \$\endgroup\$ Jun 14, 2012 at 3:01
  • \$\begingroup\$ Reading your question and comments, I am not convinced you understand Kirchoff's Voltage Law, or Current Law, or the two-port model of circuits. This is all very basic stuff that you need to know before the function of a transistor will make any sense. \$\endgroup\$ Jun 14, 2012 at 3:04
  • \$\begingroup\$ @RussellMcMahon: A lot of exciting stuff is at low voltage, honestly there are only a few things on power electronics that amuse me \$\endgroup\$
    – clabacchio
    Jun 14, 2012 at 7:56
1
\$\begingroup\$

Wall A/C = 120V RMS

Drain-Source Breakdown Voltage: 25 V
Gate-Source Breakdown Voltage: 20 V

Your transistor is now melted into a resistor/wire.

As markrages said, you should begin with lower voltages (< 40V).

\$\endgroup\$
2
  • 5
    \$\begingroup\$ Don't. Just don't. \$\endgroup\$ Jun 14, 2012 at 2:55
  • 2
    \$\begingroup\$ Mike DeSimone is absolutely right. The reasons are too elaborate to get into in a comment, and the consequences too serious to ignore. \$\endgroup\$ Jun 14, 2012 at 5:00

Your Answer

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