# PLC Program for Car Parking System

This is a PLC Program for a Car Parking System.

Problem Description

A parking plot has total capacity of Cars. Number of empty spots are displayed on the display outside the Parking Plot and which spots are available is to be indicated by LEDs. Implement this in PLC using Ladder Diagram programming language.

Problem Solution
• Counter is used to count the number of empty spots.
• Proximity Sensors or IR Sensors are used to detect the presence of car.
• Here in this system IR Sensor can be well installed to make this system cost efficient since Proximity Sensors are costly than IR Sensors.
• Value of counter is displayed on the display which is mounted outside the parking plot.
• This counter value is converted into decimal.

Display arrangement

PLC Program

Here is PLC program for a Car Parking System, along with program explanation and run time test cases.

```List of Inputs and Outputs
I:1/0 to I:1/4	= IR Sensor to detect the presence of cars (Inputs)
O:2/0 to O:2/4	= LEDs to indicate presence of car spots   (Outputs)
C5:0		= To increment when Car exits		   (Counter Up)
C5:0		= To decrement when Car enters		   (Counter Down)

Ladder Diagram for Car Parking System

Program Description
• Counter Up CTU and Counter Down CTD are used to determine the Exit and Entry of cars respectively.
• Value 5 is already stored in the accumulator since only 5 number of spots are there in this Parking Plot.
• So whenever car enters or exits from the Parking area, the value in the counter is incremented and decremented accordingly.
• Accumulator holds decimal values, this value thus sent to the display through BCD converter which converts Decimal digits into equivalent Binary Coded Decimal signals.
• Display receives whatever the value Accumulator holds, in terms of BCD.
• I:1/5 and I:1/6 are two inputs from other two IR Sensors to detect the exit and entry of cars accordingly.
• Here again, CTU and CTD both have the same address in order to vary accumulator value of both counters according to Exit and Entry of cars.
• XIO (Normally Closed) contact is used here for IR Sensor outputs so that LED is ON when the spot is empty.
Runtime Test Cases

Sanfoundry Global Education & Learning Series – PLC Algorithms.
To practice all PLC programs, here is complete set of 100+ PLC Problems and Solutions.

If you find any mistake above, kindly email to [email protected]