page contents Verification: 3e521cb8638cc050

Control Of Home appliance From PC Through Arduino Microcontroller

Introduction:  In this project, we control all the home appliances from PC. This project is very important for the 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 good power management.  In case of any failure in the power system, early recovery is possible and less time will be wasted.
       In such a project you can control any type of Electric power, for example, you can control the power of small industries, big industries, power plants, etc.
There are a lot’s of applications of this project on the industries side.

 

General block diagram:

Objectives :
              In this project, we are controlling home appliances from PC. The software used 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 receives the data serially and sending a 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 used in the Arduino Command Line Interface (CLI). From this language, we control the whole circuits.
Both 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 the market. I will also make a blog on how to make your own PCB(Printed circuit board). This module has 4 channels. It means that you can control four different devices from this module. The following components are used in this circuit.
1: Four 12 volts relays 
2: Four transistors (TIP 122).
3: Four diodes.
4: LED.
5: DC socket.
6: Resistor.
7: Female header row.
8: Some wires.
9: LM-7812 Voltage Regulator.
 
 
 
 

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

 
 

Watch Video Tutorial

Hello, Friends, My name is Mohsin Habib and I am an Electrical Engineer. I have Experience In Circuit Designing, Arduino Projects, PLC’s Projects, HMI Designing, Networking and much more. I have done lots of projects in Arduino.

3 thoughts on “Control Of Home appliance From PC Through Arduino Microcontroller

Leave a Reply

Your email address will not be published. Required fields are marked *