High Power Switching Control




Controlling the triggering of a TRIAC using LABVIEW, ZIGBEE and ARDUINO Interface as an application to Home Automation System.

Step 1: Components Required


3 Resistors - R1 = 360E, R2 = 470E and R3 = 39E

 Capacitor – C1=0.05uf, C2=0.01uf

 Opto-coupler – MOC3021

 TRIAC – 13BT26E

 Arduino Uno

 Lamp 40W


 ZIGBEE – X-BEE Series 0 2 (Mesh)

 XBEE shield for Arduino.

 LABView

 Visual Studio

Step 2: Triggering of TRIAC

  1. A simple circuit involving a TRIAC as the main component can be made for triggering of a Lamp connected to the mains (230V 50Hz supply)
  2. Switching the TRIAC connected to mains supply with microcontroller (TTL) requires isolation which is provided by opto-coupler.
  3. A Snubber circuit is applied at the end of the output of the opto-coupler. This prevents the unwanted triggering of the TRIAC due to noise.
  4. The control is provided by Arduino Micro-controller which communicates with the XBEE Coordinator node serially.
  5. Graphic User Interface is provided by LABVIEW. Which communicates with the XBEE Router Serially.

Step 3: Making the Hardware Circuit

  1. You can build this simple circuit using a bread board but please make sure its well isolated as we are playing with mains. All you need is some wires and the components.
  2. For final deployment or project submission you can consider soldering it.
  3. The most important thing to note here is the optocoupler's GND has to be connected with Arduino's ground.
  4. The IC used here is MOC3021.
  5. Make sure the light bulb is properly connected.
  6. Finally Check all the connections.

Step 4: Arduino

  • Arduino Uno's Pin 10 is connected with the optocoupler. (To MOC3021 Pin 1)
  • The ground should be common for Arduino and optocoupler. (MOC3021 Pin 2)
  • Following is the code in Arduino.
  • This code turns on light bulb when 'O' is passed serially (enter 'O' in serial monitor)
  • And likewise turns off the bulb when 'F'.
  • (12 is status LED.
  • 13 is opp of 12.)
  • (Mode 1,2,3 are in comments use them if you want to mess with the intensity of bulb)

void setup()
void loop()
    char a=Serial.read();
    else if( a=='F')
    else if( a=='O')
    if( a=='1')

*/ { Serial.println("ONE"); analogWrite(10,50); digitalWrite(12,1); digitalWrite(13,0); } else if( a=='2') { Serial.println("TWO"); analogWrite(10,100); digitalWrite(12,0); digitalWrite(13,1); } else if( a=='3') { Serial.println("THREE"); analogWrite(10,200); digitalWrite(12,0); digitalWrite(13,1); }

*/ } }

Step 5: XBee

As we are passing the command serially it can be easily made wireless using Xbees.

You will additionally require a Xbee sheild for Arduino.

Follow the following Tutoial to learn how to setup/configure Xbee.
XBee Tut

Step 6: Visual Basic

As we are passing the command serially it can be done without using Arduino IDE.

We can make a simple Visual Studio Windows Application that can create an interactive GUI.

For this you will have to use serial port.

Make sure the COM port is right and the baud rate as well.

Public Class Form1
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Using com8 As IO.Ports.SerialPort =
            BackgroundImage = System.Drawing.Image.FromFile("C:\Users\JWALANT\Desktop\bulbon.jpg")
        End Using
    End Sub
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    End Sub
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Using com8 As IO.Ports.SerialPort =
            BackgroundImage = System.Drawing.Image.FromFile("C:\Users\JWALANT\Desktop\bulboff.jpg")
        End Using
    End Sub
End Class

Step 7: LABView

Finally if you want to make it seem more professional use LABView for serial communication.

The already available template for serial communication is used.

Step 8: Best of Luck !!!

Hope this tutorial was helpful for your project. This project can even be tried out with an android application.This tutorial concentrated mainly on the Hardware Part but I have tried to Include as many as ways possible to control. You can use your own micro-controller and some other GUI (maybe with voice command like JARVIS). But the hardware circuit will remain this same.



    • Beauty Tips Contest

      Beauty Tips Contest
    • Backyard Contest

      Backyard Contest
    • Colors of the Rainbow Contest

      Colors of the Rainbow Contest

    12 Discussions


    Question 2 months ago

    Hi interesting looking project. Wondering how the values of the snubber circuit would change for 110-120vac? Sorry, was not good at dynamic circuits...guessing half their values, but...? And sounds like snubber only used for inductive circuits, so if using LED light instead of incandescent, would not need snubber at all...is that right?

    Appreciate in advance your responses.

    1 answer

    Reply 2 months ago

    Hi, I guess you would be fine without a snubber circuit as even for incandescent it was working quite fine without it. I added that solely because this was part of my academic project and I wanted to display some power electronics skills. Rating also should remain same according to my knowledge.


    3 years ago

    nice bro, i want to make it for my final project


    3 years ago on Introduction

    Perhaps you could clarify this statement, "The most important thing to note here is the optocoupler's GND has to be connected with Arduino's ground." Are you suggesting that an Arduino can only sink current, and not source it? If that is true then it is a serious limitation indeed. Or did you just say it because of how your code is written?

    3 replies

    Reply 3 years ago on Introduction

    grounds between different devices often have to be "commoned" to enable the circuit to work.


    Reply 3 years ago on Introduction

    Oh OK you are sourcing current from your micro controller. It is funny that in absolutely every example circuit in their data sheet Texas Instruments is controlling the device from the cathode side. I guess they're old school just like I am. So they do not connect the cathode to the common ground, but rather to the output of a logic gate. What you're seeing there is the more often way that experienced electronics engineers do it. Which I do understand is not how most people tend to think about these things. But it is electrically the better way to go nevertheless.


    3 years ago

    hi!!! very nice instructable indeed! i have a doubt though: whats the power rating for your resistors??? Thanks again!

    1 reply

    3 years ago on Introduction

    If you put 5V on the MOC LED without any resistor to limit the current you'll burn it in seconds.

    To answer pfred2, Arduino is better when sourcing (as almost components). There's no need to connect "grounds", you can consider the MOC LED as a floating device, simply provide it some current !