# dhiwinsamrich/hand_sign_recoginition_iot architecture

> Architecture diagram of the GitHub repository dhiwinsamrich/hand_sign_recoginition_iot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dhiwinsamrich/hand_sign_recoginition_iot
- Repository: https://github.com/dhiwinsamrich/hand_sign_recoginition_iot

## Overview

##### Project Type and Purpose
- This is a full-stack IoT + ML system for real-time hand-sign recognition using a smart glove.
- Key domains: Embedded hardware (sensors + microcontrollers), edge networking, cloud-hosted REST API, and a machine-learning inference service.

##### File Structure
- Top-level hardware/software separation is implicit:
- “Model/” holds serialized Keras models (.h5) used by the server.
- “server.py” is the Flask REST API that loads the model and exposes a /predict endpoint.
- “IPYNB File/” and standalone .ipynb notebooks encapsulate data exploration, training, and deployment experiments (e.g., “deploy a saved keras model to aws.ipynb”).
- No explicit “frontend” folder— the glove + microcontroller acts as the edge client.
- Deployment artifacts: LICENSE, README.md, certificates, and notebooks for AWS EC2 deployment.

##### README for Additional Insights
- Hardware: Flex sensors ×5 + MPU-6500 → Arduino Nano → NodeMCU ESP8266 (Wi-Fi).
- ML: A supervised classifier (Random Forest/SVM or a Keras model) with 95.7% accuracy, serialized and hosted in Flask.
- Cloud: AWS EC2 running Flask + Gunicorn, uptime 99.9%.
- Data flow: glove → JSON POST → /predict → JSON response.

##### Main Components & Interactions
a. Components
1. Hardware Layer
- Flex Sensors + IMU (MPU-6500)
- Arduino Nano (sensor aggregation)
- NodeMCU ESP8266 (Wi-Fi client)
2. Network Layer
- Wi-Fi/Internet (HTTP(S))
3. Cloud/API Layer
- AWS EC2 (Ubuntu)
- Gunicorn + Flask (server.py)
4. ML Inference Layer
- Keras model files (Model/mini_model.h5, my_model.h5)
- In-process inference (via Flask)
5. Clients / Testing
- Postman or any HTTP client
6. (Optional) Offline Training Environment
- Jupyter Notebooks (IPYNB File/) for training, evaluation, and model export
b. Relationships & Data Flow
- Sensor data (flex + gyro + accel) → Arduino Nano serial → NodeMCU packages JSON.
- NodeMCU → HTTP POST to AWS EC2 /predict.
- Flask loads model, runs inference at <150 ms, returns JSON gesture.
- NodeMCU (or end-user) receives the recognized gesture.
- Offline: Data scientist uses notebooks to retrain and update Model/.
c. Architectural Patterns & Principles
- Edge-to-Cloud pattern: perform minimal preprocessing on device, heavy inference in cloud.
- Microservice-style API: single /predict endpoint, stateless inference service.
- Separation of concerns: Hardware firmware vs. network client vs. cloud service vs. ML training.
d. Relevant Technologies & Frameworks
- Firmware: Arduino IDE (C/C++), Serial Monitor
- Edge Client: NodeMCU ESP8266 (MicroPython/Arduino)
- ML: Python, NumPy, Pandas, scikit-learn or Keras (h5 serialization)
- API: Flask + Gunicorn
- Deployment: AWS EC2 (Ubuntu), JSON over HTTP

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Hardware Layer"
        Sensors["Flex Sensors + IMU (MPU-6500)"]:::hardware
        ArduinoNano("Arduino Nano"):::hardware
        NodeMCU("NodeMCU ESP8266"):::hardware
    end

    subgraph "Network Layer"
        WiFi["Wi-Fi / Internet (HTTP(S))"]:::network
    end

    subgraph "Cloud/API Layer"
        EC2("AWS EC2 (Ubuntu)"):::cloud
        Flask("Flask + Gunicorn\nserver.py"):::cloud
    end

    subgraph "ML Inference Layer"
        Mini("mini_model.h5"):::mlmodel
        My("my_model.h5"):::mlmodel
    end

    subgraph "Clients & Testing"
        Postman("Postman / HTTP Client"):::client
    end

    subgraph "Offline Training Environment"
        FinalNB("Final_Model.ipynb"):::offline
        CopyNB("Copy_of_Final_Model.ipynb"):::offline
        MainNB("main.ipynb"):::offline
        DeployNB("deploy a saved keras model to aws.ipynb"):::offline
        TestNB("test.ipynb"):::offline
    end

    subgraph "Documentation & Artifacts"
        Readme("README.md"):::doc
        License("LICENSE"):::doc
        Cert("Certificate/makeAThon .pdf"):::doc
    end

    Sensors -->|Serial Data| ArduinoNano
    ArduinoNano -->|JSON Packet| NodeMCU
    NodeMCU -->|HTTP POST /predict| WiFi
    WiFi -->|HTTP POST /predict| Flask
    Flask -->|Load Model & Inference| Mini
    Flask -->|Load Model & Inference| My
    Flask -->|JSON Response| NodeMCU
    NodeMCU -->|Display Gesture| Sensors
    Postman -->|Test POST /predict| Flask

    FinalNB -->|Train / Export| Mini
    FinalNB -->|Train / Export| My
    CopyNB -->|Reference / Edit| FinalNB
    MainNB -->|Experiment| FinalNB
    DeployNB -->|Deploy Script| Flask
    TestNB -->|Validation| Flask

    Readme -.-> EC2
    License -.-> EC2
    Cert -.-> EC2

    click Flask "https://github.com/dhiwinsamrich/hand_sign_recoginition_iot/blob/main/server.py"
    click Mini "https://github.com/dhiwinsamrich/hand_sign_recoginition_iot/blob/main/Model/mini_model.h5"
    click My "https://github.com/dhiwinsamrich/hand_sign_recoginition_iot/blob/main/Model/my_model.h5"
    click FinalNB "https://github.com/dhiwinsamrich/hand_sign_recoginition_iot/blob/main/IPYNB File/Final_Model.ipynb"
    click CopyNB "https://github.com/dhiwinsamrich/hand_sign_recoginition_iot/blob/main/IPYNB File/Copy_of_Final_Model.ipynb"
    click MainNB "https://github.com/dhiwinsamrich/hand_sign_recoginition_iot/blob/main/main.ipynb"
    click DeployNB "https://github.com/dhiwinsamrich/hand_sign_recoginition_iot/blob/main/deploy a saved keras model to aws.ipynb"
    click TestNB "https://github.com/dhiwinsamrich/hand_sign_recoginition_iot/blob/main/test.ipynb"
    click Readme "https://github.com/dhiwinsamrich/hand_sign_recoginition_iot/blob/main/README.md"
    click License "https://github.com/dhiwinsamrich/hand_sign_recoginition_iot/tree/main/LICENSE"
    click Cert "https://github.com/dhiwinsamrich/hand_sign_recoginition_iot/blob/main/Certificate/makeAThon .pdf"

    classDef hardware fill:#b2f5ea,stroke:#333,stroke-width:1px
    classDef network fill:#bee3f8,stroke:#333,stroke-width:1px
    classDef cloud fill:#fed7aa,stroke:#333,stroke-width:1px
    classDef mlmodel fill:#faf089,stroke:#333,stroke-width:1px
    classDef offline fill:#e2e8f0,stroke:#333,stroke-width:1px
    classDef client fill:#f0fff4,stroke:#333,stroke-width:1px
    classDef doc fill:#ffe3e3,stroke:#333,stroke-width:1px
```
