Nowadays it has become very difficult to find vehicle parking in the city because busy traffic and full parking can be found. In this era of technology, smart parking systems are being used to find parking for vehicles. This saves time and fuel both.
In this project tutorial, we are building a smart parking system using NodeMCU and ultrasonic sensors. Ultrasonic sensors are used to find distance ranges.
We will also show the live position of the parking slot on the Android app. For real-time data, we will use Google Firebase. We will use MIT App Inventor to develop an Android app. The real-time database is used to show the live position of the parking slot in the Android app.
- Ultrasonic Sensors (acc. slots needed)
- Jumper Wires
Circuit Diagram for Smart Parking System
|NodeMCU||Ultrasonic Sensor 1|
|NodeMCU||Ultrasonic Sensor 2|
|NodeMCU||Ultrasonic Sensor 3|
Code for Smart Parking
Firebase Console Setup
- Sign in Google Firebase, Create a new Project.
- Enter the Project Name and Project ID.
- From Project Dashboard choose Database.
- Create a Real-time Database and choose Start in test mode.
- Now copy your Firebase Project URL, which is like
- Eg. – https://project-id.firebaseio.com/
- Paste the URL in Code at FIREBASE_HOST without “https://” and “/”.
- Now go to Settings (near project overview on the dashboard).
- Choose Project Settings > Service Account > Database Secrets.
- Copy Project Secret than Paste in Code at FIREBASE_AUTH.
Android App Setup
- Download the Above Zip file and Extract it.
- Sign in MIT App Inventor and import .aia file from the downloaded file.
- Open the Project and Choose FirebaseDB1 from the Components list.
- In properties Paste Firebase Projects Secret in “Firebase Token” and Firebase Project URL in “FirebaseURL”.
- Paste full URL along with “https://”.
- Project Bucket should be empty.
Changes in Code When You Use It
- FIREBASE_HOST change with your Firebase Project URL.
- FIREBASE_AUTH change with your Firebase Project Database Secret.
- WIFI_SSID your Hotspot or WIFI name from which NodeMCU connects.
- WIFI_PASSWORD your WIFI network password.
Some More Articles For You: