Introduction:

                     In this project   we control all the home appliances from PC .This project is very important for home, office, shops etc. The most important use of this project is in the industries where you can control thousands of appliances from one single PC. it gives you reliable  results of controlling a lot  of devices  .
             The other big advantage of this project is a good power management.  In case of any failure   in the power system early recovery is possible and less time will be waste.
       In such project you can control any type of Electric powers, for example you can control power of   small industries, big industries, power plants  etc.
There are a lot’s of application of this project in the industries side.



General block diagram:


Objectives :

              In this project we are controlling home appliances from PC  .The software use for Developing an HMI (Human machine Interface)  is  VB.NET (visual basic dot net).
We send data from vb.net HMI to Arduino microcontroller .The arduino receive the data serially 
and sending command to the output pins  which control the relays, the relays  control  the appliances.
      In this project we use two computer languages the 1st one is Visual Basic Dot Net (VB.NET)  and the 2nd language is C++  .In VB.NET we design HMI which shows the whole system to control with a single click. The HMI continuously monitored the whole system .The C++  language  is use in the Arduino Command Line Interface (CLI) .From this language we control the whole circuits.
Both the languages will be serially connected to each other.

Components:

         PC/Laptop
         Arduino uno (Microcontroller)
         Relay Circuit Module.   (I am using 4 channel relay module)
         Power supply 12 volts. ( To power the relay module)
         Jumper wires. (Male to male)

Circuit Diagram:


Relay Module:

                    I made this  module my own but you can also buy it from market.I will also be  make a blog on how to make your own PCB(Printed circuit board).This module have 4 channel .i mean that you can control four different devices from this module.In following components are used in this circuit .
1:Four 12 volts relays 
2:Four tipp 127 transistors.
3:Some diodes.
4:led.
5:DC socket.
6:Resistor.
7:Female header row .
8:Some wires.

Arduino Code:

int bulb = 13;
   int fan = 12;
   int tv = 11;
 void setup() {
               pinMode(bulb, OUTPUT); 
               digitalWrite(bulb, LOW);
               pinMode(fan, OUTPUT); 
               digitalWrite(fan, LOW);
               pinMode(tv, OUTPUT); 
               digitalWrite(tv, LOW);
               Serial.begin(9600);
               }
void loop()  { 
                delay(500);
                while(Serial.available() > 0)
                         {
                   byte incomingByte = Serial.read(); // Reads incoming byte from serial
                   if( incomingByte == '1'){ digitalWrite(bulb, HIGH);
                                              Serial.println("bulb ON");
                                             delay(100);
                                            }

                     if( incomingByte == '2'){ digitalWrite(bulb, LOW);
                                                Serial.println("bulb OFF");
                                              delay(100);
                                             }
                   
                    if( incomingByte == '3'){ digitalWrite(fan, HIGH);
                                              Serial.println("Fan ON");
                                              delay(100);
                                             }
                   
                     if( incomingByte == '4'){ digitalWrite(fan, LOW);
                                               Serial.println("Fan OFF");
                                               delay(100);
                                               }
                    
                     if( incomingByte == '5'){ digitalWrite(tv, HIGH);
                                               Serial.println("TV ON");
                                               delay(100);
                                             }
                     
                     if( incomingByte == '6'){ digitalWrite(tv, LOW);
                                               Serial.println("TV OFF");
                                                 delay(100);
                                              }
                     
                        } 
           }
                 

Vb.Net HMI Code:



Public Class Form1
    Private g As Graphics
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        g = Me.CreateGraphics()
        Me.Height = 500
        Me.Width = 860
        Me.BackColor = Color.Aqua
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Me.PictureBox1.Image = My.Resources.L1
        Timer3.Start()
        Timer4.Start()

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Me.PictureBox1.Image = My.Resources.L2
        Timer3.Stop()   REM belt stop
        Timer4.Stop()
    End Sub

    
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Timer1.Start()
        Timer2.Start()
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Timer1.Stop()   REM belt stop
        Timer2.Stop()
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Me.PictureBox2.Image = My.Resources.a1
    End Sub

    Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
        Me.PictureBox2.Image = My.Resources.a2
    End Sub

    Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick
        Me.PictureBox1.Image = My.Resources.L1
    End Sub

    Private Sub Timer4_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer4.Tick
        Me.PictureBox1.Image = My.Resources.L3
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        Me.PictureBox3.Image = My.Resources.TV1
        Timer5.Start()
        Timer6.Start()

    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        Me.PictureBox3.Image = My.Resources.TV1
        Timer5.Stop()   REM belt stop
        Timer6.Stop()
    End Sub

    Private Sub Timer5_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer5.Tick
        Me.PictureBox3.Image = My.Resources.TV2
    End Sub

    Private Sub Timer6_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer6.Tick
        Me.PictureBox3.Image = My.Resources.TV3
    End Sub

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        Me.Hide()
        Form2.Show()

    End Sub

    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
        Me.PictureBox1.Image = My.Resources.L1
        Timer3.Start()
        Timer4.Start()

        Timer1.Start()
        Timer2.Start()

        Me.PictureBox3.Image = My.Resources.TV1
        Timer5.Start()
        Timer6.Start()
    End Sub

    Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
        Me.PictureBox1.Image = My.Resources.L2
        Timer3.Stop()   REM belt stop
        Timer4.Stop()

        Timer1.Stop()   REM belt stop
        Timer2.Stop()

        Me.PictureBox3.Image = My.Resources.TV1
        Timer5.Stop()   REM belt stop
        Timer6.Stop()
    End Sub
End Class









Imports System.IO.Ports
Public Class Form2
    Private g As Graphics
    Private mySerialPort As New SerialPort
    Dim instance As SerialPort
    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        g = Me.CreateGraphics()
        Me.Height = 500
        Me.Width = 860
        Me.BackColor = Color.Aqua
        Call CommPortSetup()

        Dim i As Integer
        Try
            mySerialPort.Open()
        Catch ex As Exception
            i = MessageBox.Show(ex.Message)
        End Try
        If i = 1 Then
            Form1.Show()
            Me.Dispose()
        End If
    End Sub
    Private Sub CommPortSetup()
        With mySerialPort
            'a = ComboBox1.Text
            'b = ComboBox1.Text
            .PortName = "COM" & 5         REM Module1.uname1
            .BaudRate = 9600                            REM Module1.uname2                       
            .DataBits = 8
            .Parity = Parity.None
            .StopBits = StopBits.One
            .Handshake = Handshake.None
        End With
    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Me.PictureBox1.Image = My.Resources.L1
        Timer3.Start()
        Timer4.Start()
        Try
            mySerialPort.Write("1")
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Me.PictureBox1.Image = My.Resources.L2
        Timer3.Stop()   REM belt stop
        Timer4.Stop()
        Try
            mySerialPort.Write("2")
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub


    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Timer1.Start()
        Timer2.Start()
        Try
            mySerialPort.Write("3")
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Timer1.Stop()   REM belt stop
        Timer2.Stop()
        Try
            mySerialPort.Write("4")
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Me.PictureBox2.Image = My.Resources.a1

    End Sub

    Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
        Me.PictureBox2.Image = My.Resources.a2
    End Sub

    Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick
        Me.PictureBox1.Image = My.Resources.L1
    End Sub

    Private Sub Timer4_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer4.Tick
        Me.PictureBox1.Image = My.Resources.L3
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        Me.PictureBox3.Image = My.Resources.TV1
        Timer5.Start()
        Timer6.Start()
        Try
            mySerialPort.Write("5")
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        Me.PictureBox3.Image = My.Resources.TV1
        Timer5.Stop()   REM belt stop
        Timer6.Stop()
        Try
            mySerialPort.Write("6")
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub Timer5_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer5.Tick
        Me.PictureBox3.Image = My.Resources.TV2
    End Sub

    Private Sub Timer6_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer6.Tick
        Me.PictureBox3.Image = My.Resources.TV3
    End Sub

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        Form1.Show()
        Me.Hide()
    End Sub
    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
        Me.PictureBox1.Image = My.Resources.L1
        Timer3.Start()
        Timer4.Start()

        Timer1.Start()
        Timer2.Start()

        Me.PictureBox3.Image = My.Resources.TV1
        Timer5.Start()
        Timer6.Start()
        Try
            mySerialPort.Write("8")
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
        Me.PictureBox1.Image = My.Resources.L2
        Timer3.Stop()   REM belt stop
        Timer4.Stop()

        Timer1.Stop()   REM belt stop
        Timer2.Stop()

        Me.PictureBox3.Image = My.Resources.TV1
        Timer5.Stop()   REM belt stop
        Timer6.Stop()
        Try
            mySerialPort.Write("9")
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

    End Sub
End Class



HMI Pictures:








Project Hardware Images




Post a Comment

Auto Gate HMI Animation VB.NET | Automatic Gate Open Close Application S...

Code: Public Class Form1     Private g As Graphics     'Private xPosition As Integer     Private yposition As Integer    Private Sub For...

 
Top