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

2,238

14

4

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);

delay(1000);

digitalWrite(3, LOW);

delay(1000);

}

IoT Challenge

Participated in the
IoT Challenge

Be the First to Share

    Recommendations

    • Space Contest

      Space Contest
    • Metal Contest

      Metal Contest
    • Fashion Challenge

      Fashion Challenge

    4 Comments

    0
    oyeka
    oyeka

    2 years ago

    Good job!
    We have seen ARDUINO switching up to 4 or more relays.
    How could this be extended to do the same.

    0
    redlee999
    redlee999

    Reply 2 years ago

    It is pretty simple, you can build as many of this as many you need, and you can connect them to the microcontrollers GPIO pins. So if your microcontroller has 12 digital pin, you can connect 12 of this circuit to it. If you need more than that, you can use shift registers or chips called port expanders.

    0
    audreyobscura
    audreyobscura

    2 years ago

    I'd love to learn more about the components you're choosing. Is there anything special about this octocoupler?

    0
    redlee999
    redlee999

    Reply 2 years ago

    There is nothing really special about this optocoupler, its reverse voltage is 3V so can switch by a microcontroller, and output terminal voltage is 400V so it is safe if something wrong kicks in on the triac side.
    There is nothing special about the triac either, the main reason I choose this, it can handle 600 volts and 8 amps, so it is more than enough in an average home.