Microcontroller projects

Triac tips and tricks

last updated: 2023-05-13

Intro

To better use the energy of my photovoltaic generators, I want to be able to heat up my 1000 litre water boiler from my heating system electrically. The power should be continuously adjustable. So I bought simple circuits named "Voltage Speed Controller AC 220V 4000W SCR Dimmer" on aliexpress.

TRIAC controller

Naturally a micro-controller should regulate the power, so I need to understand and change the circuit. A first step was to draw the circuit.

speed controller

TRIAC

My knowledge about TRIACs vanished over time :(. So I had to refresh my memory :). A good help was a video from Clemens Valens from Elektor.

From wikipedia ((https://en.wikipedia.org/wiki/TRIAC):

TRIACs are a subset of thyristors (analogous to a relay in that a small voltage and current can control a much larger voltage and current) and are related to silicon controlled rectifiers (SCRs). TRIACs differ from SCRs in that they allow current flow in both directions, whereas an SCR can only conduct current in a single direction. Most TRIACs can be triggered by applying either a positive or negative voltage to the gate (an SCR requires a positive voltage). Once triggered, SCRs and TRIACs continue to conduct, even if the gate current ceases, until the main current drops below a certain level called the holding current.

So the TRIAC is a triode for alternating current working in 2 directions. It's like analogue relays without moving parts and it can be used to build solid-state relays. The terminals are named A1 or MT1, A2 or MT2 and G (G for Gate, A for Anode and MT for Main Terminal). Naturally we can use the TRIAC to switch an AC load on and off, but also to adjust the power with phase control (switch part of a period of an AC sine voltage, look here).

TRIACs can work in 4 quadrants:

1 quadrant: MT2 > MT1 G > MT1 SCR
2 quadrant: MT2 > MT1 G < MT1
3 quadrant: MT2 < MT1 G < MT1
4 quadrant: MT2 < MT1 G > MT1 least sensitive

To trigger the TRIAC, the gate current must be high enough and have the right polarity for the desired quadrant. Also the gate current pulse must be long enough so that the TRIAC can reach his holding current or lead... current. In AC circuits we will work in 2 quadrants, so we must apply alternately a positive or negative voltage at the gate terminal.

We want to create the trigger signal with a microcontroller. But first we want to understand the used circuit of the board.

But our circuit triggers the gate with a DIAC (TRIAC without gate). TRIACs do not fire symmetrically (slight difference between the two halve of the device). This produces noise. A DIAC can be used as AC switch and works also bidirectional. The DIAC helps to balance the switching characteristics of the TRIAC.

Simulating with LTspice

As we work with a dangerous AC voltage, it is better to first simulate the circuit. LTSpice is unfortunately a Windows program and closed source. I read on the net it is a good choice for AC circuits with TRIACs, and as I have not enough time to test ngspice with Kicad and because of Clemens Video I will use it to understand the circuit. Fortunately it can be used under Wine in Linux.

For an introduction to LTSpice look at this video from Clemens:

So let's start with a simple version of the circuit:

simple triac circuit

ltspice schematic

For the TRIAC and DIAC, we download the Standard and Snubberless TRIACs PSpice model (.lib) and symbols (.olb) and the DIACs PSpice model (.lib) and symbols (.olb) from the st.com site here. After extracting the lib files we copy them to /home/myname/.wine/drive_c/users/weigu/My Documents/LTspiceXVII/lib/ and include them as shown in the video from Clemens.

There is unfortunately an error in st DIACs .lib file. There are missing or misplaced curly braces in line 79. So change
R_R1 N02098 TRG 1.462* {Tr} to
R_R1 N02098 TRG {1.462* Tr}

Analyzing the circuit

We set RV1 to 100 kΩ. R1g will be 104.7 kΩ.

Let's begin with the positive half-wave. The DIAC and the TRIAC are not conducting so the capacitor C1 is loaded through R1.

simple triac circuit 2

When the voltage on C1 (V(l)-V(rc), pink) reaches the breakout voltage of the DIAC (about 32 V, V(g)-V(rc), cyan), a current will flow through the gate and the TRIAC will switch on. A current flows now through the load (red trace, if the current shows in the wrong direction, you have to rotate your resistor 180 degrees in the schematic!).

ltspice trace

simple triac circuit 2

By looking at the voltage over the TRIAC (V(l)-V(load)), we notice that it is not high enough to to reload the capacitor and we see that the voltage over the DIAC (V(g)-V(rc), cyan) stays below 32 V.

ltspice trace

Now the conduction of TRIAC is only controlled by the load current. When this current drops below the holds current of the TRIAC the TRIAC will switch off. This happens when the positive half-wave ends and the AC voltage turns back to 0 V. For the negative half-wave, the capacitor is charged in the opposite direction and we should get the same procedure for the negative half-wave.

We see that is it not really the case for the values and components of this circuit. Clemens get's better results in his video. But perhaps this explains why the circuit needs R2, R3 and rectifier circuit.

Here is the result with the supplementary components:

ltspice trace

We see that it is more symmetric. Finally let's add the snubber circuit. Phase control makes noise so that the TRIAC switching's are not reliable We use an RC filter, called "snubber circuit" to reduce noise in parallel to the TRIAC. The traces do not change after adding the RC filter.

While playing with the parameters I noticed also that the potentiometer is over-dimensioned. Above 260 kΩ there is no more current through the load.

... will be continued in due time ....

My 3 phase heat exchanger (3x2116 W) has a resistance on one phase of 25 Ω (11.3 µH, XL = 0,0035 Ω).

Interesting links