Arduino Projects

Car Parking Monitoring System using Arduino and vb.net

Car Parking Monitoring System, Project Description:

 

Car Parking Monitoring System using Arduino and vb.net– This tutorial is about the Car parking Slots monitoring system using a computer application designed in Visual Basic .net Which is also known as vb.net.  this project is based on the vb.net, Arduino, and infrared sensors. A total of six IR sensors are used in this car parking project. The car parking area is divided into two parking areas, Parking 1 and Parking 2. Each Parking slot has an infrared sensor, which is used for car detection. Depending on the detection of the car the box next to the slot is checked or unchecked. If the box is checked it means the slot is occupied by a car.

This Tutorial covers

  1. IR Sensors installation
  2. Car Parking System Circuit diagram
  3. IR Sensors Interfacing with Arduino
  4. Car Parking System Arduino programming
  5. Car Parking system Computer Application
  6. application designing and finally
  7. Testing

checkout another version of the same project based on the IoT. In this project, the car slots are monitored using the Cell phone application.


Amazon Links:

Arduino Nano USB-C Type (Recommended)

12v Adaptor:

Obstacle IR Infrared Sensor:

Arduino Uno

*Disclosure: These are affiliate links. As an Amazon Associate I earn from qualifying purchases.

Car Parking Monitoring System Circuit Diagram:

car parking

This is the complete circuit diagram of the car parking monitoring system. The circuit diagram is designed in cadsoft eagle version 9.1.0. These are the six infrared sensors.  Each infrared sensor represents a Slot.

Vcc of all the infrared sensors are connected together and are connected with Arduino’s 5v. Similarly, the ground pins of all the infrared sensors are connected together and are connected with the Arduino’s ground. While the out pins of the infrared sensors are connected with

 pin number 4

pin number 5

pin number 6

pin number 7

pin number 8 and

pin number 9


Car Parking Monitoring System Arduino Programming:

First I started off by defining pins for the infrared sensors. Then I defined 6 variables of the type String with names sensor1 to sensor6. Finally, I defined a variable cdata of the type String for storing the complete message.

activates the serial communication, 9600 is the buad rate.

Using the pinmode function set all infrared sensors as input. Pinmode function is a built in function and it takes two arguments as the input, the pin number or pin name and the status which can be input or output.

For monitoring each infrared sensor individually I created 6 functions. So these are the six calling functions.

Car Parking Monitoring System Computer application:

car parking

This is how the computer application looks like. In this application we are using only one serial port and only one timer. If you double click on the application form you will get access to the programming.

First I started off by importing the system.io and system.io.ports.

Then I defined  one variable of the type integer which is value1.


Double click on the form and add the code for the Serial port. currently the port name is com19 which is as per my laptop. You can check your Arduino’s port number from the device manager. Change com19 to the number as per your laptop or computer.

Defines a variable s of the type string.

the purpose of this line of code is to store the complete message in variable s. this is the message which is received from Arduino.

then these instructions are used to set the delimiter type which is comma in my case, with the help of comma the entire message will be split in six strings, then each string will be displayed in its corresponding text box, Each textbox represents the infrared sensor.

Data received function, I have used this function in so many projects, and I have already explained  this in very detail. the purpose of this function is to read the serial port and store the data in textbox1.


Watch Video Tutorial:

Other Related Project:

IOT based Car Parking System using Arduino and Nodemcu esp8266

Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...

Related Articles

10 Comments

  1. Hi, can i know what is the problem when the program run it only will loop 3 times after that it stop refreshing the sensor? Thank You.

    1. Once i run the vb program, the program will hang after refreshing few time of sensors, can i know what’s the problem? It can’t keep refresh again and again. It will stop and not running anymore. Thank You.

      1. I have to train this project to university. Please help me. I am your strict follower. Look, I’m writing this code:

        int parking1_slot1_ir_s = 4; // parking slot1 infrared sensor connected with pin number 4 of arduino
        int parking1_slot2_ir_s = 5;
        int parking1_slot3_ir_s = 6;

        int parking2_slot1_ir_s = 7;
        int parking2_slot2_ir_s = 8;
        int parking2_slot3_ir_s = 9;

        String sensor1;
        String sensor2;
        String sensor3;
        String sensor4;
        String sensor5;
        String sensor6;

        String cdata =””; // complete data, consisting of sensors values

        void setup()
        {
        Serial.begin(9600);
        pinMode(parking1_slot1_ir_s, INPUT);
        pinMode(parking1_slot2_ir_s, INPUT);
        pinMode(parking1_slot3_ir_s, INPUT);

        pinMode(parking2_slot1_ir_s, INPUT);
        pinMode(parking2_slot2_ir_s, INPUT);
        pinMode(parking2_slot3_ir_s, INPUT);

        }

        void loop()
        {
        p1slot1();
        p1slot2();
        p1slot3();

        p2slot1();
        p2slot2();
        p2slot3();

        cdata = cdata + sensor1 +”,” + sensor2 + “,”+ sensor3 +”,”+ sensor4 + “,” + sensor5 + “,” + sensor6 +”,”; // comma will be used a delimeter
        Serial.println(cdata);
        nodemcu.println(cdata);
        delay(2000); // 2 seconds
        cdata = “”;
        digitalWrite(parking1_slot1_ir_s, HIGH);
        digitalWrite(parking1_slot2_ir_s, HIGH);
        digitalWrite(parking1_slot3_ir_s, HIGH);

        digitalWrite(parking2_slot1_ir_s, HIGH);
        digitalWrite(parking2_slot2_ir_s, HIGH);
        digitalWrite(parking2_slot3_ir_s, HIGH);
        }

        P1slot1 is a user defined function, it has no return type and it doesn not take any argument as the input. if there is a car infront of the sensor it gives digital logic 0, and if no car then it give digital logic 1, depending on this, then we store p1s1on or p1s1off. The same mechanism is used for all the other infrared sensors.

        void p1slot1() // parkng 1 slot1
        {
        if( digitalRead(parking1_slot1_ir_s) == LOW)
        {
        sensor1 = “p1s1on”; // parking1 slot1
        delay(200);
        }
        if( digitalRead(parking1_slot1_ir_s) == HIGH)
        {
        sensor1 = “p1s1off”;
        delay(200);
        }

        }

        void p1slot2() // parking 1 slot2
        {
        if( digitalRead(parking1_slot2_ir_s) == LOW)
        {
        sensor2 = “p1s2on”;
        delay(200);
        }
        if( digitalRead(parking1_slot2_ir_s) == HIGH)
        {
        sensor2 = “p1s2off”;
        delay(200);
        }
        }

        void p1slot3() // parking 1 slot3
        {
        if( digitalRead(parking1_slot3_ir_s) == LOW)
        {
        sensor3 = “p1s3on”;
        delay(200);
        }
        if( digitalRead(parking1_slot3_ir_s) == HIGH)
        {
        sensor3 = “p1s3off”;
        delay(200);
        }
        }

        // now for parking 2

        void p2slot1() // parking 1 slot3
        {
        if( digitalRead(parking2_slot1_ir_s) == LOW)
        {
        sensor4 = “p2s1on”;
        delay(200);
        }
        if( digitalRead(parking2_slot1_ir_s) == HIGH)
        {
        sensor4 = “p2s1off”;
        delay(200);
        }
        }

        void p2slot2() // parking 1 slot3
        {
        if( digitalRead(parking2_slot2_ir_s) == LOW)
        {
        sensor5 = “p2s2on”;
        delay(200);
        }
        if( digitalRead(parking2_slot2_ir_s) == HIGH)
        {
        sensor5 = “p2s2off”;
        delay(200);
        }
        }

        void p2slot3() // parking 1 slot3
        {
        if( digitalRead(parking2_slot3_ir_s) == LOW)
        {
        sensor6 = “p2s3on”;
        delay(200);
        }
        if( digitalRead(parking2_slot3_ir_s) == HIGH)
        {
        sensor6 = “p2s3off”;
        delay(200);
        }
        }

        But I’m getting an error.

  2. bonjour je rencontre un problem au niveau de mon port serie

    Severity Code Description Project File Line Suppression State
    Error BC30451 ‘com5’ is not declared. It may be inaccessible due to its protection level. WindowsApp1 C:\Users\hp\source\repos\WindowsApp1\WindowsApp1\Form1.vb 10 Active

    svp besion d’aide. merci

  3. morning i have a problem witch my serial port. please I neet help

    Severity Code Description Project File Line Suppression State
    Error BC30451 ‘com5’ is not declared. It may be inaccessible due to its protection level. WindowsApp1 C:\Users\hp\source\repos\WindowsApp1\WindowsApp1\Form1.vb 10 Active

    thank’s

Leave a Reply

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

Back to top button