Skip to content

Repository files navigation

ParkySpot: IoT-Based Smart Parking Dashboard

License Python Flask

🚗 Overview

ParkySpot is an IoT-based smart parking management system that provides real-time parking spot availability using ESP32 sensors. The system features a web dashboard for monitoring parking areas, booking slots, and receiving live sensor updates via WebSocket.

Key Features

  • Real-time Sensor Monitoring - ESP32 microcontrollers detect vehicle presence and push updates instantly
  • Interactive Map - Leaflet.js-powered map showing parking locations with live availability
  • Slot Booking System - Reserve parking spots with QR code confirmation
  • WebSocket Updates - Flask-SocketIO enables real-time dashboard updates
  • Admin Dashboard - Manage parking areas and spots through web interface

🛠️ Technology Stack

Component Technology
Backend Python, Flask, Flask-SQLAlchemy, Flask-SocketIO
Database SQLite (dev) / PostgreSQL (production)
Frontend HTML, Tailwind CSS, JavaScript, Leaflet.js
IoT Hardware ESP32 with IR/Ultrasonic sensors
Real-time Socket.IO for WebSocket communication

📁 Project Structure

parky_spot/
├── app/
│   ├── __init__.py          # Flask app initialization
│   ├── config.py             # Configuration (env variables)
│   ├── models.py             # SQLAlchemy database models
│   ├── routes.py             # API endpoints and page routes
│   ├── sockets.py            # WebSocket event handlers
│   ├── static/
│   │   └── Images/           # Static assets
│   └── templates/            # Jinja2 HTML templates
│       ├── home.html         # Main dashboard
│       ├── login.html        # User login
│       ├── signup.html       # User registration
│       ├── slotbooking.html  # Slot booking page
│       └── ...
├── espcode/
│   └── running.ino/          # ESP32 Arduino code
├── instance/                 # SQLite database (auto-generated)
├── run.py                    # Application entry point
├── requirements.txt          # Python dependencies
├── .env.example              # Environment variables template
└── README.md

🚀 Quick Start

Prerequisites

  • Python 3.8+
  • pip (Python package manager)
  • ESP32 development board (for IoT functionality)

1. Clone & Setup

git clone https://github.com/0xASR-dev/parky_spot.git
cd parky_spot

# Create virtual environment
python -m venv venv

# Activate virtual environment
# Windows:
venv\Scripts\activate
# Linux/macOS:
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

2. Configure Environment

# Copy example environment file
cp .env.example .env

# Edit .env with your settings (optional for development)

3. Run the Application

python run.py

The application will be available at http://localhost:5000

🔌 ESP32 Sensor Setup

Hardware Requirements

  • ESP32 development board
  • IR sensors or Ultrasonic sensors (one per parking spot)
  • WiFi network

Wiring

ESP32 Pin Sensor
GPIO 5 Sensor 1
GPIO 19 Sensor 2
GPIO 18 Sensor 3
GPIO 23 Sensor 4

Firmware Configuration

  1. Open espcode/running.ino/running.ino.ino in Arduino IDE
  2. Update WiFi credentials:
    const char* ssid = "YOUR_WIFI_SSID";
    const char* password = "YOUR_WIFI_PASSWORD";
  3. Update Flask server IP:
    const char* serverURL = "http://YOUR_SERVER_IP:5000/update-sensor-data";
  4. Upload to ESP32

Sensor Data Flow

ESP32 Sensors → HTTP POST → Flask /update-sensor-data → Database + SocketIO → Dashboard

📡 API Endpoints

Method Endpoint Description
GET / Main dashboard
GET /login Login page
POST /login Authenticate user
GET /signup Registration page
POST /signup Register user
GET /api/parking-areas Get all parking areas
GET /api/parking-area/<id> Get parking area details
GET /api/parking-spots/<area_id> Get spots for area
POST /update-sensor-data Receive sensor data (ESP32)
GET /add-parking-area Add parking area form
GET /add-parking-spot Add parking spot form

🌐 Deployment

Local Development

python run.py

Production (Gunicorn + Eventlet)

gunicorn --worker-class eventlet -w 1 --bind 0.0.0.0:5000 run:app

Environment Variables

Variable Description Default
SECRET_KEY Flask secret key Random
DATABASE_URL Database connection string sqlite:///parkyspot.db
FLASK_ENV Environment mode development

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/new-feature
  3. Commit changes: git commit -m 'Add new feature'
  4. Push to branch: git push origin feature/new-feature
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

📧 Contact

About

a platform for managing the online parking system of any parking.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages