AC grid power control using Triac

CAUTION: this module was design to connect directly to the AC grid power, and its misuse might cause ELECTRIC SHOCK and FIRE. Only use this module if you already have prior experience with mains AC circuits, and carefully follow the safety recommendations at the bottom of this page.

The Triac Nanoshield can be used to control appliances connected to the power grid in 127V or 220V AC (alternating current) using the I/O pins of your Arduino. Is is ideal for applications like:

  • Lamp switching or dimming (also check the Zero Cross Nanoshield).
  • Control of home appliances like table lamps, electric ovens, coffee makers, fans, etc.
  • Control of electric gates

There are 4 options of I/O pins to activate the triac (D3#, D5#, D6# e D9#), which can be easily selected using jumpers on the board. In case these four options are not enough, there are 7 more options that can be selected by solder jumpers at the bottom side of the board (D2, D4, D7, A2, A3, A4 e A5). The triac is activated when there is a high logic level on the correponding I/O pin, and deactivated when the there is a low logic level on the pin.

The triac is activated via an optocoupler and the triac lead that is kept in contact with the heatsink is internally isolated. This keeps the AC voltage away from the microcontroller and other DC circuits.


  • Control of AC loads in 127V and 220V.
  • Available with a 25mm heatsink for currents up to 2.5A or with a 50mm heatsink for currents up to 5A (see the current graph below).
  • Activation with 5V or 3.3V, through an optocoupler.
  • 4 options for the output pin to use, selectable by manual jumpers, and 7 additional pins selectable by solder jumpers.
  • LED indicating if the triac is on or off.


Triac diagram

Triac connections

!Arduino wiring

The following diagram show how to connect the Triac Nanoshield directly to an Arduino UNO or an Arduino Mega.

Connecting to an Arduino UNO (click to enlarge)

Connecting to an Arduino Mega (click to enlarge)

!Switching capability

Maximum recommended switching current vs. ambient temperature

The current limits indicated above are for conditions where there is no airflow (like when the boards are installed on the interior of an enclosure, for example). You can extend those limits by adding extra airflow via fans or openings in the enclosure to cool down the components.

Electrical specifications

  • Power supply: done through the VCC pin, with a range from 4.5V to 5.5V (5V typical).

  • Logic level: the triac can be activated with a logic level of 5V or 3.3V.

!Safety recommendations

Please follow the recommendations below before using this Nanoshield or any other device that is directly connected to the mains AC grid power supply.

  • Keep in mind that AC mains current can be very dangerous. Accidents can cause injuries and even death. Hence, only use this equipment if you have prior knowledge about mains electrical circuits and if you are absolutely certain of what you are doing. If you are a beginner who is starting to play with electronics, do not use this Nanoshield or any other equipment which has a direct connection with the mains AC grid.
  • Certify yourself that the electrical installation of the place you are working on follows the local safety rules and has a residual-current circuit breaker (RCCB) installed.
  • Never touch or handle the device when it's the mains AC power is on – always turn off the circuit breaker before connecting the wires or doing any manual configuration in the system.
  • This Nanoshield does not have safety devices like fuses or circuit breakers – you must install them externally according to the particular needs of your project.
  • If you want to include this module in a commercial product, check the requirements that are applicable to the safety certification processes in your area.