I will set this post as solved now 
Thanks
VB CODE:
Imports System.IO.Ports
Imports System.Windows.Forms.DataVisualization.Charting
Public Class Form1
Private Delegate Sub myDelegate(ByVal Buffer As String)
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
Me.WindowState = FormWindowState.Maximized
ConnectionPanel.Focus()
ComboBoxBaudRate.SelectedIndex = 0
KeyPreview = True
End Sub
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
If e.KeyCode = Keys.Escape Then Me.Close()
End Sub
Private Sub SerialPort1_DataReceived(sender As Object, e As SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
SerialPort1.ReadTimeout = 50
Dim sData As String = Nothing
Try
sData = SerialPort1.ReadLine
Catch ex As Exception
End Try
Me.BeginInvoke((New myDelegate(AddressOf DisplayData)), sData)
End Sub
Private Sub DisplayData(ByVal sdata As String)
Dim chartvalue As Integer
Dim txtarray As String() = Split(sdata, ",")
If txtarray(0) = "Sensor1" Then
TextBox1.Text = txtarray(1) & " %"
Integer.TryParse(txtarray(1), chartvalue)
Chart1.Series("Sensor1").Points.Add(chartvalue)
End If
If txtarray(0) = "Sensor2" Then
TextBox2.Text = txtarray(1) & " %"
Integer.TryParse(txtarray(1), chartvalue)
Chart1.Series("Sensor2").Points.Add(chartvalue)
End If
If txtarray(0) = "Sensor3" Then
TextBox3.Text = txtarray(1) & " %"
Integer.TryParse(txtarray(1), chartvalue)
Chart1.Series("Sensor3").Points.Add(chartvalue)
End If
End Sub
Private Sub ButtonScanPort_Click(sender As Object, e As EventArgs) Handles ButtonScanPort.Click
ConnectionPanel.Focus()
If LabelStatus.Text = "Status : Connected" Then
MsgBox("Conncetion in progress, please Disconnect to scan the new port.", MsgBoxStyle.Critical, "Warning !!!")
Return
End If
ComboBoxPort.Items.Clear()
Dim myPort As Array
Dim i As Integer
myPort = IO.Ports.SerialPort.GetPortNames()
ComboBoxPort.Items.AddRange(myPort)
i = ComboBoxPort.Items.Count
i = i - i
Try
ComboBoxPort.SelectedIndex = i
ButtonConnect.Enabled = True
Catch ex As Exception
MsgBox("Com port not detected", MsgBoxStyle.Critical, "Warning !!!")
ComboBoxPort.Text = ""
ComboBoxPort.Items.Clear()
Return
End Try
ComboBoxPort.DroppedDown = True
End Sub
Private Sub ComboBoxPort_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBoxPort.SelectedIndexChanged
ConnectionPanel.Focus()
End Sub
Private Sub ComboBoxPort_DropDown(sender As Object, e As EventArgs) Handles ComboBoxPort.DropDown
ConnectionPanel.Focus()
End Sub
Private Sub LinkLabel_LinkClicked_1(sender As Object, e As LinkLabelLinkClickedEventArgs)
End Sub
Private Sub ComboBoxPort_Click(sender As Object, e As EventArgs) Handles ComboBoxPort.Click
If LabelStatus.Text = "Status : Connected" Then
MsgBox("Connection in progress, please Disconnect to change COM.", MsgBoxStyle.Critical, "Warning !!!")
Return
End If
End Sub
Private Sub ComboBoxBaudRate_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBoxBaudRate.SelectedIndexChanged
ConnectionPanel.Focus()
End Sub
Private Sub ComboBoxBaudRate_DropDown(sender As Object, e As EventArgs) Handles ComboBoxBaudRate.DropDown
ConnectionPanel.Focus()
End Sub
Private Sub ComboBoxBaudRate_Click(sender As Object, e As EventArgs) Handles ComboBoxBaudRate.Click
If LabelStatus.Text = "Status : Connected" Then
MsgBox("Conncetion in progress, please Disconnect to change Baud Rate.", MsgBoxStyle.Critical, "Warning !!!")
Return
End If
End Sub
Private Sub ButtonConnect_Click(sender As Object, e As EventArgs) Handles ButtonConnect.Click
ConnectionPanel.Focus()
Try
SerialPort1.BaudRate = ComboBoxBaudRate.SelectedItem
SerialPort1.PortName = ComboBoxPort.SelectedItem
SerialPort1.Open()
TimerSerial.Start()
LabelStatus.Text = "Status : Connected"
ButtonConnect.SendToBack()
ButtonDisconnect.BringToFront()
PictureBoxConnectionStatus.BackColor = Color.Green
Catch ex As Exception
MsgBox("Please check the Hardware, COM, Baud Rate and try again.", MsgBoxStyle.Critical, "Connection failed !!!")
End Try
End Sub
Private Sub ButtonDisconnect_Click(sender As Object, e As EventArgs) Handles ButtonDisconnect.Click
ConnectionPanel.Focus()
TimerSerial.Stop()
SerialPort1.Close()
ButtonDisconnect.SendToBack()
ButtonConnect.BringToFront()
LabelStatus.Text = "Status : Disconnect"
PictureBoxConnectionStatus.Visible = True
PictureBoxConnectionStatus.BackColor = Color.Red
End Sub
Private Sub ChartSettings()
Chart1.BackColor = Color.Bisque
Chart1.Series("Series1").ChartType = SeriesChartType.Spline
Chart1.Series("Series2").ChartType = SeriesChartType.Spline
Chart1.Series("Series3").ChartType = SeriesChartType.Spline
Chart1.Series("Series1").BorderWidth = 2
Chart1.Series("Series2").BorderWidth = 2
Chart1.Series("Series3").BorderWidth = 2
Chart1.Series("Series1").Color = Color.Red
Chart1.Series("Series2").Color = Color.DarkBlue
Chart1.Series("Series3").Color = Color.Yellow
With Chart1.ChartAreas(0).AxisX
.Maximum = 300
.Minimum = 0
.LabelStyle.Format = "0S"
.Title = "Humidity"
.TitleFont = New Font(New FontFamily("Arial"), 9, FontStyle.Bold)
.MajorGrid.Interval = 1
.MajorGrid.Enabled = True
.MajorTickMark.Enabled = True
.MajorTickMark.Interval = 1
.MajorTickMark.Size = 2
.LabelStyle.Enabled = True
.LabelStyle.Interval = 10
End With
With Chart1.ChartAreas(0).AxisY
.Maximum = 100
.Minimum = 0
.MajorGrid.Interval = 10
.MajorGrid.Enabled = True
.MajorTickMark.Enabled = True
.MajorTickMark.Interval = 10
.MajorTickMark.Size = 2
.LabelStyle.Enabled = True
.LabelStyle.Interval = 10
End With
Chart1.ChartAreas(0).AxisX.ScrollBar.IsPositionedInside = False
Chart1.ChartAreas(0).AxisX.ScaleView.Zoom(1, 59)
End Sub
Private Sub ButtonClose_Click(sender As Object, e As EventArgs) Handles ButtonClose.Click
Dim frm As New Form1
frm.Show()
Me.Close()
End Sub
'====================================== Connection Panel End ================================================'
End Class
ARDUINO CODE:
#define soilSensor1 A0
#define soilSensor2 A1
#define soilSensor3 A2
#define pump1 2
#define pump2 3
#define pump3 4
const int dry = 541;
const int wet = 290;
const int dry1 = 546;
const int wet1 = 310;
const int dry2 = 541;
const int wet2 = 290;
int percentageHumididy;
int percentageHumididy2;
int percentageHumididy3;
const unsigned long Seconds = 1000;
const unsigned long Minutes = 60 * Seconds;
unsigned long PreviousMillis = 0;
void setup() {
pinMode(pump1, OUTPUT);
pinMode(pump2, OUTPUT);
pinMode(pump3, OUTPUT);
Serial.begin(9600);
}
void loop()
{
int sensorVal1 = analogRead(soilSensor1);
int percentageHumididy = map(sensorVal1, wet, dry, 100, 0)
;Serial.print("Sensor1,");
Serial.println(percentageHumididy);
int sensorVal2 = analogRead(soilSensor2);
int percentageHumididy2 = map(sensorVal2, wet1, dry1, 100, 0)
;Serial.print("Sensor2,");
Serial.println(percentageHumididy2);
int sensorVal3 = analogRead(soilSensor3);
int percentageHumididy3 = map(sensorVal3, wet2, dry2, 100, 0)
;Serial.print("Sensor3,");
Serial.println(percentageHumididy3);
{
if (millis() - PreviousMillis >= 10 * Minutes)
{
PreviousMillis += 10 * Minutes;
if (sensorVal1 > 380 )
{
digitalWrite(pump1, HIGH);
delay(10000);
digitalWrite(pump1, LOW);
}
}
}
{
if (millis() - PreviousMillis >= 10 * Minutes)
{
PreviousMillis += 10 * Minutes;
if (sensorVal2 > 380 )
{
digitalWrite(pump2, HIGH);
delay(10000);
digitalWrite(pump2, LOW);
}
}
}
{
if (millis() - PreviousMillis >= 10 * Minutes)
{
PreviousMillis += 10 * Minutes;
if (sensorVal3 > 380 )
{
digitalWrite(pump3, HIGH);
delay(10000);
digitalWrite(pump3, LOW);
}
}
}
delay(1000);
}