Project in progress
Smart Car Parking System

Smart Car Parking System

A 63x53cm homemade smart parking lot.

  • 825 views
  • 0 comments
  • 4 respects

Components and supplies

Apps and online services

Ide web
Arduino IDE
fritzing

About this project

This is a homemade high school project of a fully-functional architectural model of a smart parking system/lot.

Contains fully automatic barriers, LED indication of parking lot occupance (RED-occupied, GREEN-free), LCD display at the entrance. Parking lot sensors are pointing straight down from the roof.

Stuff painted dark-gray is steel, everything else is wooden.

Project contains approx. 30 metres of wire.

Total current draw is 220mA (a lot less than theoretical expectation), without servos - those are supplied by 4x1, 5V batteries.


Code

parking.inoC/C++
//kniznice
#include <DS3231.h>
#include <VarSpeedServo.h>
#include <LiquidCrystal.h>


//lcd
LiquidCrystal lcd(3,2,8,9,10,11);

byte a[8] = {
  B10000,
  B10011,
  B10111,
  B11111,
  B11111,
  B10111,
  B10011,
  B10000
};

byte b[8] = {
  B10000,
  B10000,
  B10000,
  B10000,
  B10000,
  B10000,
  B10000,
  B10000
};

byte c[8] = {
  B00001,
  B00001,
  B00001,
  B00001,
  B00001,
  B00001,
  B00001,
  B00001
};

byte d[8] = {
  B00000,
  B00011,
  B00111,
  B01111,
  B01111,
  B00111,
  B00011,
  B00000
};

byte e[8] = {
  B00000,
  B00000,
  B10000,
  B11000,
  B11000,
  B10000,
  B00000,
  B00000
};

byte ciara[8] = {
  B00100,
  B00100,
  B00100,
  B00100,
  B00100,
  B00100,
  B00100,
  B00100
};

byte volne[8] = {
  B11111,
  B00000,
  B00000,
  B00000,
  B00000,
  B00000,
  B00000,
  B11111
};

byte plne[8] = {
  B11111,
  B00000,
  B11111,
  B11111,
  B11111,
  B11111,
  B00000,
  B11111
};


//rtc
DS3231 rtc (SDA, SCL);
Time t;
const int OnM = 0; //minta zapnutia osvetlenia
const int OnH = 17; //hodina zapnutia osvetlenia
const int OffM = 0; //minta vypnutia osvetlenia
const int OffH = 8; //hodina vypnutia osvetlenia
const int osvetlenie1 = 38; //prv ledka osvetlenia; svietia vetky naraz
const int osvetlenie2 = 39; //druh ledka osvetlenia; svietia vetky naraz
const int osvetlenie3 = 40;  //tretia ledka osvetlenia; svietia vetky naraz


//motorceky
VarSpeedServo motorcekVchod;
VarSpeedServo motorcekVychod;



//snimace ramp
const int snimacVchod = 53;
const int snimacVychod = 52;

//snimace miest
const int snimac1 = 51;
const int snimac2 = 50;
const int snimac3 = 49;
const int snimac4 = 48;
const int snimac5 = 47;
const int snimac6 = 46;
const int snimac7 = 45;
const int snimac8 = 44;

//ledky miest
const int led1z = 37;
const int led1c = 36;
const int led2z = 35;
const int led2c = 34;
const int led3z = 33;
const int led3c = 32;
const int led4z = 31;
const int led4c = 30;
const int led5z = 29;
const int led5c = 28;
const int led6z = 27;
const int led6c = 26;
const int led7z = 25;
const int led7c = 24;
const int led8z = 23;
const int led8c = 22;

void setup() {
//lcd
lcd.begin(16,4);
lcd.createChar(0, a);
  lcd.createChar(1, b);
  lcd.createChar(2, c);
  lcd.createChar(3, d);
  lcd.createChar(4, e);
   lcd.createChar(5, ciara);
   lcd.createChar(6, volne);
   lcd.createChar(7, plne);


//rtc
rtc.begin();
digitalWrite(osvetlenie1,LOW);
digitalWrite(osvetlenie2,LOW);
digitalWrite(osvetlenie3,LOW);
//nastavenie asu rtc, po nastaven zakomentova
//rtc.setDOW(TUESDAY);
//rtc.setTime(16,54,0);
//rtc.setDate(29,10,2019);
  
  //zadavanie pinMode
pinMode(snimacVchod, INPUT);
pinMode(snimacVychod, INPUT);
pinMode(snimac1, INPUT);
pinMode(snimac2, INPUT);
pinMode(snimac3, INPUT);
pinMode(snimac4, INPUT);
pinMode(snimac5, INPUT);
pinMode(snimac6, INPUT);
pinMode(snimac7, INPUT);
pinMode(snimac8, INPUT);
pinMode(led1z, OUTPUT);
pinMode(led1c, OUTPUT);
pinMode(led2z, OUTPUT);
pinMode(led2c, OUTPUT);
pinMode(led3z, OUTPUT);
pinMode(led3c, OUTPUT);
pinMode(led4z, OUTPUT);
pinMode(led4c, OUTPUT);
pinMode(led5z, OUTPUT);
pinMode(led5c, OUTPUT);
pinMode(led6z, OUTPUT);
pinMode(led6c, OUTPUT);
pinMode(led7z, OUTPUT);
pinMode(led7c, OUTPUT);
pinMode(led8z, OUTPUT);
pinMode(led8c, OUTPUT);
pinMode(osvetlenie1, OUTPUT);
pinMode(osvetlenie2, OUTPUT);
pinMode(osvetlenie3, OUTPUT);
motorcekVchod.attach(12);
motorcekVychod.attach(13);
}

void loop() {
  

      if(digitalRead(snimac1) == HIGH)            //zaiatok ledky miest
          {
             digitalWrite(led1z,HIGH);
             digitalWrite(led1c,LOW);
           }

      else if(digitalRead(snimac1) == LOW)
          {
             digitalWrite(led1z,LOW);
             digitalWrite(led1c,HIGH);
           }

      if(digitalRead(snimac2) == HIGH)
          {
             digitalWrite(led2z,HIGH);
             digitalWrite(led2c,LOW);
           }

      else if(digitalRead(snimac2) == LOW)
          {
             digitalWrite(led2z,LOW);
             digitalWrite(led2c,HIGH);
           }

      if(digitalRead(snimac3) == HIGH)
          {
             digitalWrite(led3z,HIGH);
             digitalWrite(led3c,LOW);
           }

      else if(digitalRead(snimac3) == LOW)
          {
             digitalWrite(led3z,LOW);
             digitalWrite(led3c,HIGH);
           }

      if(digitalRead(snimac4) == HIGH)
          {
             digitalWrite(led4z,HIGH);
             digitalWrite(led4c,LOW);
           }

      else if(digitalRead(snimac4) == LOW)
          {
             digitalWrite(led4z,LOW);
             digitalWrite(led4c,HIGH);
           }

      if(digitalRead(snimac5) == HIGH)
          {
             digitalWrite(led5z,HIGH);
             digitalWrite(led5c,LOW);
           }

      else if(digitalRead(snimac5) == LOW)
          {
             digitalWrite(led5z,LOW);
             digitalWrite(led5c,HIGH);
           }

      if(digitalRead(snimac6) == HIGH)
          {
             digitalWrite(led6z,HIGH);
             digitalWrite(led6c,LOW);
           }

      else if(digitalRead(snimac6) == LOW)
          {
             digitalWrite(led6z,LOW);
             digitalWrite(led6c,HIGH);
           }

      if(digitalRead(snimac7) == HIGH)
          {
             digitalWrite(led7z,HIGH);
             digitalWrite(led7c,LOW);
           }

      else if(digitalRead(snimac7) == LOW)
          {
             digitalWrite(led7z,LOW);
             digitalWrite(led7c,HIGH);
           }

      if(digitalRead(snimac8) == HIGH)
          {
             digitalWrite(led8z,HIGH);
             digitalWrite(led8c,LOW);
           }

      else if(digitalRead(snimac8) == LOW)
          {
             digitalWrite(led8z,LOW);
             digitalWrite(led8c,HIGH);
           }                                          //koniec ledky miest


if (digitalRead(snimacVchod) == LOW)                  //zaiatok motorcekVchod
{ 
    motorcekVchod.write(10,45,false);
    
  }
  else
  {   
    motorcekVchod.write(95,20,false);
  }                                               //koniec motorcekVchod

if (digitalRead(snimacVychod) == LOW)                  //zaiatok motorcekVychod
{ 
    motorcekVychod.write(0,45,false);
    
  }
  else
  {   
    motorcekVychod.write(175,20,false);
  }                                               //koniec motorcekVychod



  //zaiatok rtc
 t = rtc.getTime();
 
if(t.hour==OnH && t.min==OnM)
{
  digitalWrite(osvetlenie1,HIGH);
  digitalWrite(osvetlenie2,HIGH);
  digitalWrite(osvetlenie3,HIGH);
}

else if(t.hour==OffH && t.min==OffM)
{
  digitalWrite(osvetlenie1,LOW);
  digitalWrite(osvetlenie2,LOW);
  digitalWrite(osvetlenie3,LOW);
  
}

//koniec rtc


//zaiatok lcd

 if ( millis()<4800)
{
  lcd.setCursor(0,0);
 lcd.print("Smart");

 lcd.setCursor(0,1);
 lcd.print("Car");

 lcd.setCursor(0,2);
 lcd.print("Parking");

 lcd.setCursor(0,3);
 lcd.print("System");
  }
  
if (millis()>5000 && millis()<5800)
{lcd.clear();
}






if (millis()>6300)
{


  lcd.setCursor(14,0);
  lcd.write(5);

  lcd.setCursor(14,1);
  lcd.write(5);

  lcd.setCursor(14,2);
  lcd.write(5);

  lcd.setCursor(14,3);
  lcd.write(5);

if(digitalRead(snimac1)==HIGH)
{
lcd.setCursor(13,0);
lcd.write(6);
}

if(digitalRead(snimac2)==HIGH)
{
lcd.setCursor(13,1);
lcd.write(6);
}

if(digitalRead(snimac3)==HIGH)
{
lcd.setCursor(13,3);
lcd.write(6);
}

if(digitalRead(snimac4)==HIGH)
{
lcd.setCursor(13,2);
lcd.write(6);
}

if(digitalRead(snimac5)==HIGH)
{
lcd.setCursor(15,1);
lcd.write(6);
}

if(digitalRead(snimac6)==HIGH)
{
lcd.setCursor(15,0);
lcd.write(6);
}

if(digitalRead(snimac7)==HIGH)
{
lcd.setCursor(15,2);
lcd.write(6);
}

if(digitalRead(snimac8)==HIGH)
{
lcd.setCursor(15,3);
lcd.write(6);
}

int celkoveB=4;
int volneB=4;

if(digitalRead(snimac1)==LOW)
{  lcd.setCursor(13,0);
lcd.write(7);
  if( volneB !=0)
  {
    volneB=volneB-1;
  }
}

if(digitalRead(snimac2)==LOW)
{lcd.setCursor(13,1);
lcd.write(7);
  if( volneB !=0)
  {
    volneB=volneB-1;
  }
}

if(digitalRead(snimac3)==LOW)
{lcd.setCursor(13,3);
lcd.write(7);
  if( volneB !=0)
  {
    volneB=volneB-1;
  }
}

if(digitalRead(snimac4)==LOW)
{lcd.setCursor(13,2);
lcd.write(7);
  if( volneB !=0)
  {
    volneB=volneB-1;
  }
}

int celkoveA=4;
int volneA=4;

if(digitalRead(snimac5)==LOW)
{lcd.setCursor(15,1);
lcd.write(7);
  if( volneA !=0)
  {
    volneA=volneA-1;
  }
}

if(digitalRead(snimac6)==LOW)
{lcd.setCursor(15,0);
lcd.write(7);
  if( volneA !=0)
  {
    volneA=volneA-1;
  }
}

if(digitalRead(snimac7)==LOW)
{lcd.setCursor(15,2);
lcd.write(7);
  if( volneA !=0)
  {
    volneA=volneA-1;
  }
}

if(digitalRead(snimac8)==LOW)
{lcd.setCursor(15,3);
lcd.write(7);
  if( volneA !=0)
  {
    volneA=volneA-1;
  }
}


 
lcd.setCursor(0,0);
lcd.print("Volne miesta");

lcd.setCursor(0,1);
lcd.print("Blok A:");
lcd.setCursor(10,1);
lcd.print(volneA);

lcd.setCursor(0,2);
lcd.print("Blok B:");
lcd.setCursor(10,2);
lcd.print(volneB);

 
  //lcd.setCursor(0,3);
 // lcd.println(rtc.getTimeStr());


  }










}

Schematics

parking
schema_IuCdeB7UcX.fzz

Comments

Similar projects you might like

Smart Parking System

Project tutorial by Husinul

  • 16,277 views
  • 17 comments
  • 36 respects

Smart Parking System

Project in progress by Md. Khairul Alam

  • 60,281 views
  • 36 comments
  • 130 respects

Arduino Controlled Smart Hydroponic Modular System

Project in progress by Luis Antonio Martin Nuez

  • 21,797 views
  • 6 comments
  • 107 respects

Smart Garbage Monitoring System Using Arduino 101

Project tutorial by Technovation

  • 38,881 views
  • 14 comments
  • 58 respects

Smart Monitoring System for Football Players

Project tutorial by Team Doppelgangers

  • 5,369 views
  • 2 comments
  • 12 respects

Smart Parking

Project showcase by Kaustubh Agarwal

  • 39,382 views
  • 15 comments
  • 47 respects
Add projectSign up / Login