Designing a Triac driver from scratch (not using store bought stuff) - Page 1
Forum section: electronics / projects

author: rajhlinux
author_rank: Contributor
timestamp: May 24, 2021, 11:00:56 am
content: Hello everyone,was wondering if there is a way to design a Triac driver made from raw materials like: transistors, diodes, resistors, regular optocouplers (can be easily made from infrared and phototransistor LEDs).There seems to be no information how one can make a Triac driver from scratch, seems like everyone just buys the commercial stuff (nothing wrong with that).This is just for educational purposes and to expand the knowledge on how to build a Triac driver.Note: I am trying to have a microcontroller to control the power(speed) of an AC fan blower. I would like to avoid any special optocoupler which has a Traic driver built into the optocoupler.Thanks

author: Circlotron
author_rank: Super Contributor
timestamp: May 24, 2021, 11:04:24 am
content: GE SCR manual.http://www.introni.it/pdf/GE%20-%20SCR%20manual%201972.pdf

author: Zero999
author_rank: Super Contributor
timestamp: May 24, 2021, 11:12:04 am
content: Presumably it needs to be isolated?A small transformer can be used. It can be AC coupled to the output of the microcontroller. The TRIAC will trigger, on both the rising and falling edge of the pulse from the output pin. I've done it before with a home made transformer, with a ferrite bead as the core and some kynar insulated wire for the secondary, which had a high enough breakdown voltage to pass the relevent regulations for isolation. I wound it with a turns ratio of 3:1, so the gate current was three times higher, than the MCU's output current.

author: Benta
author_rank: Super Contributor
timestamp: May 24, 2021, 05:01:26 pm
content: I fail to see the reason for this. Sure, you mention "educational purposes", but I'm not going to make my own transistors from scratch.The MOC30xx triac driver optocouplers are industry-standard and have been used for decades. Why would they be inferior to "normal optocouplers"?

author: schmitt trigger
author_rank: Super Contributor
timestamp: May 24, 2021, 05:20:55 pm
content: If you really want to challenge yourself, use a gate drive transformer coupled with an unijunction transistor.Those are explained in the “GE SCR Manual” mentioned earlier. In my opinion, the most comprehensive book on thyristors you’ll find.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: May 24, 2021, 06:35:53 pm
content: Quote from: Benta on May 24, 2021, 05:01:26 pmI mean, I gave it a try myself, years ago (ca. 2010 according to the image dates):This isn't best because the gate pulses are one and done -- with the transformers I used, it seems they did well enough anyway, but preferably the comparator outputs would gate an oscillator, which continuously buzzes the transformer when so enabled -- ensuring the gate is always driven on when it's supposed to be on. Why this matters, will become apparent in a little bit.This generally acts like a BJT half-bridge, except you don't need to worry about hFE and base current, SCRs provide that by themselves; the downside is they don't turn off by themselves. So, if you can figure out turn-off, well, at least turn-on is easy enough, just forward-bias the G-C junction and it'll stay on (provided V(A) > V(C) -- it's a good diode in reverse, it stays off for A < C).So turn-off is the big mystery. An AC phase controller is obvious enough: line flips and the SCR turns off, couldn't be easier*. For an inverter like this, you have to use whiplash to your advantage...*But do beware inductive loads, for which, your fan speed control idea may have some problems. The best starting point is an R+C across the thyristor, to limit dV/dt and dampen ringing, and perhaps an MOV as well to clamp high voltages. When thyristors breakdown (avalanche), the current flow acts like any other -- it latches on. So, without adequate snubbing on an inductive load, a TRIAC typically just stays latched on, as it constantly retriggers itself from the proceeding half cycle's turn-off spike.All the junk laid out on the bench. Cool heatsinks and fast SCRs salvaged from a 60s-70s era motor drive. Lots of big iron in that thing...Switching waveform under load, at highish frequency (a bit over 1kHz):Top is the output waveform, with respect to ground (note the supplies are bipolar, +/-15V around ground). From the left, there's a bit of a flat spot around zero, then voltage sproings up to a fuzzy output-high level. The "sproing" is the supply inductor (the 2 x 160uH), which is coupled so that the same thing happens on both supplies symmetrically, which saves some energy. A few hundred us later, voltage steps down to a flat spot, then falls again, doing the same 'sproing', and so on. The high pulse is slightly longer than low, showing some PWM; this was variable I think to around 100us minimum pulse width (in either direction). (Filtering the output, you could drive a motor or subwoofer with this, just like any other class D amp or step-down converter would. The carrier frequency is just... a bit sluggish, that's all.)The bottom waveform is a current transformer linked to the 0.47uF and inductor...Zoom on the commutation transient:Coming from the left, initially the low side is on, then the top side turns on.This shorts out the supply, pulling output voltage to zero (the midpoint between +V/-V, because the 160uH choke is a 1:1 transformer), and building current through the supply choke (dI/dt = (15V) / (160uH)); the excess inductor current is later burnt off as the ringing transient (well damped by the load resistance, in this case).The resonant cap (0.47uF PP) was initially at fully supply (30V), but the supply voltage just stepped to zero, so the capacitor discharges through the 9uH inductor.This discharge must draw full load current plus reverse recovery current, otherwise the inverter stays latched and you're fucked!This is always the difficulty with SCRs in inverter applications, of course; keep talking and no one explodes!As it happens, the resonant peak is 3A forward, and it swings around and reverses -- I think load current was 1A, so the 2A peak is adequate to turn off both SCRs. Somewhere after the current rises through zero, you see a small step change in the voltage -- probably this is exactly where the SCR(s) turned off, and the resonant current diverts to the MUR2020. Which finally explains the purpose of every component in the inverter.As resonant current drops below 1A, the MUR2020 is reverse biased and turns off. Leftover charge in the 9uH is shared with the supply inductor, and the capacitor charges back up to full supply voltage (resonating with the supply inductor). At this point, both SCRs are off, the supply stabilizes, and the output is open circuit -- everything is nice and off. (We've done it!) If we turn on an SCR, we can start another cycle, at will. In this case, it's just going full wave, so there's a tiny... chop looking transient there, probably the high side SCR turning back on; and so the output swings up.So that's a demo of a... okay I'll admit, a more advanced application of SCRs!For AC phase control, with a TRIAC, as it happens, you can drive the gate either direction. While the SCR is a diode junction from G-K, the TRIAC has an equivalent of two antiparallel diodes, G-MT1 (MT2 is the "switched" end and MT1 is the common terminal). G and MT2 currents can be either direction. When the currents are always in equal directions, it's called I/III quadrant drive -- plot I_MT2 vs. I_G to see this. The other way around is II/IV of course. Typically, all but IV are effective.So, for example, if you drive a TRIAC from a MCU ground-referenced to MT1, you can simply forward-bias the gate to get quadrant I/II drive. Super simple (safely talking to a MCU flying around at mains voltage, however, is another matter!).Say you charge a capacitor from line voltage, and discharge it into the gate: I_G and I_MT2 will be in the same direction (quadrant I/III drive). This is your typical lamp-dimmer circuit. To do this, we need one more special component: a DIAC. This is a low voltage rated, gateless TRIAC. So, it turns on when voltage (in either direction) exceeds the rating, and then it snaps on. So you can charge that capacitor to say 20V during part of the mains cycle, and if you use a variable resistor, the charge rate and therefore phase shift is variable. Whenever the capacitor reaches 20V, it gets dumped into the TRIAC gate, turning it on nice and hard and fast. Slick and simple!Most modern parts work fine in quadrant IV anyway, they just have lower gain -- just sink more current and you're good. There's probably not a lot of places you'd use reverse drive to a TRIAC anyway, but hey, you can if you want to (and if it's rated appropriately).Tim

author: rajhlinux
author_rank: Contributor
timestamp: May 24, 2021, 11:42:05 pm
content: Quote from: Benta on May 24, 2021, 05:01:26 pmI completely agree with your statement, this is just to prove myself and others of something unheard of. Building your own Traic driver seems rather interesting, complex and a fun puzzle to accomplish.I have dozens of MOC3021 drivers and I was just curious how everything works under the hood and see if it is possible to replicate one from scratch. It's about reverse engineering.

author: rajhlinux
author_rank: Contributor
timestamp: May 24, 2021, 11:46:34 pm
content: Quote from: Zero999 on May 24, 2021, 11:12:04 amThis is interesting, I heard professional engineers does not use optocouplers because they fail over time due to the LED degrading over time or malfunctioning. They use some sort of transformer base as the signal source and it is completely isolated and much more redundant than optocouplers.It would be nice if you could share some pictures and diagrams of how you were able to build one with some material list.Thanks

author: rajhlinux
author_rank: Contributor
timestamp: May 24, 2021, 11:51:51 pm
content: Quote from: T3sl4co1l on May 24, 2021, 06:35:53 pmThank You Tim, this is really some excellent content.

author: rajhlinux
author_rank: Contributor
timestamp: May 25, 2021, 02:29:46 am
content: So here is a nice Triac Driver made from scratch which implements the commercial optocoupler with built in Triac driver:https://www.nutsvolts.com/uploads/wygwam/NV_0202_Marston_FIG9.jpgIt's quite weird how I couldn't find such perfect yet simple schematic. I asked an electrical engineer and he found the above schematic and below website containing it:https://www.nutsvolts.com/magazine/article/triac_principles_and_circuits_part_1(Figure 9)This is perfect because everything is made from raw materials and uses a regular optocoupler (which also can be made easily).I can drive this Triac schematic with a microcontroller.Now I am planning to use Q2 and Q3 to drive the Triac which is a negative voltage but what about Q1 and Q4?Do I need to do something for the Triac not to trigger at Q1 and Q4? Does it even matter about how I tell the Triac to go about which quadrant I choose to use?All I need to do is just supply the signal voltage when needed, right? This is off course is in relation to the Zero Cross Reference of each positive and negative Amplitude of one cycle.Now I need some help with the programming, the microcontroller in mind is the infamous ATmega168P (Arduino).I know it will be foolish to use the Arduino IDE to program the microcontroller since the Arduino IDE will compile with a ridiculous overhead.So how exactly should I program this? Does it require some assembly (Don't mind some bare metal programming)Thanks.

author: Circlotron
author_rank: Super Contributor
timestamp: May 25, 2021, 02:35:49 am
content: You can trigger the triac with either gate polarity for either conduction direction, so four combinations. One of those four is a bit more or maybe a bit less sensitive than the rest, can't remember, but no big deal.

author: Zero999
author_rank: Super Contributor
timestamp: May 25, 2021, 08:26:38 am
content: Quote from: rajhlinux on May 24, 2021, 11:46:34 pmOpto-couplers are perfectly reliable, if the right LED current is chosen. It must be high enough to reliably trigger, even after the LED has degraded a bit, yet not too high, otherwise it will cause the LED to quickly degrade.There's nothing complicated about using a transformer to drive a TRIAC. Here's a circuit I used awhile ago to trigger a sensitive gate TRIAC, using a logic circuit. It will trigger on both positive and negative edges of the trigger signal, which is a 5V squarewave. The transformer was wound on a ferrite bead, with fine magnet wire used for the primary and flurocarbon insulated wire for the econdary If you need to trigger a TRIAC, which requires a higher gate current, use a small, sensitive gate TRIAC, to trigger the larger device, rather than beefing up the trigger circuit.

author: aandrew
author_rank: Frequent Contributor
timestamp: May 26, 2021, 04:02:33 pm
content: @zero999 this is very similar to the gate drive circuits we used in industrial motor control; we had the R and C in parallel though and drove it at about 20kHz with a regular old ULN2003. The parallel arrangement gave a nice pulse shape where you had a high current spike with a lower "tail" or back porch which we'd found improved triggering the large (2000A) SCRs we would sometimes use. IIRC our pulse transformers were simple 1:2 with 2500V isolation.

author: Benta
author_rank: Super Contributor
timestamp: May 26, 2021, 06:37:04 pm
content: You need to have the cap inseries, otherwise the transformer will be DC biased. Output from a logic chip is not bipolar.

author: Circlotron
author_rank: Super Contributor
timestamp: May 26, 2021, 10:31:42 pm
content: You could drive the transformer from two micro port pins and get twice the effective voltage swing, then use double the turns ratio so you now have twice the available gate drive current. Also it would drive the transformer both directions so you could reset the flux if timed right.

author: aandrew
author_rank: Frequent Contributor
timestamp: May 26, 2021, 11:52:18 pm
content: Quote from: Benta on May 26, 2021, 06:37:04 pmCorrect, but we did not drive it with a steady DC signal to trigger the SCR; we sent a 20kHz square wave when we wanted the SCR to fire (i.e. from the turn-on point until close to the zero crossing). one end of the pulse transformer went to the unregulated V+, the other end through the R||C network and to the ULN2003 output which could be connected to ground when it was "on".

author: Zero999
author_rank: Super Contributor
timestamp: May 27, 2021, 07:43:24 am
content: Quote from: aandrew on May 26, 2021, 11:52:18 pmWhy did you use a 20kHz signal?I just sent a pulse, long enough after zero crossing to ensure the voltage was high enough to allow the holding current to flow through the load. The input to my circuit was a 50Hz square wave, lagging the mains by a couple of degrees. C1 and R1 filtered out the low frequency element, so the transformer saw short positive and negative pulses, at the zero crossing points.

author: aandrew
author_rank: Frequent Contributor
timestamp: May 27, 2021, 01:16:52 pm
content: Quote from: Zero999 on May 27, 2021, 07:43:24 amThis was for an industrial application; the unit could be in ambient conditions anywhere from -50C to 50C, and the connection between the output of our stuff and the (usually AC motor) was out of our control. SCRs are harder to fire when cold, and if the electrical connection/wire length/phase of moon is just right it could cause the SCR self-commutate. We continuously "picket fence" fired the SCR to ensure it was on when we wanted it to be on.

author: SilverSolder
author_rank: Super Contributor
timestamp: May 27, 2021, 01:36:48 pm
content: Quote from: aandrew on May 27, 2021, 01:16:52 pmInteresting approach - I guess your team must have encountered SCRs that were not "good listeners" in the field?

author: aandrew
author_rank: Frequent Contributor
timestamp: May 27, 2021, 08:55:46 pm
content: We did, on occasion, but really the picket fence approach was described in that GE Thyristor book, IIRC, and for those exact reasons. :-)

author: Terry Bites
author_rank: Super Contributor
timestamp: May 29, 2021, 12:10:40 pm
content: Ah, Unijunctions.. they belong in the same bin as triacs and diacs!The educational element will be "why make what you can buy".

author: aandrew
author_rank: Frequent Contributor
timestamp: May 29, 2021, 06:13:24 pm
content: Quote from: Terry Bites on May 29, 2021, 12:10:40 pmWell I do know that SCRs are used over triacs because they're thinner and easier to cool for this reason. For the medium voltage (2kV - ~12kV) stuff we built, we actually put three SCR pairs in series because it was cheaper to use more of the lower voltage SCRs and actually achieve higher blocking voltage than we could using the more expensive, higher voltage rated SCRs. This of course meant we needed to ensure that all the SCRs fired at exactly the same time and also presented challenges in static and dynamic balancing of the SCR gate recovery currents, but was ultimately the better solution for us.

author: Zero999
author_rank: Super Contributor
timestamp: May 29, 2021, 10:01:12 pm
content: Quote from: SilverSolder on May 27, 2021, 01:36:48 pmYes, I would have just hit the TRIAC with a harder, longer trigger pulse than necessary.I suppose it's no more difficult to program an MCU to output a squarewave, or just use a blocking oscillator, if it's just a transformer and switching transistor.

author: schmitt trigger
author_rank: Super Contributor
timestamp: May 31, 2021, 03:08:59 pm
content: The advantage of using a picket fence drive instead of a continuous square wave is that the picket fence allows a transformer with a lower volt-second rating.However one cannot decrease the picket’s width too much. I would say it has to be wider than the SCR’s worst case latching time.

author: schmitt trigger
author_rank: Super Contributor
timestamp: May 31, 2021, 03:16:57 pm
content: In addition to the GE SCR Manual referred above, there is an excellent ABB app note:Gate-drive recommendations for phase control and bi directionally controlled thyristors.5SYA 2034-02