18 Jun 2013

Switching AC loads with the TRIAC

Often in electronics, you need to switch loads (motors, lights, solenoids...) ON and OFF from a microcontroller's pin or the output of a low-voltage electronic circuit. When you are working with DC sources, a transistor gets the job done : you supply a voltage at the base/gate pin and current will flow from a higher voltage source at the collector/drain pin to the emitter/source pin (for NPN/N-Channel depending if the transistor is Bipolar/MOSFET). The problem with the transistor solution is that its current flow cannot be reversed. It's alright in most situation, but that won't let you work with AC loads.

The two most common way to switch an AC load is to use a mechanical relay or a TRIAC. The relay is easy to use, but has the disadvantages of being slow and consuming a lot of current (to keep the coil energized). Due to the fact that the relay contacts are mechanical, they will also wear out over time and make switching noise. On the other hand, the TRIAC is a small solid-state device that can switch really fast, hence you can use it to dim lights, control motors speed and heating elements. In fact, the TRIAC is used in recent digital electronics thermostats to regulate the power of a heater.

TRIAC overview

The TRIAC is a 3-pin semiconductor device that can let current flow from his main terminals in either direction. Some people describe its behaviour similar to 2 thyristors in antiparallel configuration.


When choosing a TRIAC for your application, take a look at its absolute maximum electrical ratings. The peak voltage (not RMS) of your AC source must be lower than the allowed peak maximum off-state voltage of the TRIAC datasheet. For a 120VAC source, this datasheet value should be higher than 170 volts (Vrms * sqrt(2)). There is also the RMS on-state current and the non-repetitive peak on-state current. Usually, just ensure that the average current of your load is below the RMS on-state current written in the datasheet.

Triggering the TRIAC

To trigger a TRIAC (let current flow between T1 and T2) you need to send a pulse on the gate with respect to the T1 terminal. When you read about TRIAC theory, you can see there is 4 different triggering modes (the four quadrants). All this means is that you can send a positive/negative pulse on the gate while T2 is positive/negative with T1 as the reference. Anyway, you don't really have to care about that to try the following circuits.

Keep in mind that once triggered, a TRIAC will continue to conduct until the current between its terminal drop below its holding current that can be found in its datasheet (a couple of milliamps for small TRIACs). This means that it will stop conducting at the end of the AC cycle, when there is no more voltage difference between hot and neutral (zero crossing). However, if you put DC voltage across the TRIAC terminals, it will conduct indefinitely; or until you cut the wire/shut the power off :)

#1 - With a single AC source

If you want to test if a TRIAC works and mess around with it, this is a simple way to wire it as it only requires a single AC source. I don't really think this circuit is useful unless you want to turn on an AC load by pressing or flipping a switch.  



#2 - With a DC signal

Here's a more interesting way to trigger a TRIAC. With this configuration, you can use an external low voltage DC signal to control an AC load. You have to watch out with this circuit because you have to tie the neutral of your AC source with the ground of your DC subsystem. I would not recommend this configuration with costly development board to control the TRIAC. It is also possible that noise could be injected in analogs part of your circuits, resulting in poor performances (e.g. ADC, op-amps...).


#3 - With a phototriac (opto-isolator)

In my humble opinion, the best and safest way to trigger a TRIAC would be to use a phototriac. It consist of using a chip that isolate the DC part of your circuit from the AC part. If you look closely to the right part of the circuit, it is almost the same as the first configuration we saw instead that the switch has been replaced by another TRIAC. The other TRIAC (phototriac) is triggered by the photodiode that is coupled with it in the chip package. In short, you only have to turn on the photodiode and the main TRIAC will be conducting, thus providing current to your AC load.


There is two kind of phototriacs : the ones with zero crossing circuit and the ones who don't. Phototriacs like the MOC3041 and the MOC3062 have an internal protection circuit that will not let you switch the main TRIAC on until the AC voltage is at the beginning of its cycle. This will prevent you to put a high voltage (middle of cycle) directly on the load as it could create a high in-rush current or excessive electrical noise. Phototriacs like the MOC3023 does not have this kind of protection. In a lot of applications, you won't really care about that.

Conclusion

If you want to try the different configurations above, ensure your load current is okay with the maximum current through your TRIAC. For the triggering resistor, choose it so the current through the gate is above the gate trigger current in the datasheet, just use Ohm's law. Please experiment with caution if you use mains electricity. When I tested the circuits above, I used a small 1.5W 120VAC to 12VAC open frame transformer like the one below so I could put my finger in the circuit without fearing an electrical shock or burning down the house.



6 comments:

  1. Wow! Probably one of the best and easy to understand explanaitions of what a TRIAC is and how it works.

    Thank you very much for sharing knwoledge!

    Arrizen (www.arrizen.com)

    ReplyDelete
  2. Can you explain why the switch & resistor in Example 1 goes to the load side of the triac instead of the other side? Or does it not matter? I am trying to just switch an AC load, useful to me ;).

    ReplyDelete
  3. Hi fgurnee, the switch and resistor goes to the load side because there is only one power supply in this example (the 120VAC). It is using its own 120V to trigger itself. If you put the switch on the neutral side, it is most likely that nothing will happen.

    ReplyDelete
  4. Hi Great Explanation, I am currently researching on my personal project, could you help to have some basic circuit. my project is regarding switch an AC to AC power. AC1 is from the source of solar power which commonly from the battery to inverter and AC2 came from the commercial power source. my problem is every-time i change power i will turn off fist all my appliance to switch power, could help me to design some circuit regarding to my problem or some link that is related to my project. Thank You!

    ReplyDelete
    Replies
    1. Just buy an UPS (https://en.wikipedia.org/wiki/Uninterruptible_power_supply)
      You can buy some on Amazon. You do not need fast switching so in you case I would use a relay. Plug AC1 on the NO contact of the relay and AC2 on the NC. The common will then be your hot signal. Bring that signal to power the UPS and use the UPS output to power your appliances.

      Delete
  5. I am currently researching on my personal project, could you help to have some basic circuit using triac and arduino as the main components. my project is regarding switch an AC to AC power. AC1 is from the source of solar power which commonly from the battery to inverter and AC2 came from the commercial power source. my problem is every-time i change power i will turn off fist all my appliance to switch power, could help me to design some circuit regarding to my problem or some link that is related to my project. Thank You!

    ReplyDelete