Introduction: 110V / 230V Switch Circuit for Arduino / Raspberry Pi - Home Automation

First of all, 110V / 230V is lethal. Do this project at your own risk! If you don't know what are you doing, ask help!

With this switch you can control your lamps and electric devices like TVs, coffee machines, stereos etc.

Normal electromechanical relays are very unreliable. This is a better solution that can switch up to 600V / 8A, and totally isolated from the microcontroller thanksto the optocoupler.

Components you need:

- Arduino (arduino on Ebay)

- perfboard

- BTA08-600C triac (BTA08 on Ebay)

- MOC3021 optocoupler (MOC3021 on Ebay)

- 300 Ohm resistor

- 100 Ohm resistor

Tools you need:

- soldering iron (soldering iron on Ebay)

Step 1: The Hardware

The circuit is pretty simple. The microcontroller you use drive the triac through the optocoupler. The optocoupler is for safety reasons, but I recommend to use it.

Step 2: The Software

Here is an Arduino example code to show you how simple it is to use this circuit. When the digital pin is HIGH the triac switch on, when the pin is LOW the triac switch off.

void setup() {

pinMode(3, OUTPUT);


void loop() {

digitalWrite(3, HIGH);


digitalWrite(3, LOW);



IoT Challenge

Participated in the
IoT Challenge