Arduino Automated Parking Garage
A fully automated smart car parking system- powered using just a power bank!!!
Components and supplies
3
Proximity Sensor
1
Servos (Tower Pro MG996R)
1
Arduino UNO
1
LED (generic)
1
UTSOURCE Electronic Parts
Apps and platforms
1
Arduino IDE
Project description
Code
Version2 Code With LCD display
automated parking garage,code.ashrafminhaj
c_cpp
1/*Automated Parking Garage by Ashraf Minhaj. www.youtube.com/c/fusebatti 2 * for any query please mail me at ashraf_minhaj@yahoo.com*/ 3 4#include<Servo.h> //adding Servo library 5Servo gate; //you may open or close gate using a Servo motor 6int slot1 = 5; //Connect IR sensor on digital pin5 for sLOT 1 7int slot2 = 4; //sLot2 pin on digital 4 8int gateSensor = 3; //IR sensor on gate to arduino pin 3 9int slot1_l = 13; 10int slot2_l = 12; 11int gate_grn = 11; 12int gate_red = 10; 13 14 15void setup() 16{ 17 gate.attach(7); //connecting the gate servo on pin 5 18 pinMode(slot1,INPUT); //setting slot pins & gate IR sensor as input to arduino 19 pinMode(slot2,INPUT); 20 pinMode(gateSensor,INPUT); 21 pinMode(slot1_l,OUTPUT); 22 pinMode(slot2_l,OUTPUT); 23 pinMode(gate_grn,OUTPUT); 24 pinMode(gate_red,OUTPUT); 25 Serial.begin(9600); //initialzing Serial monitor 26 27} 28 29void loop() 30{ 31 //the car arrives and sensor goes LOW 32 33 if( !(digitalRead(gateSensor)) && digitalRead(slot1) && digitalRead(slot2)) //slot1 & slot2 empty 34 { 35 Serial.println("Welcome, Available: sLOT1, sLOT2"); //print slot1 and slo2 available 36 digitalWrite(slot1_l,HIGH); 37 digitalWrite(slot2_l,HIGH); 38 delay(1000); 39 digitalWrite(gate_grn,HIGH); 40 gate.write(75); //gate will open after the dealy of 1 second 41 } 42 43 if( !(digitalRead(gateSensor)) && !(digitalRead(slot1)) && digitalRead(slot2)) //car on slot1,slot2 free 44 { 45 Serial.println("Welcome, Available: sLOT2"); // slo2 available 46 digitalWrite(slot1_l,LOW); 47 digitalWrite(slot2_l,HIGH); 48 delay(1000); 49 digitalWrite(gate_grn,HIGH); 50 gate.write(75); //gate will open after the dealy of 1 second 51 } 52 53 if( !(digitalRead(gateSensor)) && digitalRead(slot1) && !(digitalRead(slot2))) //car on slot2,slot1 free 54 { 55 Serial.println("Welcome, Available: sLOT1"); // slo1 available 56 digitalWrite(slot1_l,HIGH); 57 digitalWrite(slot2_l,LOW); 58 delay(1000); 59 digitalWrite(gate_grn,HIGH); 60 gate.write(75); 61 delay(100); //gate will open after the dealy of 1 second 62 } 63 64 65 if( !(digitalRead(gateSensor)) && !(digitalRead(slot1)) && !(digitalRead(slot2))) 66 { 67 Serial.println("Welcome, Parking Full");// No slot available 68 digitalWrite(slot1_l,LOW); 69 digitalWrite(slot2_l,LOW); 70 delay(1000); 71 digitalWrite(gate_red,HIGH); 72 delay(100); 73 digitalWrite(gate_red,LOW); 74 delay(100); 75 digitalWrite(gate_red,HIGH); 76 delay(100); 77 digitalWrite(gate_red,LOW); 78 79 80 } 81 82 if( digitalRead(gateSensor)) // no input detected 83 { Serial.println("Welcome"); 84 gate.write(5); //gate close 85 digitalWrite(slot1_l,LOW); 86 digitalWrite(slot2_l,LOW); 87 digitalWrite(gate_red,LOW); 88 digitalWrite(gate_grn,HIGH); //gate grin or yellow light will blink 89 delay(100); 90 digitalWrite(gate_grn,LOW); 91 delay(100); 92 93 94 } 95 96}
Version2 Code With LCD display
automated parking garage,code.ashrafminhaj
automated parking garage,code.ashrafminhaj
c_cpp
1/*Automated Parking Garage by Ashraf Minhaj. www.youtube.com/c/fusebatti 2 * for any query please mail me at ashraf_minhaj@yahoo.com*/ 3 4#include<Servo.h> //adding Servo library 5Servo gate; //you may open or close gate using a Servo motor 6int slot1 = 5; //Connect IR sensor on digital pin5 for sLOT 1 7int slot2 = 4; //sLot2 pin on digital 4 8int gateSensor = 3; //IR sensor on gate to arduino pin 3 9int slot1_l = 13; 10int slot2_l = 12; 11int gate_grn = 11; 12int gate_red = 10; 13 14 15void setup() 16{ 17 gate.attach(7); //connecting the gate servo on pin 5 18 pinMode(slot1,INPUT); //setting slot pins & gate IR sensor as input to arduino 19 pinMode(slot2,INPUT); 20 pinMode(gateSensor,INPUT); 21 pinMode(slot1_l,OUTPUT); 22 pinMode(slot2_l,OUTPUT); 23 pinMode(gate_grn,OUTPUT); 24 pinMode(gate_red,OUTPUT); 25 Serial.begin(9600); //initialzing Serial monitor 26 27} 28 29void loop() 30{ 31 //the car arrives and sensor goes LOW 32 33 if( !(digitalRead(gateSensor)) && digitalRead(slot1) && digitalRead(slot2)) //slot1 & slot2 empty 34 { 35 Serial.println("Welcome, Available: sLOT1, sLOT2"); //print slot1 and slo2 available 36 digitalWrite(slot1_l,HIGH); 37 digitalWrite(slot2_l,HIGH); 38 delay(1000); 39 digitalWrite(gate_grn,HIGH); 40 gate.write(75); //gate will open after the dealy of 1 second 41 } 42 43 if( !(digitalRead(gateSensor)) && !(digitalRead(slot1)) && digitalRead(slot2)) //car on slot1,slot2 free 44 { 45 Serial.println("Welcome, Available: sLOT2"); // slo2 available 46 digitalWrite(slot1_l,LOW); 47 digitalWrite(slot2_l,HIGH); 48 delay(1000); 49 digitalWrite(gate_grn,HIGH); 50 gate.write(75); //gate will open after the dealy of 1 second 51 } 52 53 if( !(digitalRead(gateSensor)) && digitalRead(slot1) && !(digitalRead(slot2))) //car on slot2,slot1 free 54 { 55 Serial.println("Welcome, Available: sLOT1"); // slo1 available 56 digitalWrite(slot1_l,HIGH); 57 digitalWrite(slot2_l,LOW); 58 delay(1000); 59 digitalWrite(gate_grn,HIGH); 60 gate.write(75); 61 delay(100); //gate will open after the dealy of 1 second 62 } 63 64 65 if( !(digitalRead(gateSensor)) && !(digitalRead(slot1)) && !(digitalRead(slot2))) 66 { 67 Serial.println("Welcome, Parking Full");// No slot available 68 digitalWrite(slot1_l,LOW); 69 digitalWrite(slot2_l,LOW); 70 delay(1000); 71 digitalWrite(gate_red,HIGH); 72 delay(100); 73 digitalWrite(gate_red,LOW); 74 delay(100); 75 digitalWrite(gate_red,HIGH); 76 delay(100); 77 digitalWrite(gate_red,LOW); 78 79 80 } 81 82 if( digitalRead(gateSensor)) // no input detected 83 { Serial.println("Welcome"); 84 gate.write(5); //gate close 85 digitalWrite(slot1_l,LOW); 86 digitalWrite(slot2_l,LOW); 87 digitalWrite(gate_red,LOW); 88 digitalWrite(gate_grn,HIGH); //gate grin or yellow light will blink 89 delay(100); 90 digitalWrite(gate_grn,LOW); 91 delay(100); 92 93 94 } 95 96}
Downloadable files
automated parking garage
automated parking garage
automated parking garage
automated parking garage
Comments
Only logged in users can leave comments