Skip to main content

Car Parking System using Arduino

This blog will show you how to design and create a Car Parking System using a Seven Segment display interfaced with Arduino Uno. You just need some components, and I assure you this project is gonna be fun!




Components Needed

  • Bread Board
  • Jumper Wires
  • Resistors (1 ohm)
  • Arduino UNO
  • IR-Sensors (2x)
  • 7-Segment Display (Common-Cathode)

Adding Arduino Library

Proteus doesn't come up with Arduino Libraries. We are using Arduino Uno in this project, so manually installing Arduino libraries in Proteus Professional

You can use the path if it works for you. In my case, it works. 

C:\ProgramData\Labcenter Electronics\Proteus 8 Professional\LIBRARY

If it doesn't work, then you have to follow a few steps. All the required files can be downloaded using the link given at the end of the blog. So don't worry about the files.

First, you have to download the files and paste Arduino Library files into the proteus library folder. Your folder might be installed in the Programs folder by default. But in Proteus 8.9, there is no library folder there. ProgramData folder contains the library folder of Proteus Professional



Hidden ProgramData Folder

That's the folder in which you'll find your proteus library folder. In my case, it's located in /C: Drive.
By Clicking the folder, you'll get into this folder.




That's the folder in which you'll find your proteus library files. Click it.




Now, that's the folder we're looking for. Click this folder.




Now paste your Arduino library files into this folder. Restart your Proteus Professional software, and you are done. Now you'll see these library files in the proteus component section.





Now you can see your Arduino Library. Now you can open your schematic file and double click on your Arduino UNO library, and then locate your hex file given in the provided link folder





Proteus Schematic

This circuit is designed using Proteus Professional 8.9. Lower versions of Proteus Professional can't open the schematic file.


Proteus Schematic

The two logic buttons show the output values of IR-Sensors. At the output, IR-Sensors give 5 Volts or logic 1 when at rest. And when it detects something, it provides the output 0 Volts or logic 0. In this project, we are using 2 IR sensors. The first sensor detects the incoming vehicle and increments the count, and the second sensor detects the outgoing vehicle and decrements the count.

Source Code


#define segdp 2
#define segA 9
#define segB 8
#define segC 7
#define segD 6
#define segE 5
#define segF 4
#define segG 3
int IR1 = 10;
int IR2 = 11;
int i=0;
int COUNT = 0;
int timer = 1000;

void setup()
{
        pinMode (IR1, INPUT);
        pinMode (IR2, INPUT);  
  
    for (int i=2;i<10;i++)
    {
        pinMode(i, OUTPUT);
    }
}

void loop()
{
    digitalWrite(segdp, LOW);
    int statusSensor1 = digitalRead (IR1);
    int statusSensor2 = digitalRead (IR2);
  
    switch(COUNT)
                {
                case 0:
                digitalWrite(segA, HIGH);
                digitalWrite(segB, HIGH);
                digitalWrite(segC, HIGH);
                digitalWrite(segD, HIGH);
                digitalWrite(segE, HIGH);
                digitalWrite(segF, HIGH);
                digitalWrite(segG, LOW);
                break;

                case 1:

                digitalWrite(segA, LOW);
                digitalWrite(segB, HIGH);
                digitalWrite(segC, HIGH);
                digitalWrite(segD, LOW);
                digitalWrite(segE, LOW);
                digitalWrite(segF, LOW);
                digitalWrite(segG, LOW);
                break;

                case 2:

                digitalWrite(segA, HIGH);
                digitalWrite(segB, HIGH);
                digitalWrite(segC, LOW);
                digitalWrite(segD, HIGH);
                digitalWrite(segE, HIGH);
                digitalWrite(segF, LOW);
                digitalWrite(segG, HIGH);
                break;

                case 3:

                digitalWrite(segA, HIGH);
                digitalWrite(segB, HIGH);
                digitalWrite(segC, HIGH);
                digitalWrite(segD, HIGH);
                digitalWrite(segE, LOW);
                digitalWrite(segF, LOW);
                digitalWrite(segG, HIGH);
                break;

                case 4:

                digitalWrite(segA, LOW);
                digitalWrite(segB, HIGH);
                digitalWrite(segC, HIGH);
                digitalWrite(segD, LOW);
                digitalWrite(segE, LOW);
                digitalWrite(segF, HIGH);
                digitalWrite(segG, HIGH);
                break;

                case 5:

                digitalWrite(segA, HIGH);
                digitalWrite(segB, LOW);
                digitalWrite(segC, HIGH);
                digitalWrite(segD, HIGH);
                digitalWrite(segE, LOW);
                digitalWrite(segF, HIGH);
                digitalWrite(segG, HIGH);
                break;

                case 6:

                digitalWrite(segA, HIGH);
                digitalWrite(segB, LOW);
                digitalWrite(segC, HIGH);
                digitalWrite(segD, HIGH);
                digitalWrite(segE, HIGH);
                digitalWrite(segF, HIGH);
                digitalWrite(segG, HIGH);
                break;

                case 7:

                digitalWrite(segA, HIGH);
                digitalWrite(segB, HIGH);
                digitalWrite(segC, HIGH);
                digitalWrite(segD, LOW);
                digitalWrite(segE, LOW);
                digitalWrite(segF, LOW);
                digitalWrite(segG, LOW);
                break;

                case 8:

                digitalWrite(segA, HIGH);
                digitalWrite(segB, HIGH);
                digitalWrite(segC, HIGH);
                digitalWrite(segD, HIGH);
                digitalWrite(segE, HIGH);
                digitalWrite(segF, HIGH);
                digitalWrite(segG, HIGH);
                break;

                case 9:

                digitalWrite(segA, HIGH);
                digitalWrite(segB, HIGH);
                digitalWrite(segC, HIGH);
                digitalWrite(segD, HIGH);
                digitalWrite(segE, LOW);
                digitalWrite(segF, HIGH);
                digitalWrite(segG, HIGH);
                break;
                break;
                }
                
    if(COUNT < 10)
                {
                    if (statusSensor1 == 0 && statusSensor2 == 1)
                    {
                          COUNT++;
                          delay(timer);
                    }                    
                    else if (statusSensor1 == 1 && statusSensor2 == 0)
                    {
                          COUNT--;
                          delay(timer);           
                    }
                    else if (statusSensor1 == 0 && statusSensor2 == 0)
                    {
                          digitalWrite(segdp, HIGH);
                          delay(timer);             
                    }
                    else if (statusSensor1 == 1 && statusSensor2 == 1)
                    {
                          digitalWrite(segdp, HIGH);
                          delay(timer);                   
                    }
                }
    if (COUNT == 10)
                    {
                          COUNT--;
                          delay(1000);
                    }                            
}


Download Files

This link contains Proteus Simulation File, Arduino Uno Code file, Arduino Uno library files, and a code text file.

Comments

Popular posts from this blog

Adding Arduino Library in Proteus 8 or later

Adding Arduino Library in Proteus Proteus  doesn't come up with  Arduino Libraries by default . We are using  Arduino Uno  in this project, and we'll see how to manually install Arduino libraries in  Proteus Professional .  You can use the path if it works for you. In my case, it works.  C:\ProgramData\Labcenter Electronics\Proteus 8 Professional\LIBRARY If it doesn't work, then you have to follow a few steps. All the required files can be downloaded using the link given at the end of the blog. So don't worry about the files. First, you have to download the files and paste  Arduino Library files  into the proteus library folder. Your folder might be installed in the  Programs  folder by default. But in  Proteus 8.9 , there is no library folder there.  ProgramData  folder contains the library folder of  Proteus Professional .  That's the folder in which you'll find your proteus library folder. In my case, it'...

Installing Tensorflow and Open-CV on Raspberry Pi

First, you have to install the latest version of Bull-Eye OS from Raspbian's official site.  (64-bit version) I'm using Raspberry Pi 4B with 4 Gigs of Ram. ------------------------------------------- There are a bunch of ways of installing OpenCV and Tensorflow on Raspberry Pi and I've mentioned the most effective ways which worked for me. ------------------------------------------- On your PC open the following links: tensor flow link: https://github.com/lhelontra/tensorflow-on-arm/releases tensor flow: for 3.9.2 :  https://github.com/PINTO0309/Tensorflow-bin/blob/main/previous_versions/download_tensorflow-2.8.0-cp39-none-linux_aarch64_numpy1221.sh ------------------------------------------- You have to add the following lines to the bash file of the Raspberry Pi: # virtualenv and virtualenvwrapper export WORKON_HOME=$HOME/.virtualenvs export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3 source /usr/local/bin/virtualenvwrapper.sh ------------------------------------------- The...