You have a microcontroller, a Raspberry Pi, or an Arduino. You want to use it to control a lamp, a heating element, or a motor operating on 230 V. The control signal is 3.3 V or 5 V. There is a gap between these two worlds — and you need a component to bridge it.
Two options stand out: a relay or a triac. Both switch an AC load on or off based on a low-power control signal. However, the way they achieve this differs fundamentally.

The relay: mechanical but reliable
A relay is an electromechanical switch. The control side (coil) and the switching side (contact) are completely electrically isolated from each other — built-in galvanic isolation.
Advantages
- Fully isolated without extra components
- Switches any type of load: resistive, inductive, capacitive
- No voltage or current loss across the contact when closed
Limitations
- Mechanical wear — limited number of switching cycles (typically 100,000–1,000,000)
- Slower than a semiconductor — switching frequency limited to a few tens of Hz
- Requires more current to energize the coil
The G2RL from Omron is a compact PCB relay. It is easy to integrate into DIY circuits using standard breadboard or PCB grids.
The triac: fast, silent, and wear-free
A triac is a semiconductor component with no moving parts. It conducts current in both directions as soon as it is triggered via the gate, and stops as soon as the current crosses zero.
Advantages
- No wear — virtually unlimited number of switching cycles
- High switching speed — suitable for phase-angle control (dimming, motor speed control)
- Compact, no moving parts, no contact bounce
Limitations
- Not galvanically isolated — requires an optocoupler or MOC3xxx driver
- A small voltage drop during conduction leads to heat dissipation at higher currents
- Sensitive to noise (dV/dt) — a snubber circuit is often required
The BTB16 supports a current of 16 A and a blocking voltage of 600 V, making it suitable for heavy loads such as heating elements and motors.
When should you choose what?
| Situation | Choice |
|---|---|
| On/off switching, low number of cycles | Relay |
| Silent operation required | Triac |
| Inductive loads (motors) | Relay |
| Dimming or phase-angle control | Triac |
| Complete isolation without extra components | Relay |
| High switching frequency | Triac |
| Damp or vibration-prone environment | Triac |
Driving from a microcontroller: pay attention to isolation
With a relay, you need a transistor to switch the coil current, and a freewheeling diode across the coil to suppress voltage spikes.
With a triac, you must use an optocoupler or a triac driver (such as the MOC3021 or MOC3041) to drive the gate. Without that separation, the mains voltage connects directly to your microcontroller — which is extremely dangerous.
Ask your question