Introduction
More than a decade ago, I published a blog post titled Understanding 24 VAC Sprinkler Valves. In that post, I took a close look at the sprinkler solenoid’s inrush vs. holding currents under 24 VAC, performed theoretical analysis and actual measurements, and explained the difference in the solenoid’s electrical behavior under AC vs. DC. While 24 VAC is a fairly old technology, it is still the standard for landscaping and irrigation projects today. These solenoid valves are cheap, robust, and widely available in home improvement stores.


In commercial sprinkler controllers, the most common way to switch these solenoids is by using triacs. Over the years, I’ve received many questions about triacs in sprinkler controller designs. So in this post, I’ll take an in-depth look at how to use a triac to switch sprinkler solenoids, interface it directly with a microcontroller (MCU) such as ESP8266, explain the two common power architectures used in real products, and discuss the choice of gate current-limiting resistors.
Triac Basics
You may already be familiar with transistors, but what is a triac? It is a 3-terminal semiconductor component, much like a BJT transistor or MOSFET, but primarily used to switch AC current rather than DC. With a standard NPN transistor, current flowing into the base-emitter junction “switches on” the transistor, allowing current to flow from the collector to the emitter. When the base current stops, the transistor switches off.




A triac’s three terminals are named Gate, Main Terminal 1 (MT1), and Main Terminal 2 (MT2). These are analogous to Base, Emitter, and Collector of a transistor. Similarly, current flowing between the Gate and MT1 can turn it on, allowing current to flow between MT2 and MT1. However, there are key differences:
- Bidirectional Conduction: When on, current can flow between MT2 and MT1 in either direction. This makes the Triac suitable for switching AC load. In contrast, BJTs transistors conduct current in one direction only.
- Bidirectional Gate Triggering: Unlike a transistor, a triac can be triggered not only by current flowing into the Gate, but also by current flowing out of the Gate. In other words, the gate current itself can be bidirectional. This leads to different operating Quadrants depending on signal polarity (see below).
- Latching Behavior: When the Gate current is removed, a triac remains ON as long as the current flowing between MT2 and MT1 exceeds a minimum threshold called the holding current. When used with AC, the triac naturally turns off near each zero crossing when the load current falls below this threshold. This also explains why if you try to use a triac to switch DC current, it will only turn on but won’t be able to turn off unless you unplug the power.
The Four Quadrants
Because a triac controls AC power that swings positive and negative, and the Gate can be triggered by either positive or negative current, there are four distinct operating modes, or Quadrants. These are defined by the polarity of MT2 and the Gate, both measured relative to MT1.
- Quadrant 1 (Q1): Gate Positive (+), MT2 Positive (+)
- Quadrant 2 (Q2): Gate Negative (-), MT2 Positive (+)
- Quadrant 3 (Q3): Gate Negative (-), MT2 Negative (-)
- Quadrant 4 (Q4): Gate Positive (+), MT2 Negative (-)

Why does this matter? While a triac is a bidirectional switch, it is not perfectly symmetrical on the inside. The silicon structure behaves differently in each quadrant, which means the Gate Trigger Current (the current required to turn the triac on) varies by quadrant:
- Q1, Q2, and Q3 are the most sensitive: is the lowest in these quadrants.
- Q4 is the least sensitive, often requiring 2-3x more trigger current than Q1.
Some Example Triacs:
- MAC97 is a very low-cost, “sensitive-gate” triac commonly used in sprinkler controller circuits. Its in Q1-Q3 is 3-5mA; and in Q4 is 7-10mA (some datasheets omit Q4).
- BT136 is a higher-power triac. Its in Q1-Q3 is 10mA max, and in Q4 is 25mA.
This matters greatly when driving a triac directly from a MCU’s GPIO pin. Some GPIOs may not source enough current to reliably trigger Q4. Some “High Commutation” (Snubberless) triacs do not operate in Q4 at all. This specific limitation drives the design decisions for the power architecture, as we will see next.
Circuit Design Assumptions
Before moving on, let me state a few assumptions to guide the design choices:
- Single Power Supply: The same 24 VAC transformer powers both the solenoid valves and the logic circuits. This assumption is fairly obvious as it’s too cumbersome to require two separate power supplies.
- Direct Triac Control from GPIO: As a sprinkler controller can have many zones, to minimize cost, we drive a triac directly by a MCU pin. Alternatives exist—relays, solid-state relays, opto-isolated drivers—but they are bulky, more expensive, some involving moving parts, and unnecessary in a single-supply design where true galvanic isolation does not exist anyway.
- Half-Wave Rectification: We use a single diode to convert 24 VAC to DC for the logic. This choice is not primarily about cost—it is essential to make a single-supply triac design work. Specifically, half-wave rectification allows the MCU ground and one side of the AC waveform to share a common reference. Full-wave rectifiers, in contrast, create a “virtual ground” that would short-circuit the triac drive path in this topology.
- Continuous Gate Drive: We will hold the gate signal active for the entire duration of the “ON” state, rather than pulsing it at zero-crossings like in classic triac circuits. This simplifies the circuit design. While it slightly increases power consumption, the added dissipation is negligible compared to the solenoid current.
Power Architecture for 24 VAC Sprinkler Controllers
Deriving DC from 24 VAC
The first step is converting 24 VAC into low-voltage DC (5V or 3.3V) to power the MCU and peripherals. This is done using a half-wave rectifier (single diode) and a bulk capacitor, followed by a step-down voltage regulator.
Linear Regulator. In older, non-smart controllers, the step-down regulator is often linear (e.g., a discrete zener-based regulator or a 78xx/79xx chip). This is feasible only if the MCU’s current draw is small. You see, a 24 VAC transformer, under light load, can output an unregulated voltage as high as 30 VAC RMS. This corresponds to a peak voltage of 30*1.414 = 42.4V, which is dangerously high. In fact, if you touch the two wires of the transformer, your fingers may get a tingling sensation!
For a small MCU drawing 10mA, dropping 42.4V to 3.3V dissipates about (42.4V-3.3V)*0.01A = 0.391 W. Not too bad with a decent heat sink. This is why linear regulators are common in legacy controllers.
Switching Regulator. Modern, smart controllers typically have a WiFi or Ethernet chip that can easily draw at least 100mA. This would push the power dissipation to nearly 4W – impractical for a linear regulator. For this reason, modern smart controllers all use switching regulators (e.g., LM2574 or LM2596-class chips) to efficiently step down high voltage without excessive heat. The old-school MC34063 can also be used, though its low switching frequency may cause audible noise under light load.
To directly interfacing a MCU with the triac, there are two topology choices.
Design Choice A: MT1 Tied to the Positive Rail
If you reverse-engineer a legacy non-smart controller (e.g., Orbit 28964), you will typically find:
- A negative voltage regulator (e.g., via a zener-based circuit or a 7905 chip).
- The triac’s MT1 is tied to the positive rail (MCU’s VCC).
- Active LOW Logic: The MCU pulls the gate LOW to turn it on. This is similar to how a PNP transistor works as a high-side switch.

Why did they do this? By tying MT1 to MCU’s VCC, the Gate is always pulled negative to MT1 when active. This forces the triac to operate in Q2 and Q3, both high-sensitivity quadrants. The MCU only needs to sink (and never source) current, which is ideal for older MCUs with weak GPIO capability, including open-drain-only outputs. In addition, GPIOs default to high or Hi-Z at power-on, keeping valves safely off. Finally, as the MCU consumes very little current, a linear regulator is acceptable.
The Downside: Setting VCC as voltage reference results in a negative GND voltage, which can be unintuitive and confusing. Extending the system with sensors and additional hardware (which often assume standard GND) is harder.
Design Choice B: MT1 Tied to GND
Modern smart controllers typically use a standard “Common Ground” topology:
- The triac’s MT1 is tied to MCU’s GND, much like the NPN transistor’s emitter is tied to GND.
- Active HIGH Logic: MCU pulls the Gate High to turn it on.
- The power circuitry uses a standard positive voltage switching regulator.

Why do they do this? Positive voltage switching regulators are more common and cheaper to source than the negative voltage counterparts, especially when a high input voltage rating (>50V) is required. Also, using GND as voltage reference is easier to understand, debug, and extend.
The Downside: With MT1 grounded, the triac operates in Q1 and Q4. While Q1 is easy to drive, Q4 is the least sensitive quadrant. This is why modern designs almost universally use sensitive-gate triacs such as MAC97 (THT) or Z0103MN (SMD), with Q4 ≤ 7 mA.
When higher-power-rating triacs are needed, you have to watch out for the Q4: if the GPIO cannot provide sufficient in Q4 (in fact, some snubberless triacs don’t support Q4 operation at all), the triac would simply not conduct in half of the AC cycles, resulting in unreliable valve activation and audible noise.
Gate Resistor Selection
To drive a triac directly from a MCU, a gate resistor is required to limit current. The resistor must be small enough to guarantee sufficient in Q4, but large enough to avoid unnecessary power waste or exceeding the MCU GPIO’s current limit.
Assume VCC = 3.3 V, triac’s Q4 = 7 mA (max), Gate forward voltage = 1.5 V (worst-case), we have:
In practice, values in the 220-330 Ω range should work well.
Using Shift Registers or IO Expanders: When controlling many zones, GPIOs can quickly run out. In this case, adding a shift register (e.g., 74HC595) or I2C I/O expanders (e.g., PCA9535) is a common solution. But be careful: these devices may have much weaker current sourcing capability than GPIOs. Voltage drop under load must be considered, and gate resistors may need to be reduced accordingly. If the required cannot be met, an external transistor gate driver may be necessary.
One additional note: if the I/O expander outputs are pulled high at power-on, it will be necessary to add a strong gate pull-down resistor (e.g., 10 kΩ) to keep the gate LOW at power-on. Otherwise, you will notice the sprinkler solenoids momentarily pop up at power-on, which is undesirable.
Verify Gate Current Using an Oscilloscope
The calculation of gate current above assumes a static measurement, but since the triac is controlling an AC load, the forward-on voltage and gate current are both dynamic. Therefore I decided to take measurements using an oscilloscope to make sure the triac is reliably switched on.
To do so, I made a simple prototype circuit consisting of a 24 VAC to 3.3 VDC switching regulator, a MAC97 Triac, an adjustable gate resistor (100~1100 Ω), a 1 Ω shunt resistor for measuring load current, and a terminal block to hook up a 24 VAC solenoid. Below is a simplified schematic and the actual photo of it.


I hooked up a 4-channel oscilloscope to test points A, B, C, D respectively: A and B are the Gate voltages before and after the fixed 100 Ω resistor; C and D are Load voltages before and after shunt resistor . Therefore is the gate current, and is the load current.
By varying the potentiometer from low to high, I found the point at which the load current starts to miss half of the AC cycles, indicating the triac was still firing in Q1 but failing in Q4. Below are the measurement screenshots. Channels A, B, C, D are displayed in Yellow, Cyan, Purple, and Blue respectively.
When :


We can see that (A-B) varies between (1.8-0.88) = 0.92 V and (0.8-(-0.64))=1.44 V, corresponding to 9.2~14.4 mA gate current. This is well above the required trigger current, therefore the triac is fully on.
The “Negative Voltage” Anomaly. You might notice in the screenshots that the Gate voltage is negative in some regions, even though the MCU is continuously holding the gate signal High (thus current is flowing into the Gate). At first glance, I was greatly puzzled by this, as it seems to suggest a region of “negative resistance”.
After some research, I concluded this may be due to Ground Bounce or parasitic inductance. Since MT1 is the “Ground” reference for the triac, when a large current surge flows out of MT1, it can momentarily make the Gate appear negative relative to MT1. Interestingly, this negative region happens to occur in Q4, when current flows from MT1 to MT2. It effectively increases the voltage potential across the Gate resistor, thus it actually helps keep the triac triggered in Q4.
The screenshot below show the direct measurement of . The peak voltage is 0.37 V, corresponding to 260 mA RMS current. This is consistent with the typical holding current of a 24 VAC solenoid.

When :

With a larger gate resistor, (A-B) now varies between (1.52-0.84) = 0.68 V and (0.2-(-0.92))=1.12 V, corresponding to a gate current of 6.8~11.2 mA. The triac is still solidly on.
When :

This is where things start to collapse. The gate current drops to only about 2.6~2.7 mA. While the triac is still triggering in Q1, it fails in Q4. Consequently, the load current starts to miss half of the AC cycles, clearly visible in the waveform below. The solenoid also begins to make a loud buzzing noise.

Additional Considerations
There are some additional considerations I omitted above. These are less of a concern for sprinkler controllers, as they run on low voltage (24VAC), but can be important when using triacs to switch general AC loads that are high-voltage and/or high-current.
1. Latching vs. Holding Current Triac’s datasheets distinguish between Latching Current (minimum MT2-MT1 current required to turn the triac on) and Holding Current (required to stay on). With inductive loads like solenoids, current lags voltage. If you were using short pulses to trigger the triac, the pulse might end before the current rises high enough to latch, causing the triac to fail. In our design, however, this distinction is largely irrelevant because the Gate is held active continuously. The triac is retriggered every half-cycle, so precise latching timing is not critical.
2. Critical dV/dt and False Triggering “dV/dt” refers to how fast the voltage across the triac changes. If voltage spikes too fast, the triac can trick itself into turning on without a Gate signal. This can be a major concern when switching a high-voltage load, such as 110 V or 220 V. In our case, however, 24 VAC is a relatively low voltage, thus the risk of false triggering is low.
3. Snubbers and MOVs / TVS Diodes Sprinkler wires run underground and outdoors, making them giant antennas for lightning and static induction.
- MOVs or TVS Diodes: It is recommended to place an MOV or TVS diode across the 24 VAC input terminals. This acts as a surge protector, clamping high-voltage spikes before they blow up your triac or even MCU.
- Snubber: RC snubbers are optional but can further reduce stress on the triac.
Summary
Triacs are a great choice for switching 24 VAC sprinkler solenoids: they are cheap, compact, and have no moving parts for long-term reliability. With careful attention to quadrant operation, gate current, and power architecture, a triac can be driven directly from a microcontroller without opto-isolation or external drivers.
Design Checklist
- Use a sensitive-gate triac with low Q4 trigger current requirement
- The MT1-to-GND design is generally preferred for WiFi-enabled designs due to switching regulator availability.
- Choose gate resistors based on worst-case Q4 , and account for under-load voltage drop if using shift registers or I/O expanders.
- Add MOV/TVS protection and snubber per triac.
Links
Tags: 24vac solenoid, opensprinkler, sprinkler controller, triac













