For switching high-powered loads from a microcontroller, or for switching AC loads in general, most of us will reach into the parts bin and pull out a generic relay of some sort. Relays are fundamental, proven technologies to safely switch all kinds of loads. They do have their downsides, though, so if you need silent operation, precise timing, or the ability to operate orders of magnitude more times you might want to look at a triac instead. These solid state devices can switch AC loads unlike other transistor-based devices and [Ray] at OpenSprinkler is here to give us an overview on how to use them.
The key to switching an AC load is bi-directional conductivity. A normal transistor or diode can only conduct in one direction, so if you try to switch an AC load with one of these you’ll end up with what essentially amounts to a bad rectifier. Triacs do have a “gate” analogous to the base of a bipolar junction transistor, but the gate will trigger the triac when current flows in either direction as well. The amount of current needed to trigger the triac does depend on the state of the switched waveform, so it can be more complex to configure than a relay or transistor in some situations.
After going through some of the theory around these devices, [Ray] demonstrates how to use them with an irrigation system, which are almost always operating on a 24VAC system thanks to various historical quirks. This involves providing the triacs with a low voltage source to provide gate current as well as a few other steps. But with that out of the way, switching AC loads with triacs can become second nature. If you prefer a DC setup for your sprinklers, though, [vinthewrench] has demonstrated how to convert these sprinkler systems instead.

Another big use case for Triacs over relays is for when you need to do switching in environments where you cannot have sparks.
Don’t forget the optotriac driver too…especially if you want zero cross detection.
Also PWM’ing an electric light. Relay would whine loudly and eventually die from mechanical abuse. Triac have been used for brightness control of incandescent light.
One of the main current challenges is the minimum gate trigger current required to control light loads
Hate these things. Its never just a triac
Its always opto for zero cross detection, opto diac for triggering the triac, and the triac itself.
Well, I’d want isolation anyway, so an optocoupler is essential, take a look at the MOC3041 or similar, it has zero crossing build in.
Author here. To clarify: this guide is specifically about using triacs to switch sprinkler solenoids, not AC mains where opto-isolation would be mandatory. As explained in the post, sprinkler controllers universally use a single-transformer design where one side of 24 VAC is shared with either MCU’s VCC or GND. As such there is no galvanic isolation to preserve. Also, a solenoid is an inductive load which limits inrush current, so they don’t need zero-crossing drivers to prevent current spikes. For these reasons, sprinkler controllers almost always use direct GPIO drive rather than MOC type isolators.
Ahhhh triacs, nasty creatures. With these diac trigger circuits that make annoying hysteresis that no one bothers to get rid of. Lately a dimmer for one of my lamps blew up, what an annoyance. Had these characteristics too. Opened it up thf other day for post-mortem analysis and it did seem quite minimalistic, not sure even the diac was there. They went cheap on it. The thing would heat up even when off, what a piece of dreck.
Got that cheap variable temperature soldering iron once, that is not much more that a triac based dimmer that feeds the hot end, but thy sent me the 110V version. Converting the thing to 220V was a fun side project actually, adding phase to the trigger so it can have duty cycle less than 50%. Also got rid of the hysteresis that way if I recall correctly. Measured it by inductively coupling the supply wire to a junk dso138 and watching the waveform. Had to simulate the thing and replace a few resistors and add a capacitor, the diac/triac pair were already in spec for 220V to my surprise and happiness. I think that I still have the thing somewhere. Good times.
There is a component called a “quadrac”, it is essentially a triac with an integrated diac. The Q4006LT
for example, and those are frequently used in dimmer circuits. No external diac required.
Well, good for those who got one. Mine had a simple BTA16. I take back what I said about the diac though, it’s there but hiding well under the potentiometer.
The thing has died spectacularly too, with a bang and tripping the RCD of the whole apartment while at it. Not even sure how it can even happen actually, but it happened every time I pushed the circuit breaker back. The triac is shorted now for good afaik, the thing is toast.
I’m using a bistable relay to control my Lionel Trains. That eliminates the solenoid hold current.
Wonder how well this would work with a variable AC source. The ZW Transformer has four outputs, which I assume are in phase with each other. One of them could be used to generate the DC Voltage relative to the AC we want to switch. Also the Transformer has a nominal 6VAC minimum output Voltage so it doesn’t turn completely off. Both the Triac and the Bistable Relays turn completely off so the reversing functions of the Engines would be problematic. Unless we switch in a fixed “off” AC Source… Then there is the horn signal which adds a DC offset. Having the triac switch off while the current is zero is nice as the Lionel Engine is an inductive load. I was thinking of adding a current zero crossing detector to switch the bistable relay while the current is near zero.
The older trains run smoother and quieter with the older rheostat type transformer.
Ah, interesting comparison. In the sprinkler world, there is a direct equivalent to bistable relays: Latching Solenoids. They typically operate on 9V DC pulses and require an H-Bridge to flip polarity. Because of their power efficiency, you mostly see them in battery-operated controllers (like Hunter’s Nodes) rather than mains-powered units.
Standard 24 VAC solenoids can run just fine on DC too. As Bryan mentioned, one method is vinthewrench’s approach, which uses PWM to regulate the holding current.
Another method is the ‘dual-voltage’ approach in the DC-powered OpenSprinkler (https://opensprinkler.com/introducing-dc-powered-opensprinkler-v3-4/). It uses a booster to provide a high-voltage ‘Kick’ for inrush current, then drops to a lower voltage for holding current.
Thanks again, Ray, for the boost capacitor idea! I implemented it following your idea, and it works like a charm in my self-designed DC sprinkler valve controllers. I combined it with Tasmota and ESP32.
You wouldn’t believe how much corrosion i’ve seen in DC systems; you can get away with more sloppiness there for AC, but constant consistent one-direction ionic migration can be impressive in its ability to just chew stuff up.