Husinul
Published © GPL3+

Smart Car Parking System

Count cars when they enter and exit in the parking space area, this helps find out available car parking space.

BeginnerShowcase (no instructions)4 hours29,924
Smart Car Parking System

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Jumper wires (generic)
Jumper wires (generic)
×6
RGB Backlight LCD - 16x2
Adafruit RGB Backlight LCD - 16x2
×1
16 MHz Crystal
16 MHz Crystal
×1
Linear Regulator (7805)
Linear Regulator (7805)
×1
Resistor 2.21k ohm
Resistor 2.21k ohm
×1
Capacitor 10 µF
Capacitor 10 µF
×1
Capacitor 22 pF
Capacitor 22 pF
×2
Capacitor 1 µF
Capacitor 1 µF
×1
Li-Ion Battery 1000mAh
Li-Ion Battery 1000mAh
×1
PIR Motion Sensor (generic)
PIR Motion Sensor (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Car Parking counter

Code

Car Parking counter

C/C++
#include <LiquidCrystal.h>
LiquidCrystal lcd (12,11,5,4,3,2);
int IR_1 = 5; //exit
int IR_2 = 4; //enter
int counter=0;
int currentState=0;
int previousState_1=0;
int previousState_2=0;
int IR_1_op;
int IR_2_op;
void setup() {
  // put your setup code here, to run once:
Serial.begin (9600);
pinMode(IR_1,INPUT);
pinMode(IR_2,INPUT);
lcd.begin (16,2);
}

void loop() {
  // put your main code here, to run repeatedly:

lcd.setCursor (0,0);
lcd.print ("NO.OF CARS:");
lcd.setCursor (0,1);
lcd.print ("CAR");
IR_1_op = digitalRead(IR_1);
IR_2_op = digitalRead(IR_2);
Serial.println(digitalRead(IR_2));
if (IR_1_op == HIGH && IR_2_op == LOW)
{
 currentState=1;  
}
else 
{
  currentState=0;
}
if(currentState!=previousState_1)
{
  if(currentState==1)
  {
    counter=counter+1;
    lcd.setCursor(13,0);
    lcd.print(counter);
     lcd.setCursor(4,1);
    lcd.print("ENTER");
  }
}
  previousState_1=currentState;
  delay (250);  
 Serial.println(counter);
if (IR_1_op == LOW && IR_2_op == HIGH)
{
 currentState=1;  
}
else 
{
  currentState=0;
}
if(currentState!=previousState_2)
{
  if(currentState==1)
  {
    counter=counter-1;
    lcd.setCursor(13,0);
    lcd.print(counter);
     lcd.setCursor(4,1);
    lcd.print("LEAVE");
  }
}
  previousState_2=currentState;
  delay (250);  
 Serial.println(counter); 
}  

Credits

Husinul

Husinul

2 projects • 20 followers
an avid lover of technology a diy enthusiastic . an arduino and raspi lover ...love to do cool projects

Comments