Introduction: 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
Main:-
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
Extra:-
ZIGBEE – X-BEE Series 0 2 (Mesh)
XBEE shield for Arduino.
LABView
Visual Studio
Step 2: Triggering of TRIAC
- 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)
- Switching the TRIAC connected to mains supply with microcontroller (TTL) requires isolation which is provided by opto-coupler.
- 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.
- The control is provided by Arduino Micro-controller which communicates with the XBEE Coordinator node serially.
- Graphic User Interface is provided by LABVIEW. Which communicates with the XBEE Router Serially.
Step 3: Making the Hardware Circuit
- 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.
- For final deployment or project submission you can consider soldering it.
- The most important thing to note here is the optocoupler's GND has to be connected with Arduino's ground.
- The IC used here is MOC3021.
- Make sure the light bulb is properly connected.
- 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()
{ Serial.begin(9600); Serial.print("jk"); Serial.println("ie"); Serial.println("Start"); pinMode(10,OUTPUT); pinMode(12,OUTPUT); pinMode(13,OUTPUT); }
void loop() {
if(Serial.available()>0) { char a=Serial.read(); else if( a=='F') { Serial.println("OFF"); digitalWrite(10,0); digitalWrite(12,0); digitalWrite(13,1); } else if( a=='O') { Serial.println("ON"); digitalWrite(10,1); digitalWrite(12,1); digitalWrite(13,0); } 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 = My.Computer.Ports.OpenSerialPort("COM4") com8.WriteLine("O") 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 = My.Computer.Ports.OpenSerialPort("COM4") com8.WriteLine("F") 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.