Design and Construction of an Automatic Gate by using VB.net and Arduino Microcontroller:
Introduction:
                      In this project   we control the home gate from  pc .This 
project is very important for security purpose  .Here you are control a home gate from remote
and safe place or from control room.
 This project is also used in hydro power
project   where you  can control 
the water flow  coming from
forebay to pin stock  or  from pin stock to turbine   the butterfly valve.You can also
control  the flow of water to spillway.
There are alots of
applications of Auto Door  project in
industries.
Problems statement:
                         If we don’t use Auto door
technology then we have alots of problem 
definitely you can’t control it automatically  you will be go for it and manually  control it 
which is a time waste and hard work. Also you can’t controlled it
precisely these errors will interrupt the whole system.
Objectives:
          In
this project we are control the home Gate from PC.The software use for HMI is
VB.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 are further connect to the motor of the gate.
      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 use Animation library .In this
animation we animated the door to watch the output result continuously .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.
Scope and limitation:
                                    The aim of the design of an automatic Door
mechanism  for  domestic use was successfully realize.
             The system worked according to
specification and proved quite satisfactory. It is relatively affordable,
durable and efficient. Hence, give room for ease of operation and high level of
reliability. 
Finally, it reduces
stress associated with manual Door controller, which require that somebody go
to physically switch them on and off.  
Components used:
               There are so many components used in our
project .Names of these components are mentioned below,
- Voltage Regulator    lm7805,lm7812
- Arduino uno R3
- Relay 
- Diodes
- Tip122 Transistors
- LED
- Resistors 
- capacitors
- Power supply
- Gate (CdRom  used as gate)
- Computer
- PCB(varryboard)
   CD ROM (AS A GATE):
                           We use computer cd rom as
a gate  .which  can open 
or  close  from PC.the gate (cd rom) is connected
to  the 
micro  controller >  and 
micro  controller  is 
connected  to  the 
pc   .
Programing VB.NET HMI:
   
Private g As Graphics
   
Private xPosition As Integer
   
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
       
Me.Height = 550
       
Me.Width = 800
       
Me.Show()
       
g = Me.CreateGraphics
       
Me.BackColor = Color.Aqua
       
Timer3.Start()
        
End Sub
   
Private Sub DrawNewRectangle1(ByVal y As Integer, ByVal x As
Integer)   REM DOOR OPENING RECTANGLE
       
Me.Refresh()
       
g.DrawRectangle(Pens.Black, 130, 50, 400, 400)
       
g.FillRectangle(Brushes.Yellow, 130, 50, 400, x)
       
g.FillEllipse(Brushes.Green, 7, 184, 30, 30)
       
g.DrawRectangle(Pens.Black, 120, 50, 10, 30)
       
g.DrawRectangle(Pens.Black, 120, 420, 10, 30)
       
If x <= 7 Then
           
g.FillRectangle(Brushes.Green, 120, 50, 10, 30)
           
g.FillEllipse(Brushes.Black, 7, 184, 30, 30)
           
Button1.ForeColor = Color.Black
           
REM  Timer1.Stop()
       
End If
    End
Sub
   
Private Sub DrawNewRectangle2(ByVal y As Integer, ByVal x As Integer)   REM DOOR CLOSING RECTANGLE
       
'g.DrawRectangle(Pens.Black, 130, 50, 400, 400)
       
g.FillRectangle(Brushes.Red, 130, 50, 400, x)   REM 
DOOR CLOSE FILL RECTANGLE
       
'g.DrawRectangle(Pens.Black, 120, 420, 10, 30) REM(X,Y,W,H)
        'g.DrawRectangle(Pens.Black, 120, 50, 10, 30)
       
If x >= 400 Then
           
Button3.ForeColor = Color.Black
       
End If
    End
Sub
   
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick    
REM DOOR OPENING TIMER
       
If xPosition < 7 Then
           
REM  xPosition = 7
           
'If CheckBox1.Checked = True Then
           
My.Computer.Audio.Play(My.Resources.b, AudioPlayMode.Background)
           
'Else
           
g.FillRectangle(Brushes.Green, 120, 50, 10, 30)
           
Timer1.Stop()
           
Button3.Enabled = True
           
'End If
       
End If
           
xPosition -= 15.5
           
DrawNewRectangle1(400, xPosition)      
REM DOOR OPENING RECTANGLE
    End
Sub
   
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer2.Tick     
REM DOOR CLOSING TIMER
       
If xPosition > 370 Then
           
REM xPosition = 400  355
           
My.Computer.Audio.Play(My.Resources.b, AudioPlayMode.Background)
           
g.FillEllipse(Brushes.Black, 7, 184, 30, 30)        REM RGB BLACK
           
g.FillRectangle(Brushes.Green, 120, 420, 10, 30)    REM LIMIT SWITCH 2 GREEEN
           
Timer2.Stop()
           
Button1.Enabled = True
        End If
       
xPosition += 15.5                                   REM   30.6   
15.5
       
DrawNewRectangle2(400, xPosition)
    End
Sub
   
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
       
Timer1.Start()
       
Timer2.Stop()
       
g.FillEllipse(Brushes.Green, 7, 184, 30, 30)
       
Button1.ForeColor = Color.Green
       
REM Button1.BackColor = Color.Violet
       
My.Computer.Audio.Play(My.Resources.a, AudioPlayMode.Background)
       
Button3.Enabled = False
    End
Sub
   
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
       
Timer2.Stop()
       
Timer1.Stop()
       
g.FillEllipse(Brushes.Black, 7, 184, 30, 30)
       
Button1.ForeColor = Color.Black
       
Button3.ForeColor = Color.Black
       
My.Computer.Audio.Play(My.Resources.b, AudioPlayMode.Background)
       
Button1.Enabled = True
       
Button3.Enabled = True
    End
Sub
   
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
       
Timer2.Start()
       
Timer1.Stop()
       
Me.Refresh()
       
g.FillEllipse(Brushes.Red, 7, 184, 30, 30)    REM 
RGB   Red
       
Button3.ForeColor = Color.Red
       
My.Computer.Audio.Play(My.Resources.a, AudioPlayMode.Background)
       
Button1.Enabled = False
    End
Sub
   
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
       
Me.Hide()
       
Form3.Show()
    End
Sub
   
Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer3.Tick
       
g.DrawRectangle(Pens.Black, 120, 50, 10, 30)    REM limit switch 1
       
g.DrawRectangle(Pens.Black, 120, 420, 10, 30)    REM limit switch 2
       
g.DrawRectangle(Pens.Black, 130, 50, 400, 400)    REM door rec
       
g.DrawEllipse(Pens.Black, 7, 184, 30, 30)        REM rgb
       
Button1.BackColor = Color.BlueViolet
       
Button2.BackColor = Color.BlueViolet
       
Button3.BackColor = Color.BlueViolet
       
Button4.BackColor = Color.BlueViolet
    End
Sub
End Class
Imports System.IO.Ports
Public Class Form2
   
Private mySerialPort As New SerialPort
    Dim
instance As SerialPort
   
Private g As Graphics
   
Private yPosition As Integer
    Dim
a As Integer
    Dim
b As Integer
   
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
       
Call CommPortSetup()
       
Me.Height = 550
       
Me.Width = 800
       
Me.Show()
       
g = Me.CreateGraphics
       
Me.BackColor = Color.Aqua
       
Timer1.Start()
       
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
       
g.DrawRectangle(Pens.Black, 130, 50, 400, 400)
       
g.DrawEllipse(Pens.Black, 7, 184, 30, 30)
    End
Sub
   
Private Sub CommPortSetup()
        With mySerialPort
           
'a = ComboBox1.Text
           
'b = ComboBox1.Text
           
.PortName = "COM" & Module1.uname1
           
.BaudRate = 9600                            REM
Module1.uname2                       
           
.DataBits = 8
           
.Parity = Parity.None
           
.StopBits = StopBits.One
           
.Handshake = Handshake.None
       
End With
    End
Sub
   
Private Sub DrawNewRectangle1(ByVal x As Integer, ByVal y As Integer)
       
Me.Refresh()
       
g.DrawRectangle(Pens.Black, 130, 50, 400, 400)
       
g.FillRectangle(Brushes.Yellow, 130, 50, 400, y)
       
g.FillEllipse(Brushes.Green, 7, 184, 30, 30)
       
g.DrawRectangle(Pens.Black, 120, 50, 10, 30)
       
g.DrawRectangle(Pens.Black, 120, 420, 10, 30)
       
If x <= 7 Then
           
g.FillRectangle(Brushes.Green, 120, 50, 10, 30)
           
g.FillEllipse(Brushes.Black, 7, 184, 30, 30)
           
Button1.ForeColor = Color.Black
           
REM  Timer1.Stop()
       
End If
    End
Sub
   
Private Sub DrawNewRectangle2(ByVal x As Integer, ByVal y As Integer)
       
g.DrawRectangle(Pens.Black, 130, 50, 400, 400)                 REM 
       
g.FillRectangle(Brushes.Red, 130, 50, 400, y)           REM DOOR OPEN REC
       
g.DrawRectangle(Pens.Black, 120, 420, 10, 30)                  REM 
       
g.DrawRectangle(Pens.Black, 120, 50, 10, 30)                   REM
       
If x >= 400 Then
           
Button7.ForeColor = Color.Black
       
End If
    End
Sub
   
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button5.Click
       
Timer3.Start()
       
Timer4.Stop()
       
g.FillEllipse(Brushes.Yellow, 7, 184, 30, 30)
       
Button5.ForeColor = Color.Yellow
       
My.Computer.Audio.Play(My.Resources.a, AudioPlayMode.Background)
       
Button7.Enabled = False
    End
Sub
   
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button6.Click
       
My.Computer.Audio.Play(My.Resources.b, AudioPlayMode.Background)
       
Timer4.Stop()
       
Timer3.Stop()
       
Try
           
mySerialPort.Write("3")
       
Catch ex As Exception
           
MessageBox.Show(ex.Message)
       
End Try
       
g.FillEllipse(Brushes.Red, 7, 184, 30, 30)
       
Button5.ForeColor = Color.Black
       
Button7.ForeColor = Color.Black
       
Button5.Enabled = True
       
Button7.Enabled = True
       
End Sub
   
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button7.Click
       
Timer4.Start()
       
Timer3.Stop()
       
Me.Refresh()
       
g.FillEllipse(Brushes.Green, 7, 184, 30, 30)
       
Button7.ForeColor = Color.Green
       
My.Computer.Audio.Play(My.Resources.a, AudioPlayMode.Background)
       
Button5.Enabled = False
    End
Sub
   
Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer3.Tick
       
If yPosition < 7 Then
           
REM   yPosition = 7
           
Timer3.Stop()
           
Button7.Enabled = True
           
My.Computer.Audio.Play(My.Resources.b, AudioPlayMode.Background)
       
End If
       
yPosition -= 30
       
DrawNewRectangle1(400, yPosition)                    REM DOOR OPEN RECTANGLE 
        g.FillRectangle(Brushes.Green,
120, 50, 10, 30)      REM LIMIT SWITCH 1
       
Try
           
mySerialPort.Write("2")
       
Catch ex As Exception
           
MessageBox.Show(ex.Message)
       
End Try
    End
Sub
   
Private Sub Timer4_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer4.Tick
       
If yPosition > 355 Then                                     REM door
down limit
           
REM(yPosition = 400)
           
My.Computer.Audio.Play(My.Resources.b, AudioPlayMode.Background)
           
Timer4.Stop()
           
g.FillEllipse(Brushes.Black, 7, 184, 30, 30)            REM    RGB LED
           
g.FillRectangle(Brushes.Green, 120, 420, 10, 30)        REM  
LIMIT SWITCH  2
           
Button5.Enabled = True
       
End If
       
yPosition += 30
       
DrawNewRectangle2(400, yPosition)                           REM  DOOR CLOSE RECTANGLE
       
REM g.FillRectangle(Brushes.Red, 550, 110, 40, 41)
       
Try
           
mySerialPort.Write("1")
       
Catch ex As Exception
           
MessageBox.Show(ex.Message)
       
End Try
    End
Sub
   
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
       
Me.Hide()
       
Dim i As Integer
       
Try
           
mySerialPort.Close()
       
Catch ex As Exception
           
i = MessageBox.Show(ex.Message)
       
End Try
       
Form1.Show()
    End
Sub
   
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
       
g.DrawRectangle(Pens.Black, 120, 50, 10, 30)       REM   
fORM Loading time limit switch 1 line
       
g.DrawRectangle(Pens.Black, 120, 420, 10, 30)      REM   
fORM Loading time limit switch 2 line
       
g.DrawRectangle(Pens.Black, 130, 50, 400, 400)     REM fORM START RECTANGLE LINE
       
g.DrawEllipse(Pens.Black, 7, 184, 30, 30)          REM   
RGB LED AT FORM LOADING TIME 
       
Button1.BackColor = Color.BlueViolet
       
Button5.BackColor = Color.BlueViolet
       
Button6.BackColor = Color.BlueViolet
       
Button7.BackColor = Color.BlueViolet
    End
Sub
End Class
Public Class Form3
   
Private g As Graphics
   
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
        Me.Show()
       
g = Me.CreateGraphics
       
Me.BackColor = Color.Aqua
       
Button1.BackColor = Color.BlueViolet
       
Button2.BackColor = Color.BlueViolet
    End
Sub
   
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
       
Module1.uname1 = ComboBox1.Text
       
Module1.uname2 = ComboBox1.Text
       
Form2.Show()
       
Me.Hide()
    End
Sub
   
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
       
Form1.Show()
       
Me.Hide()
    End
Sub
Module Module1
   
Public uname1 As String
   
Public uname2 As String
End Module
Arduino Programing :
  int dooropen = 13;
Block Diagram:
Circuit diagrams:
Project Images:
                                                       Video:
Twitter : https://twitter.com/MohsinH73145168







 
 
 
Comments
Post a Comment