Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

# Smart Shape Visualizer and Calculator Server

A real-time Flask and WebSocket backend server that processes geometric calculations, validates dimensional feasibility, and streams live drawing coordinates and telemetry from hardware (Arduino/ESP32) to an interactive web dashboard.

---

## Software and System Requirements

* Python: 3.10, 3.11, 3.12, or 3.13
* OS: Linux (Debian, Arch, Ubuntu), Windows 10/11, or macOS
* Network: Wi-Fi connection to connect to the ESP32 SoftAP hotspot

---

## Wi-Fi Hotspot Credentials (ESP32)

The ESP32 broadcasts its own independent Wi-Fi SoftAP network:

* SSID: SSVAC
* Password: skybeats
* ESP32 Gateway IP: 192.168.4.1

---

## Required Python Libraries

* Flask: Micro web framework to serve endpoints, static files, and UI templates.
* flask-sock: Native bidirectional WebSocket implementation for sub-millisecond client broadcasts.
* simple-websocket: Low-level engine providing clean socket frames for Flask-Sock.
* gunicorn: (Optional) Production-grade WSGI HTTP server for production Linux deployments.

---

## How to Connect the Server to the ESP32

1. Turn on the ESP32 board. It will host the Wi-Fi hotspot named SSVAC.
2. On your host machine (Laptop/PC running the Python server), open your Wi-Fi settings.
3. Connect to the Wi-Fi network:
   * Network Name (SSID): SSVAC
   * Security Password: skybeats
4. Once connected, your host machine will receive an IP address automatically from the ESP32 DHCP server (typically 192.168.4.2).
5. Start your Python server (`python3 app.py`).
6. The server will be accessible to the ESP32 at:
   http://192.168.4.2:5000/api/update
7. Open your browser on the host machine and visit:
   http://localhost:5000 or http://192.168.4.2:5000

---

## Setup and Installation

### 1. Create a Virtual Environment

Open your terminal in the project directory and create an isolated virtual environment:

python3 -m venv .venv

Activate the virtual environment:

Linux / macOS:
source .venv/bin/activate

Windows (PowerShell):
.venv\Scripts\Activate.ps1

Windows (Command Prompt):
.venv\Scripts\activate.bat

---

### 2. Create requirements.txt

Ensure a file named requirements.txt exists in your server root with the following contents:

Flask>=3.0.0
flask-sock>=0.7.0
simple-websocket>=1.0.0
gunicorn>=21.2.0

---

### 3. Install Dependencies

Run pip inside your activated virtual environment:

pip install --upgrade pip
pip install -r requirements.txt

---

### 4. Project Directory Structure

Make sure your folder matches the following layout before starting:

SERVER/
├── app.py
├── requirements.txt
├── README.md
├── assets/
│   ├── bg.jpg
│   ├── favicon.ico
│   ├── DM_Sans/
│   ├── papyrus-font/
│   └── pixelbasel-font/
├── static/
│   ├── css/
│   │   └── style.css
│   └── js/
│       └── app.js
└── templates/
    └── index.html

---

### 5. Running the Server

Start the application:

python3 app.py

The server binds to 0.0.0.0:5000 and immediately listens for incoming shape calculations and drawing telemetry sent by the ESP32 over the SSVAC Wi-Fi network.

About

SMART SHAPE VISUALIZER AND CALCULATOR

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages