Electronic – How to drive a TRIAC from a microcontroller (for low voltages)

microcontrollertriac

As a followup to this question, I would like to figure out how exactly one might go about driving a TRIAC from a microcontroller (for low-voltage applications, such as 24VAC). Imagine a scenario where I've got a low-voltage AC source running a simple switch-mode power supply that supplies my microcontroller. Is it as simple as hooking a GPIO pin to the TRIAC gate and driving the GPIO high (3.3V in this particular case)? Assume I'm using a simple, cheap, and common (apparently) MAC97 TRIAC. Do I need a resistor on the GPIO pin? Does the TRIAC gate conduct current, or is it like a MOSFET gate? If it conducts current, where does it conduct to (the only other two connections are to the AC line)?

Note that I'm not working with mains voltage here; this is for driving low-voltage AC solenoids. I understand that when working with mains voltage that extreme caution is advised and experimentation can be deadly.

Best Answer

Playing with mains can lead to death of drive equipment, load, TRIAC, yourself or users if you get it wrong.

Try hard not to.

Use of an isolated driver IC greatly enhances the chances of you and your drive electronics living much longer. Anything driving mains equipment directly is potentially at mains potential at any time unless you have a properly implemented isolation barrier. This applies to equipment in EITHER mains lead. Being in the "neutral" lead is no guarantee of not experiencing full mains potential.It also applies to any part of the equipment even when "switched off". Only removal from mains by physical disconnection is a certain means of mains not being absent. Then you just have storage capacitors to watch for.

Drive is from gate to main terminal 1.
As MT1 is at mains potential your driver is too.

You CAN drive directly if your port MINIMUM drive current at gate MINIMUM voltage meets gate MAXIMUM current need. The gate to MT1 is a silicon junction (or two) and requires a minimum (or greater) current to trigger the coupler reliably. A TRIAC conducts AC bidirectionally once triggered and continues to do so until the holding current in MT1-MT2 main circuit drops below some data sheet defined level.

You are very very very very strongly advised to use an isolated driver such as the
MOC30xx family optical TRIAC driver. This is a random turn on version that triggers the TRIAC when you trigger the opto coupler but you can get zero crossing versions. The driver comes in various versisons and needs as little as 5 mA or as much as 30 mA max to trigger - see data sheet page 3.

Here is a Fairchild FOD410 zero crossing optocoupled TRIAC driver.

Circuits below are examples only - see data sheet:

enter image description here


Lower voltages:

For a lower voltage- eg 24 VAC, the personal safety aspects are much relaxed, but the microcontroller safety aspects are still a significant consideration.

When (not if) the small TRIAC shown dies due to enthusiastic experimentation or an excess of exposure to reality, one of the failure modes will be worst-possible-input-hard-shorted-to-worst-possible-output. Murphy loves these. Connecting 24 VAC to almost anywhere on an Arduino will usually spoil its day.

An opto-coupled TRIAC driver will both provide protection against worst case TRIAC failure and also allow "floating" TRIAC drive - the opto-coupler ouput is not ground referenced or referenced to anything in the drive circuit before the OPTO COUPLER.