# Smart Garage Utilizing Internet of Things (IoT)

Authors: Mohamed A. Torad; Belgacem Bouallegue; Mahmoud M. Khattab; Abdelmoty M. Ahmed
Journal: Journal of Sensors
 (2022)

---

## Abstract

People in urban regions face a daily problem finding parking slot for their vehicles. So, this study develops a network architecture based on Internet of Things platform. A system improves the efficiency of the current cloud-based smart-parking system. This study suggested a system that assists users in automatically finding a free parking space at the lowest cost. With an application, a user can request to reserve a parking slot. The application moves a driver directly into the free slot in a garage. Also, it utilizes the distance and total number of free spaces in each garage to determine the user nearest parking slot and cost. The garage slot cost will be charged by user credit once the user entered the garage or reserved a parking slot through the application. The system proposed a novel system which picks up a parking slot, reserves, and pays for it through mobile application. The proposed system can easily be deployed in the actual world.


---

## Body

## 1. Introduction

An intelligent parking system was developed as part of the development of traffic management systems to lower the expense of hiring personnel and to allow car-park owners to make the most use of their resources. Currently, the most popular technique of locating a parking space is manual, in which the motorist relies on luck and skill to find a spot in the street. This process takes time and effort, and if the motorist is driving in a city with a high car density, it may result in the worst-case scenario of being unable to find a parking space. Finding a predesignated high-capacity car park is an alternative. However, this is not the best option because the car park may be a long distance from the user’s destination. In recent years, research has focused on vehicle-to-vehicle [1] and vehicle-to-infrastructure [2] interaction using a variety of wireless network technologies including radio frequency identification (RFID), Zigbee, and the wireless mess network [3], as well as the Internet. The goal of this study was to give drivers information about nearby parking spots and to allow them to make a reservation a minute ahead of time using approved devices such as cellphones and tablet PCs. Furthermore, when renting a parking space, the services use the RFID of each vehicle. The existing intelligent parking system, on the other hand, does not give an overall ideal solution for finding a suitable parking spot, does not handle the problem of load balancing, does not provide economic advantage, and does not provide for vehicle-refusal service.Smart parking is a method of using information and communication technology to assist drivers in finding more efficiently satisfying parking spaces, particularly in Western countries. Big American cities like San Francisco and Los Angeles have 75.5 percent [4] and 63 percent [5] of all parking spots on the street, while European cities have an average of 37 percent [6], Beijing [7] only has 5%, and Tokyo has limited on-street parking.The IoT technology has generated a revolution in many spheres of life, including smart-parking system (SPS) technology [8]; SPS acquired more interest recently, due to time and fuel consumption finding park slot. These time and fuel translated into crowd and time delay; fuel consumption increased; and global warming increased. To address the issues that arise because of this, as well as to take advantage of significant technical breakthroughs, researchers proposed many solutions utilizing different microcontrollers and many sensors (e.g., RFID reader) per parking slot. These researches will discuss later in this section, showing its pros and cons. The goal of this research is to propose and create a novel cloud-based SPS solution that is based on the Internet of Things. There is no need to search for empty places in the proposed system. A system user can reserve a garage slot remotely (e.g., home, work, or street). The system user (i.e., driver) keeps the parking slot as his wall at pay per hour online. Each car parking slot is built as an IoT network element in this system, and data such as vehicle GPS location, distance between car parking areas, and number of free slots in car parking areas is transferred to the data center.The data center acts as a cloud server for calculating the expenses of a parking request, and these charges are updated on a regular basis and are available to vehicles in the network at any time.The SPS is based on various cutting-edge technologies and can monitor and manage parking slots automatically. Furthermore, each vehicle park in the proposed system can operate independently as a regular car park. To verify the feasibility of the proposed system, this research also implements a system prototype with wireless access in an open-source physical computing platform based on Arduino with RFID technology using a smartphone that provides communication and user interface for both the control system and the vehicles.Mackey et al. [9] proposed a parking system based on Bluetooth low-energy (BLE) beacons, as well as a filtering method to improve accuracy. By using Bluetooth low energy (BLE) to link to cellphones, the parking system may be created and deployed with a unique BLE for each park space. But it needs a continuous Bluetooth connectivity between mobile and beacon for system update, and the system works only for registered BLE beacons.Dixit et al. in [10] employ ultrasonic sensors and a CCTV camera. The sensors were connected to NodeMCU (microcontroller unit) and the Android app, which displays live information about the situation from each parking area so that the client may choose a parking spot for free automobiles. The issue with this paper is that the CCTV cameras do not provide reliable results in dark or cloudy conditions, and the parking spaces cannot be reserved through the application and may be taken by another customer. Thanh and colleagues in [11] suggested a smart parking system based on IoT technology for reserving a parking space using an RFID tag, using strategies based on a unique RFID tag for each automobile. The SPS assumes that each park spot has a single ramp, which is not a cost-effective option. The authors of another study in [12] presented an SPS based on RFID, UHF frequency, and IEEE 802.15.4 Zigbee wireless sensor network (WSN) technology. Using the author application, this system may collect data on the availability and absence of car parks in order to direct the automobile driver to the nearest empty parking spot. However, the suggested architecture was for a small-scale parking system that was both expensive and inconvenient. Mukadam and Logeswaran in [13] utilize the Arduino UNO, NodeMCU, Raspberry Pi 3, and Raspberry Pi. Additionally, an Android application was created for customers using MIT app inventor 2 to assist them with bookings, modifying, and examining the status of car parks. The issue with this study is that it uses a Raspberry Pi device, which raises the cost owing to the need for a keyboard, mouse, and screen. Ajchariyavanich et al. employed a servomotor as a parking flap in [14], using it to open and close with the arrival and departure of the user who reserves a parking spot, and they used ultrasonic sensor, NodeMCU, and QR code to do so. The issue in this study is that they are using a parking flap for every parking spot, which is unworkable and will be too expensive, necessitating the creation of a new database for cars based on QR codes. Hamzah et al. in [15] designed and implemented a WSN/IoT smart parking management system employing a PIR to sense the object’s motion and three Arduino nanocoupled to an NRF24L01 module to communicate data to Arduino Mega. The issue with this paper is that they employed a PIR sensor to detect an empty space, yet this sensor does not measure temperatures beyond 35 degrees. Rovella et al. invented a parking system in [16] that allows a driver to search for and obtain information about parking places, and when a person approaches a parking space, the RFID will scan it. The gate will open if the data on the RFID card is correct. The issue with this study is that they employ a single gate and RFID for each parking space, which is a costly and inefficient method. A new proposed system based on IoT was introduced with the goal of eliminating the drawbacks of the systems outlined above and inspired by [9] till [16], a system that ensures seamless car mobility at a minimal cost while also boosting the chances of finding a free parking spot.By introducing four contributions, this work overcomes the drawbacks of the systems outlined above as mentioned in Table1. Some studies employ CCTV, PIRs, and IR to detect motion; however, CCTV cameras do not accurately collect results in dark periods or foggy atmospheres, and the problem with the IR sensor is that it does not measure long distances or dark objects, and it does not measure temperatures beyond 35 C. The most ideal sensor for unoccupied parking slots, according to the paper discussed earlier, is an ultrasonic sensor. It has the advantages of not being affected by object color, working well in dark environments, consuming less current/power, and operating in temperatures up to 70°C, the first contribution in terms of data integrity, where some applications did not attach user information and instead made the app just show data, allowing open parking spaces to be grabbed by another individual. In contrast to the previous application, this problem was solved by tying user information to a cloud database, and when a user books an available spot, the reserved spot cannot be taken by another user, where count was decremented by one slot reserved by application. The paper’s second contribution was cost reduction. In terms of cost, some publications employed an expensive and inefficient approach which equipped every parking slot RFID gate or QR code gate. On the other hand, our approach needs only two RFID gates (at entrance and departure). Also, a number of related works used a Raspberry Pi device that costs 90$, which is more expensive compared with our approach microcontroller Arduino that costs 24$ nearly. The paper’s third contribution introduces a novel solution for open area garages and open and large parking spaces (e.g., airport, stadium), where once the user car enters the garage, the user car moves toward the nearest empty slot utilizing the real-time map instead of searching for an empty garage slot. The final contribution automizing all steps of this proposed work leads to eliminate human contact. This automizing helps users avoid disease infection due to human contact like COVID-19.Table 1
Summary of smart parking systems.
Smart parking sensorSystems usedWireless interfaceDrawbackMackey et al. [9]Android appCloud serverBluetoothNeeds a continuous Bluetooth connectivity between mobile and beacon to update databaseThe system works only for registered BLE beaconsDixit et al. [10]NodeMCUAndroid appCCTVCloud serverWiFiThe CCTV cameras do not accurately take results in dark times or foggy atmospheresThanh et al. [11]Android appCloud serverArduino+RFIDWiFiIt used one ramp and RFID for each car slot, which is considered to be a high cost and an impractical solutionMainetti et al. [12]Android appCloud serverRFID+Zigbee+Raspberry PiUHFWiFiIt is suited only in ceiling parking to mount light indicator on the ceilingIt costs high compared to our proposed systemMukadam and Logeswaran [13]Android appCloud serverArduino+Raspberry PiWiFiCost is high compared to our systemNeed a mouse and keyboardAjchariyavanich et al. [14]Android appCloud serverNodeMCUWiFiIt used one flap for every car slot, which increases the total cost for the projectHamzah et al. [15]Android appCloud serverArduino+NRF24L01WiFiIt used a PIR sensor to detect the presence or absence of a car in a parking slot. The PIR sensor is not efficient in temperature range higher than 35°CProposed systemAndroid appCloud serverArduino+NodeMCUWiFiIt avoids aforementioned drawbacks mentioned aboveThe introduction is discussed in Section1, the study technique and the results are discussed in Section 2. Wraps off and looks ahead to future development displayed into Section 3.


## 2. Research Method

### 2.1. System Overview

The difficulty of getting a parking spot is a serious challenge for people in underdeveloped countries. Because the number of people who travel by automobile is increasing, it will take longer for people to find a parking spot for their cars as time goes on. This leads to additional issues such as people parking their vehicles in another person’s reserved parking spot, and it has been discovered that the driver takes a long time to find parking, which increases the vehicle’s fuel consumption, so a smart parking system that assists the driver in finding parking and reduces both fuel consumption and air pollution is required [16].Smart phones are one of the most appealing solutions for developing IoT applications due to their low cost and ability to use easily available technologies such as 3G networks and WiFi-based services. And the IoT is a vast field in which various sensors are connected over the Internet via data exchange protocols. With the rising usage of smartphones and smart devices, IoT applications have expanded to include customers’ daily lives. IoT applications are numerous, and a smart garage is one of them [17, 18].Technologies such as short-range wireless communication radio-frequency identification and wireless sensor networks (WSN) have permitted the Internet to dive into embedded computing [19–22]. Various keywords were used such as “internet”, “web of things”, “mobile computing”, “web”, and concatenation of them. Existing surveys on the IoT/WoT and mobile sensing [23–31] were also studied for relevant efforts.With the development of science and striving to develop all services that facilitate human life, the Internet of Things technology is one of the best things that makes it easier for humans to control all their needs. Smart garage is one of the projects that contribute to facilitating human life, As shown in Figure1, The smart garage projects follow this form, where the empty slots are displayed on the mobile application by taking data from the parking using the microcontroller and sending the information to the application using the database.Figure 1
Overview of the smart parking.Initially, the empty places can be determined by a set of sensors at the parking garage, and they are sent to the Arduino that sends them to the data base by NodeMCU, and the application receives data from the data base and shows the available places on a map in a mobile application. The driver selects the available places and enters some information like name, national ID, and information for his payment card by the application that sends it to the database and sends it to the microcontroller; thus, the smart garage can know the required car and when it arrived in the garage, it recognizes the car RFID (electronic poster) by RFID reader, and the gate opens, and this is also sent to the database, and the application starts, estimating money every hour from entry time to checkout time.When a car is entering the park, the RFID sensor detects the car’s Unique ID (UID) and sends it to the database via Arduino. The system will check if this UID reserved a slot. If so, signal is sent to the gate. If not, the gate will still be closed. When the gate opened, RGB led emits green light. Otherwise, it emits red light. The gate ramp is followed by an ultrasonic sensor which is used to check if the car passed the gate or not. When the car passed the ultrasonic sensor, the sensor informs the system to close the gate ramp again and convert RGB led color to red. LCD is mounted at the entrance of the gate, to indicate the number of empty places into the park for the driver. The condition of every parking slot (i.e., clear/occupied) into the park is determined utilizing an ultrasonic sensor at each parking slot. If the parking slot sensor detects the presence of the car, the proposed system will decrement the number of the empty places in this park. And the updated number of free spaces will appear onto the LCD. In case the park is full, the driver will not be able to book a park slot, and the gate will not open. And if the RFID will not recognize the car UID and the RGB led on, it will still be red. Figures2 and 3 show the proposed system block.Figure 2
Overview of local unit.Figure 3
Architecture of the proposed system.The database technology used in this system is Firebase. The Firebase Realtime Database is hosted in the cloud. The data is saved as a JSON tree and synchronized in real time across all connected clients. When a crossplatform application is linked to the Android application SDKs, all clients instantaneously share the same Realtime Database and receive automatic updates to the most recent data [29].Firebase is used here to link between the Android application and the microcontroller utilized (Arduino) as shown in Figure4. Database includes all user data (e.g., name, drive license number, email, and address). It includes many fields such as the price per parking hour, the number and condition of the parking slots, and their location. Also, it includes the number of reservation hours and the total money value per user, payment method, and user wallet balance.Figure 4
System database architecture.The proposed system (i.e., smart parking system) contains software and hardware sections. To launch this helmet (Arduino, Android, and Firebase), tools were employed; the functionality of the proposed system is finding an empty slot to park in.The main microcontroller in the hardware section is the Arduino Mega 2560 microcontroller. It is based on the ATmega2560, which can be seen in Figure5. It contains 54 digital input/output pins, 16 analogue inputs, 4 UARTs (hardware serial ports), a 16 MHz crystal oscillator, a USB connection, a power jack, an ICSP header, and a reset button. It was used as the major MC in this paper to manage park entrance and exit via ramp, as well as the quantity of unoccupied slots each park [31–34].Figure 5
Arduino mega type.A liquid crystal display (LCD) is a flat-panel display or other electronically modulated optical device that exploits the light-modulating characteristics of liquid crystals paired with polarizers, as well as other components, shown in Figure6. It is used to display characters and digits in addition to user-defined characters. LCD is utilized in this paper to show the total parking slots of the garage and the number of the empty slots, and if any car entered or left the parking slot, the number of the empty slots changes [35].Figure 6
LCD that displays the empty and full places.The ultrasonic sensor is the most important sensor in the hardware segment. It is an electronic gadget that uses ultrasonic sound waves to measure the distance between a target item and converts the reflected sound into an electrical signal, as shown in Figure7. Ultrasonic sensor is utilized for two functions: one to determine the condition of each slot in the park and second utilization for ultrasonic sensor at the entrance and departure gates to close the ramp (gate) after the car passes [32, 36].Figure 7
Ultrasonic sensor in parking.To open or close entrance and departure gates, servomotor was utilized in this paper. It is a rotary actuator or linear actuator that allows for precise control of angular or linear position, velocity, and acceleration; the servomotor is shown in Figure8. It consists of a suitable motor coupled to a sensor for position feedback [37].Figure 8
Servomotor connected in the gate.Cars are classified at the gates based on detection of RFID tag using radio-frequency identification (RFID). RFID uses electromagnetic fields to automatically identify and track tags attached to objects, as shown in Figure9. A radio transponder, a radio receiver, and a transmitter make up an RFID system. The tag delivers digital data back to the reader when triggered by an electromagnetic interrogation pulse from a nearby RFID reader device. In the prototype, an RFID reader scans the car’s UID, after which an Arduino checks the UID against a database to see if the driver or user reserved a parking place or not and then allows the car to pass through the gate [22].Figure 9
RFID in the entrance and exit gate.At the gate ramp, RGB LED is mounted to indicate the condition of the gate (e.g., open (green)/close (red)). RGB LED means red, blue, and green LEDs. RGB LED product combination of these three colors is used to produce over 16 million hues of light. Note that not all colors are possible. The RGB LED is a form of LED that emits multiple colors, specifically red, green, and blue, as shown in Figure8. It will be green when the gate is open and red when it is closed.To store variables value at the database, NodeMCU was utilized. It is an open-source firmware for which open-source prototyping board designs are available as shown in Figure10. The name “NodeMCU” combines “node” and “MCU” (microcontroller unit). NodeMCU is responsible for exchanging information (e.g., empty slots, reservation, and user UID) between hardware prototype and Android application [38, 39].Figure 10
NodeMCU.After assembly, all previous components are mentioned. Figure11 shows the constructed prototype for the hardware section in this parking system.Figure 11
Prototype of the system.


### 2.2. System Mobile Application

The user can reserve, cancel, and modify information using the Android application. Android is a touchscreen mobile operating system based on a modified version of the Linux kernel and other open-source software, built primarily for smartphones and tablets. The Android application is utilized by car users to reserve and pay online without any human interaction. So, car information should be located at the database before any other process; this is done through first-time registration. At the registration process, information is stored in a manner to be utilized in later processes. After registration, the car user can log in to the application. Figures12(a) and 12(b) show the registration and login processes, respectively.Figure 12
Registration and login processes, respectively.
(a)(b)The paper proposed three garages as a proof of concept. Hardware prototype represents one of three garages with 8 parking slot capacity. The other two garages are proposed to be virtual at the database. After the login process, the user can select a garage to book a slot into it and in addition determine the expected time to stay at the garage to perform the booking process. If the user wants to recharge his balance via a master card, as shown in Figure13(a), after the booking process is done, a ticket will be generated for the user as shown in Figure 13(b).Figure 13
(a) Shows different ways of recharging the balance, and (b) shows the reservation ticket.
(a)(b)


### 2.3. Results and Discussion

The user creates an account on the Android application by recording some information (e.g., name, car UID, email, and mobile number), then start to reserve a slot via the Android application by monitoring all garages listed with corresponding empty slots. Car users select the proper garage and monitor empty slots at the garage map, which solve the problem of looking for an empty slot inside the open area garage by going directly toward the desired empty slot. When the car reaches the garage entrance gate, the LCD displays the number of empty slots at the garage. If there is at least one empty slot, the RFID reader scans car UID. NodeMCU scans if UID matches with user information at the database; if so, an entrance gate will open and RGB LED will emit green. The entrance gate will still open till the car moved inside the garage; this is done through an ultrasonic sensor at the entrance gate. When the car parked at an empty slot, the Realtime Database updates the status of empty slots and LCD at the entrance decrement number of empty slots. If the garage is full, the entrance ramp is still closed when the car tries to reserve and enter the garage. Algorithm1 shows the entrance algorithm.Algorithm 1: Entrance algorithm.
1.do2. Check the garage until there is an empty location.3.While (number of parking slot =0) ;the garage is full4.While (entrance RFID=value)5. scanning the RFID UID.6. Check and match presence of UID in the database.7.If (UID invalid)8.   Print invalid UID9.else10.   Open the entrance gate and turn RGB led to green.11.If (entrance gate sensor D>threshold 4cm)12.     Close the gate and turn RGB led to red13.     Start scanning the slots14.If (empty slot number ≠0)15.       Decrement number of empty slots at Lcd16.       send the empty slot locations to17.       application via Node MCU18.Else19.       Print Garage is full at LCD20.       send the Garage is full in application21.End if22.End if23.End if24.End whileAt the departure gate, when the car needs to leave the database, calculate the car charge according to time remaining into the garage. When departure RFID scans car UID, the departure gate opens and RGB LED turns green. When the ultrasonic sensor detects that the car moved away, the departure gate closes and RGB LED turns red. Algorithm2 shows the departure algorithm.Algorithm 2: Departure algorithm.
1.While (departure RFID=value)2. Open the departure gate and turn RGB led to green.3.If (entrance gate sensor D > threshold 4cm)4.  Close the departure gate and turn RGB led to red5.  Start scanning the slots6.  Increment number of empty slots at Lcd7.  Send the empty slots to application via Node MCU8.End if9.End whileAt the proposed system, supposing a scenario where the user selects a desired garage then books a garage slot into this one. Once the slot is booked, the prepaid credit covers reservation fees. In addition, the database will decrement by one. When the driver reaches the desired garage, the driver can move directly toward the empty slot, as shown in Figure14. Another scenario is when the user tries to reserve an empty slot, while the garage is full. Reservation process is failed due to zero empty slots in this garage. So, the user can go back to garage list and select another garage to reserve a garage slot. This paper introduces for the first-time knowledge of garage empty slots into an open area garage. There is no need for the driver to search for empty places, which allows the driver to move directly to the exactly empty slot. This technique saves the driver’s time and fuel which minimizes carbon dioxide emission decreasing global warming.Figure 14
The current empty slots in the garage as shown in mobile application.The proposed system can easily be implemented with minor limitation. Signal can fade in long-distance implementation. But this limitation can be skipped by utilizing a repeater to regenerate signal with its original amplitude.Android mobile application is initiated and connected to the proposed system at the garage through Firebase Realtime Database (DB), as shown in Figure4 with the overall architecture. Figure 15 shows the overall flowchart of the Android application. According to the previous sequence described above, DB works as a hub for both hardware and software sections. DB is utilized by the Android application to save the user data acquired from the app. Finally, the complete hardware circuit diagram for the system is shown in Figure 16. It includes Arduino Mega 2560, LCD, RFID reader, servomotors, ultrasonic sensors (HC-05), and NodeMCU.Figure 15
Flowchart of the sequence of application.Figure 16
The circuit diagram for the hardware component utilized into the system.


## 2.1. System Overview

The difficulty of getting a parking spot is a serious challenge for people in underdeveloped countries. Because the number of people who travel by automobile is increasing, it will take longer for people to find a parking spot for their cars as time goes on. This leads to additional issues such as people parking their vehicles in another person’s reserved parking spot, and it has been discovered that the driver takes a long time to find parking, which increases the vehicle’s fuel consumption, so a smart parking system that assists the driver in finding parking and reduces both fuel consumption and air pollution is required [16].Smart phones are one of the most appealing solutions for developing IoT applications due to their low cost and ability to use easily available technologies such as 3G networks and WiFi-based services. And the IoT is a vast field in which various sensors are connected over the Internet via data exchange protocols. With the rising usage of smartphones and smart devices, IoT applications have expanded to include customers’ daily lives. IoT applications are numerous, and a smart garage is one of them [17, 18].Technologies such as short-range wireless communication radio-frequency identification and wireless sensor networks (WSN) have permitted the Internet to dive into embedded computing [19–22]. Various keywords were used such as “internet”, “web of things”, “mobile computing”, “web”, and concatenation of them. Existing surveys on the IoT/WoT and mobile sensing [23–31] were also studied for relevant efforts.With the development of science and striving to develop all services that facilitate human life, the Internet of Things technology is one of the best things that makes it easier for humans to control all their needs. Smart garage is one of the projects that contribute to facilitating human life, As shown in Figure1, The smart garage projects follow this form, where the empty slots are displayed on the mobile application by taking data from the parking using the microcontroller and sending the information to the application using the database.Figure 1
Overview of the smart parking.Initially, the empty places can be determined by a set of sensors at the parking garage, and they are sent to the Arduino that sends them to the data base by NodeMCU, and the application receives data from the data base and shows the available places on a map in a mobile application. The driver selects the available places and enters some information like name, national ID, and information for his payment card by the application that sends it to the database and sends it to the microcontroller; thus, the smart garage can know the required car and when it arrived in the garage, it recognizes the car RFID (electronic poster) by RFID reader, and the gate opens, and this is also sent to the database, and the application starts, estimating money every hour from entry time to checkout time.When a car is entering the park, the RFID sensor detects the car’s Unique ID (UID) and sends it to the database via Arduino. The system will check if this UID reserved a slot. If so, signal is sent to the gate. If not, the gate will still be closed. When the gate opened, RGB led emits green light. Otherwise, it emits red light. The gate ramp is followed by an ultrasonic sensor which is used to check if the car passed the gate or not. When the car passed the ultrasonic sensor, the sensor informs the system to close the gate ramp again and convert RGB led color to red. LCD is mounted at the entrance of the gate, to indicate the number of empty places into the park for the driver. The condition of every parking slot (i.e., clear/occupied) into the park is determined utilizing an ultrasonic sensor at each parking slot. If the parking slot sensor detects the presence of the car, the proposed system will decrement the number of the empty places in this park. And the updated number of free spaces will appear onto the LCD. In case the park is full, the driver will not be able to book a park slot, and the gate will not open. And if the RFID will not recognize the car UID and the RGB led on, it will still be red. Figures2 and 3 show the proposed system block.Figure 2
Overview of local unit.Figure 3
Architecture of the proposed system.The database technology used in this system is Firebase. The Firebase Realtime Database is hosted in the cloud. The data is saved as a JSON tree and synchronized in real time across all connected clients. When a crossplatform application is linked to the Android application SDKs, all clients instantaneously share the same Realtime Database and receive automatic updates to the most recent data [29].Firebase is used here to link between the Android application and the microcontroller utilized (Arduino) as shown in Figure4. Database includes all user data (e.g., name, drive license number, email, and address). It includes many fields such as the price per parking hour, the number and condition of the parking slots, and their location. Also, it includes the number of reservation hours and the total money value per user, payment method, and user wallet balance.Figure 4
System database architecture.The proposed system (i.e., smart parking system) contains software and hardware sections. To launch this helmet (Arduino, Android, and Firebase), tools were employed; the functionality of the proposed system is finding an empty slot to park in.The main microcontroller in the hardware section is the Arduino Mega 2560 microcontroller. It is based on the ATmega2560, which can be seen in Figure5. It contains 54 digital input/output pins, 16 analogue inputs, 4 UARTs (hardware serial ports), a 16 MHz crystal oscillator, a USB connection, a power jack, an ICSP header, and a reset button. It was used as the major MC in this paper to manage park entrance and exit via ramp, as well as the quantity of unoccupied slots each park [31–34].Figure 5
Arduino mega type.A liquid crystal display (LCD) is a flat-panel display or other electronically modulated optical device that exploits the light-modulating characteristics of liquid crystals paired with polarizers, as well as other components, shown in Figure6. It is used to display characters and digits in addition to user-defined characters. LCD is utilized in this paper to show the total parking slots of the garage and the number of the empty slots, and if any car entered or left the parking slot, the number of the empty slots changes [35].Figure 6
LCD that displays the empty and full places.The ultrasonic sensor is the most important sensor in the hardware segment. It is an electronic gadget that uses ultrasonic sound waves to measure the distance between a target item and converts the reflected sound into an electrical signal, as shown in Figure7. Ultrasonic sensor is utilized for two functions: one to determine the condition of each slot in the park and second utilization for ultrasonic sensor at the entrance and departure gates to close the ramp (gate) after the car passes [32, 36].Figure 7
Ultrasonic sensor in parking.To open or close entrance and departure gates, servomotor was utilized in this paper. It is a rotary actuator or linear actuator that allows for precise control of angular or linear position, velocity, and acceleration; the servomotor is shown in Figure8. It consists of a suitable motor coupled to a sensor for position feedback [37].Figure 8
Servomotor connected in the gate.Cars are classified at the gates based on detection of RFID tag using radio-frequency identification (RFID). RFID uses electromagnetic fields to automatically identify and track tags attached to objects, as shown in Figure9. A radio transponder, a radio receiver, and a transmitter make up an RFID system. The tag delivers digital data back to the reader when triggered by an electromagnetic interrogation pulse from a nearby RFID reader device. In the prototype, an RFID reader scans the car’s UID, after which an Arduino checks the UID against a database to see if the driver or user reserved a parking place or not and then allows the car to pass through the gate [22].Figure 9
RFID in the entrance and exit gate.At the gate ramp, RGB LED is mounted to indicate the condition of the gate (e.g., open (green)/close (red)). RGB LED means red, blue, and green LEDs. RGB LED product combination of these three colors is used to produce over 16 million hues of light. Note that not all colors are possible. The RGB LED is a form of LED that emits multiple colors, specifically red, green, and blue, as shown in Figure8. It will be green when the gate is open and red when it is closed.To store variables value at the database, NodeMCU was utilized. It is an open-source firmware for which open-source prototyping board designs are available as shown in Figure10. The name “NodeMCU” combines “node” and “MCU” (microcontroller unit). NodeMCU is responsible for exchanging information (e.g., empty slots, reservation, and user UID) between hardware prototype and Android application [38, 39].Figure 10
NodeMCU.After assembly, all previous components are mentioned. Figure11 shows the constructed prototype for the hardware section in this parking system.Figure 11
Prototype of the system.


## 2.2. System Mobile Application

The user can reserve, cancel, and modify information using the Android application. Android is a touchscreen mobile operating system based on a modified version of the Linux kernel and other open-source software, built primarily for smartphones and tablets. The Android application is utilized by car users to reserve and pay online without any human interaction. So, car information should be located at the database before any other process; this is done through first-time registration. At the registration process, information is stored in a manner to be utilized in later processes. After registration, the car user can log in to the application. Figures12(a) and 12(b) show the registration and login processes, respectively.Figure 12
Registration and login processes, respectively.
(a)(b)The paper proposed three garages as a proof of concept. Hardware prototype represents one of three garages with 8 parking slot capacity. The other two garages are proposed to be virtual at the database. After the login process, the user can select a garage to book a slot into it and in addition determine the expected time to stay at the garage to perform the booking process. If the user wants to recharge his balance via a master card, as shown in Figure13(a), after the booking process is done, a ticket will be generated for the user as shown in Figure 13(b).Figure 13
(a) Shows different ways of recharging the balance, and (b) shows the reservation ticket.
(a)(b)


## 2.3. Results and Discussion

The user creates an account on the Android application by recording some information (e.g., name, car UID, email, and mobile number), then start to reserve a slot via the Android application by monitoring all garages listed with corresponding empty slots. Car users select the proper garage and monitor empty slots at the garage map, which solve the problem of looking for an empty slot inside the open area garage by going directly toward the desired empty slot. When the car reaches the garage entrance gate, the LCD displays the number of empty slots at the garage. If there is at least one empty slot, the RFID reader scans car UID. NodeMCU scans if UID matches with user information at the database; if so, an entrance gate will open and RGB LED will emit green. The entrance gate will still open till the car moved inside the garage; this is done through an ultrasonic sensor at the entrance gate. When the car parked at an empty slot, the Realtime Database updates the status of empty slots and LCD at the entrance decrement number of empty slots. If the garage is full, the entrance ramp is still closed when the car tries to reserve and enter the garage. Algorithm1 shows the entrance algorithm.Algorithm 1: Entrance algorithm.
1.do2. Check the garage until there is an empty location.3.While (number of parking slot =0) ;the garage is full4.While (entrance RFID=value)5. scanning the RFID UID.6. Check and match presence of UID in the database.7.If (UID invalid)8.   Print invalid UID9.else10.   Open the entrance gate and turn RGB led to green.11.If (entrance gate sensor D>threshold 4cm)12.     Close the gate and turn RGB led to red13.     Start scanning the slots14.If (empty slot number ≠0)15.       Decrement number of empty slots at Lcd16.       send the empty slot locations to17.       application via Node MCU18.Else19.       Print Garage is full at LCD20.       send the Garage is full in application21.End if22.End if23.End if24.End whileAt the departure gate, when the car needs to leave the database, calculate the car charge according to time remaining into the garage. When departure RFID scans car UID, the departure gate opens and RGB LED turns green. When the ultrasonic sensor detects that the car moved away, the departure gate closes and RGB LED turns red. Algorithm2 shows the departure algorithm.Algorithm 2: Departure algorithm.
1.While (departure RFID=value)2. Open the departure gate and turn RGB led to green.3.If (entrance gate sensor D > threshold 4cm)4.  Close the departure gate and turn RGB led to red5.  Start scanning the slots6.  Increment number of empty slots at Lcd7.  Send the empty slots to application via Node MCU8.End if9.End whileAt the proposed system, supposing a scenario where the user selects a desired garage then books a garage slot into this one. Once the slot is booked, the prepaid credit covers reservation fees. In addition, the database will decrement by one. When the driver reaches the desired garage, the driver can move directly toward the empty slot, as shown in Figure14. Another scenario is when the user tries to reserve an empty slot, while the garage is full. Reservation process is failed due to zero empty slots in this garage. So, the user can go back to garage list and select another garage to reserve a garage slot. This paper introduces for the first-time knowledge of garage empty slots into an open area garage. There is no need for the driver to search for empty places, which allows the driver to move directly to the exactly empty slot. This technique saves the driver’s time and fuel which minimizes carbon dioxide emission decreasing global warming.Figure 14
The current empty slots in the garage as shown in mobile application.The proposed system can easily be implemented with minor limitation. Signal can fade in long-distance implementation. But this limitation can be skipped by utilizing a repeater to regenerate signal with its original amplitude.Android mobile application is initiated and connected to the proposed system at the garage through Firebase Realtime Database (DB), as shown in Figure4 with the overall architecture. Figure 15 shows the overall flowchart of the Android application. According to the previous sequence described above, DB works as a hub for both hardware and software sections. DB is utilized by the Android application to save the user data acquired from the app. Finally, the complete hardware circuit diagram for the system is shown in Figure 16. It includes Arduino Mega 2560, LCD, RFID reader, servomotors, ultrasonic sensors (HC-05), and NodeMCU.Figure 15
Flowchart of the sequence of application.Figure 16
The circuit diagram for the hardware component utilized into the system.


## 3. Conclusion

This paper provides a perfectly viable approach for addressing and resolving some of the major challenges that people in underdeveloped countries suffer as a result of current parking arrangements. Unlike the discussed related work, there’s no need to search for garage empty places in this proposed system. The proposed solution not only saves time for consumers, but it also ensures that they will find a garage parking spot to park their automobile, even before they arrive at the location. The garage smart parking system confirms booking and charges booking process without any human interaction, in addition to allowing the car owner to go directly toward the garage parking spot without any searching at the empty garage spot. The proposed system is expected to eliminate harmful gases from cars and fuel consumption which led to aid overall environment around the garage areas. Implementation of this proposed system in real world can integrate this paper as a future work. Some addition like multiplexer and repeaters will be added to overcome limitations like long distance and a large number of sensors.



---

*Source: 9070683-2022-09-12.xml*