Skip to content

0xASR-dev/parky_spot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

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

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors