IOT Based Smart Parking System with Firebase Realtime Database

IOT Based Smart Parking System with Firebase Realtime Database It is smart Parking system in which I Have used IR sensor (Infrared obstacle detection) to detect the incoming or outgoing cars in parking areas   so, car owners are facing problems while searching parking in High Traffic Areas.

In This Project I used IR Sensors to detect incoming or outgoing cars in Parking as well as Servo motor is used to Open and Close the gate When any care come in or goes out of parking IR Sensor detect it and increase available slots by +1 or decrease available slots by -1. 16x2 LCD is used to display total Slots and Available slots. To make Anyone can check the available slots Far Away from a Parking Area I used Nodemcu ESP8266 to Upload Available Slots Data to Firebase Realtime Database and I make an android Application Which will Retrieve data from Firebase Realtime Database.

Hardware Required :

Software Required :


Arduino Library's Used :  

  • Servo
  • LiquidCrystal
  • SoftwareSerial
  • Firebase Arduino
  •  ESP8266WiFi


Download Library's & Android app AIA file : Google Drive

Note : Update Your Nodemcu and Arduino Board In Arduino IDE if not or it will Make Error While Compiling.

Also Read :

Circuit Diagram :

Important Points :
Creating Firebase Database :

  • Go to Firebase console.
  • Click on Add Project and Give Name to Your Project and Click on Continue Create Project.
  • Go to Realtime Database and Click on Create Database in test mode.
  • Click on add Child on Realtime database and create database.
Firebase database url

Modify Android App AIA File :

  • Open website Create or Login with your account.
  • Click on Import Project.
  • Download AIA file given in above Google Drive link and open SmartParking.aia File and click Import.
  • Find all Component Click firebase_Database.
  • Firebase Database change Firebase Token, Firebase URL and Project bucket.
  • Go to Blocks And Change "Available Slots" to your tag name which data you want to Get.(note : This tag is indie project bucket which we created earlier firebase.)
  • Export Project as Android Apk.

SoftwareSerial Library Issue with Servo motor :

  • Supported Baud rate for SoftwareSerial Library is 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 31250, 38400, 57600, and 115200.
  • While using Baud rate of 9600 or less than 9600 Servo motor will jitter in ideal Condition.
  • To Avoid this Baud rate for Serial Communication Used must be Above 9600.
  • I am Using 115200 Baud rate it Works just fine.
  • Alternative Solution For This is we can also use I2C and SPI Communication Protocols.

Firebase Arduino Library mandatory edit :

  • Go to your Arduino IDE installation Folder and find Firebase arduino library and open src folder.
C:\Program Files (x86)\Arduino\libraries\firebase-arduino-master\src

  • Open Your Firebase Console go to your Project Realtime Database.
Firebase database

  • Copy Link of Firebase Database.
Firebase database link

GRC Fingerprint

  • You will get latest fingerprint In table Below "Security Certificate's Authentic Fingerprint" Copy that String.
Custom Site Fingerprinting

  • Edit FirebaseHttpClient.h in Notepad.
  • Search in Notepad for "static const char kFirebaseFingerprint[] =".
Edit Fingerprint

  • Change Fingerprint and Save the File.

Also Read :

Programming :

Nodemcu Code

#include <ESP8266WiFi.h>
#include <FirebaseArduino.h>
#include <SoftwareSerial.h>

SoftwareSerial s(D6,D5);

#define FIREBASE_HOST ""                     //Your Firebase Project URL goes here without "http:" , "\" and "/"
#define FIREBASE_AUTH "GjWwc5ImRtmh48Fc0vqBiewSkn63kBSArG56Q1Bn"                      //Your Firebase Database Secret goes here

#define WIFI_SSID "DIGISOL"                                               //WiFi SSID to which you want NodeMCU to connect
#define WIFI_PASSWORD "mastidahi"                                      //Password of your wifi network 

int8_t indexOfA;
char c;
String Space; 
String dataIn;

int firebaseSpace;

int val=0;

void setup() {


  Serial.println("Serial communication started\n\n"); 
  WiFi.begin(WIFI_SSID, WIFI_PASSWORD);                                     //try to connect with wifi
  Serial.print("Connecting to ");

  while (WiFi.status() != WL_CONNECTED) {

  Serial.print("Connected to ");
  Serial.print("IP Address is : ");
  Serial.println(WiFi.localIP());                                            //print local IP address
  Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);   // connect to firebase

void loop() { 
      c =;

      if(c=='/n') {break;}
      else        {dataIn+=c;}
    indexOfA = dataIn.indexOf("A");

    Space = dataIn.substring(0, indexOfA);

    Serial.println("Available Space is = " + Space);


  firebaseSpace = Space.toInt();
  Serial.println("firebaseSpace = " + firebaseSpace);

// Firebase Error Handling ************************************************
  if (Firebase.failed())
  { delay(500);
  Serial.println("Connection to firebase failed. Reconnecting...");
 else { 
    Serial.println("Everything is ready!");
    delay(300); Serial.println("Everything is ready!");
    delay(300); Serial.println("Everything is ready! \n \n \n");

    delay(1000); Serial.println("uploaded data to firebase \n \n \n");

    Firebase.setInt("/mobile/Available Slots", firebaseSpace);
    delay(1000); Serial.println("uploaded Available Slots to firebase \n \n \n");

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin LED_BUILTIN as an output.

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second

Arduino Code

#include <Servo.h> 
#include <LiquidCrystal.h>
#include <SoftwareSerial.h>

SoftwareSerial s(11, 12);//rx,tx
LiquidCrystal lcd(2, 3, 4, 5, 6, 7); //(rs,e,d4,d5,d6,d7)

int Space2;
Servo myservo1;
int ir_s1 = 8;
int ir_s2 = 9;
boolean execute = false;
int Total = 5;
boolean execute2 = false;

void setup() {
  // put your setup code here, to run once:
  pinMode(13, OUTPUT);
  pinMode(ir_s1, INPUT);
  pinMode(ir_s2, INPUT);

  Serial.begin(57600);// for Serial Monitor
  s.begin(115200);//for Seial Communication

  myservo1.attach(10); //Servo Attached to digital pin no 10

  lcd.begin(16, 2);  
  lcd.setCursor (0,0);
  lcd.print("  Car  Parking  ");
  lcd.setCursor (0,1);
  lcd.print("     System     ");
  delay (2000);

  Space2 = Total;

void loop() {
//Logic Behind free slots update
 if(digitalRead (ir_s1) == LOW && execute2 == true){
  if(digitalRead (ir_s1) == HIGH && digitalRead (ir_s2) == LOW){
    if(execute2 == false && Space2>0){
      Space2 = Space2-1;

 if(Space2==0 && digitalRead (ir_s1) == HIGH ){
        lcd.setCursor (0,0);
        lcd.print(" Sorry not Space ");  
        lcd.setCursor (0,1);
        lcd.print("    Available    "); 
        delay (1000);

  if(digitalRead (ir_s1) == LOW && digitalRead (ir_s2) == HIGH){
   if(digitalRead (ir_s2) == HIGH && execute == false && Space2<5){
    Space2 = Space2+1;

   if(digitalRead (ir_s2) == LOW && execute == true){

lcd.setCursor (0,0);
lcd.print("Total Space: ");

lcd.setCursor (0,1);
lcd.print("Free Space: ");

s.print(Space2); s.print("A"); //Sending Free slot Data to nodemcu with IndexofA
Serial.print(Space2); Serial.print("A");//print it on serial moniter


In this Article We Learn how to Make IOT Based Smart Parking System, How to implement firebase with Nodemcu ESP8266, Retrieve Data from Firebase Realtime Database to Android Application , Communication Arduino To Nodemcu Using I2C, Servo And IR Sensor Programming And LCD 16x2 Interfacing This all Steps Are Taken To Make This Project.


  1. Schöne Informationen, wertvolles und exzellentes Design, gute Dinge mit guten Ideen und Konzepten teilen, viele großartige Informationen und Inspirationen, die ich beide brauche, dank der Bereitstellung solch hilfreicher Informationen hier. Elektronische Parkscheibe


Post a Comment

Previous Post Next Post