A comprehensive ergonomic wellness system built for Nathacks 2025 that combines computer vision and EMG sensors to monitor and prevent workplace injuries. The system includes both a frontend wellness dashboard and a hardware component for real-time ergonomic feedback.
Ergonomiq is an AI-powered desk health companion that helps users maintain proper posture, reduce eye strain, and prevent wrist injuries during long work sessions. The system features:
- Real-time posture monitoring using computer vision
- Eye strain prevention with blink tracking and session time alerts
- RSI (Repetitive Strain Injury) detection using EMG sensors
- Comprehensive analytics dashboard with trend visualization
- User-friendly UI/UX with notification system
- Hardware integration for advanced wrist monitoring
The project is composed of two main components:
- React/TypeScript application with Vite build tool
- MediaPipe integration for computer vision processing
- Firebase backend for authentication and data storage
- Tailwind CSS + shadcn/ui for modern UI components
- Live posture and eye monitoring via webcam
- Analytics dashboard with trend visualization
- EMG sensors connected via wires to user's forearm
- Arduino Mega running StandardFirmata
- Python-based signal processing with SciPy/NumPy
- FastAPI backend for data transmission
- RSI risk monitoring with haptic feedback
- Real-time neck drop detection
- Shoulder and head tilt monitoring
- Calibration system for personal baseline
- Visual feedback with landmarks overlay
- 30-frame calibration process
- Blink rate tracking using MediaPipe Face Landmarker
- Eye Aspect Ratio (EAR) calculation
- 20-20-20 rule reminders
- Session time alerts after 20 minutes of continuous work
- Low blink rate warnings
- EMG-based muscle activity detection
- Sustained activation pattern recognition
- Real-time RSI risk tracking
- Accumulated risk time calculation
- Haptic feedback for high-risk situations
- Comprehensive posture score tracking
- Eye strain risk assessment
- Wrist strain trend visualization
- Weekly improvement metrics
- Session history with detailed analytics
- Node.js (v18 or higher)
- Python 3.8 or higher
- Arduino Mega or compatible board with StandardFirmata
- BioAmp EXG Pill sensor + Motion Vibrato module (for the wrist monitor)
- Camera access for posture monitoring (works directly on ergonomiq.dev)
-
Clone the repository
git clone https://github.com/MisbahAN/777777.git cd 777777 -
Setup Frontend
cd frontend npm install -
Configure Firebase
- Create a Firebase project at Firebase Console
- Enable Firestore and Authentication
- Create
.envfile with your Firebase configuration:VITE_FIREBASE_API_KEY=your_firebase_api_key VITE_FIREBASE_AUTH_DOMAIN=your_firebase_auth_domain VITE_FIREBASE_PROJECT_ID=your_firebase_project_id VITE_FIREBASE_STORAGE_BUCKET=your_firebase_storage_bucket VITE_FIREBASE_MESSAGING_SENDER_ID=your_firebase_messaging_sender_id VITE_FIREBASE_APP_ID=your_firebase_app_id
-
Setup Hardware (Optional if using hardware)
cd ../hardware/api python3 -m venv .venv source .venv/bin/activate # Linux/macOS pip install -r requirements.txt pip install pyfirmata scipy matplotlib numpy
-
Hardware Wiring
- Upload
StandardFirmata.inoto your Arduino - Wire the BioAmp EXG Pill to analog pin A0 (plus VCC/GND rails)
- Wire the Motion Vibrato (motor driver) to digital pin 13 for haptic cues
- Update
SERIAL_PORTinhardware/RSIDetection.pywith your Arduino port
- Upload
-
Run the complete system
- Terminal 1 (frontend):
cd frontend npm run dev - Terminal 2 (hardware API shim):
cd hardware/api conda activate nh25 uvicorn main:app --reload --host 0.0.0.0 --port 8000 - Terminal 3 (hardware demos):
cd hardware conda activate nh25 # Wrist monitor (requires our Wireless Patch hardware) python RSIDetection.py # Posture monitor demo stream python posture.py
These steps mirror the detailed instructions in
hardware/README.md. - Terminal 1 (frontend):
The application will be available at http://localhost:5173.
The full posture + eye experience already runs live at https://www.ergonomiq.dev/. The wrist monitor currently requires our BioAmp EXG Pill hardware until the Wireless Patch wearable ships; without it, the dashboard simply hides those live readings.
- Posture, blink, and analytics features work out-of-the-box via webcam (locally or on ergonomiq.dev).
- Without the BioAmp EXG Pill hardware connected, the Wrist Strain Coach simply shows a placeholder state while the rest of the platform continues to function.
777777/
├── frontend/ # React/TypeScript frontend application
│ ├── src/
│ │ ├── components/ # UI components
│ │ ├── hooks/ # Custom React hooks (usePostureVision, useAuthStore)
│ │ ├── lib/ # Service libraries (Firebase, hardware API)
│ │ ├── pages/ # Application views (Dashboard, PostureMonitor, etc.)
│ │ └── utils/ # Helper functions
│ ├── public/ # Static assets
│ └── package.json # Dependencies and scripts
├── hardware/ # EMG-based wrist monitoring system
│ ├── api/ # FastAPI backend for hardware data
│ │ ├── main.py # API endpoints for RSI analytics
│ │ └── requirements.txt
│ ├── StandardFirmata.ino # Arduino firmware
│ ├── RSIDetection.py # EMG processing + wrist telemetry
│ └── posture.py # Posture monitor demo script
├── README.md # This file
└── .gitignore
- Framework: React 18.3.1 with TypeScript
- Build Tool: Vite
- Styling: Tailwind CSS, shadcn/ui
- State Management: Zustand, React Query
- Computer Vision: MediaPipe Pose/Face Landmarker
- Charts: Recharts for data visualization
- Authentication: Firebase Auth
- Database: Firebase Firestore
- Microcontroller: Arduino Mega with StandardFirmata
- Sensors: Surface EMG sensors
- Communication: pyFirmata for Arduino interfacing
- Backend: FastAPI for data transmission
- Signal Processing: SciPy, NumPy for EMG analysis
- Packaging: Python virtual environments
POST /vibrate- Trigger haptic feedback (from posture monitoring)POST /rsi- Send RSI telemetry data from hardwareGET /rsi- Retrieve RSI analytics for frontend
- Frontend sends posture alerts to
http://localhost:8000/vibrate - Hardware sends RSI data to
http://localhost:8000/rsi - Frontend polls
http://localhost:8000/rsifor wrist analytics
If you don’t have the BioAmp EXG Pill connected, you can still demo posture + eye flows:
- Start the API server:
cd hardware/api uvicorn main:app --reload --host 0.0.0.0 --port 8000 - Replay the posture monitor pipeline:
cd hardware python posture.py - Start the frontend:
cd frontend npm run dev
- Ensure your Arduino has StandardFirmata uploaded
- Update the serial port in
hardware/RSIDetection.py - Run
python hardware/RSIDetection.py(BioAmp EXG Pill + Motion Vibrato required) - Start the API server:
uvicorn hardware/api/main:app --reload --host 0.0.0.0 --port 8000 - Start the frontend:
npm run dev
timestampStart/End: Session start/end timespostureData: String of 0s/1s representing good/bad posture framestotalFrames,badFrames: Frame counts and ratiosfrequency: Sampling frequencytriggerAlert: Boolean indicating if alert was triggered
timestampStart: Session start timeduration: Session length in secondsavgBlinkRate: Average blinks per minutetotalBlinks,avgEAR: Eye metricsstrainAlerts,lowBlinkRateAlerts: Alert counts
recordedAt: Timestamp of risk intervaldurationSeconds: Duration of high-risk periodcumulativeRiskSeconds: Total accumulated risk timemeanEnvelope: Average EMG envelope value
- Posture Score: Percentage of time in good posture (target >80%)
- Neck Drop: Percentage of neck lean forward
- Shoulder Tilt: Degree of uneven shoulders
- Head Tilt: Degree of head rotation/tilt
- Weekly Improvement: Trend analysis
- Blink Rate: Blends per minute (healthy ≥10/min)
- Eye Aspect Ratio: EAR ≥ 0.25 indicates healthy eye openness
- Session Time: Duration before 20-minute break recommendation
- Eye Strain Risk: LOW/MEDIUM/HIGH classification
- Total Risk Time: Cumulative time in high-risk state
- Average Session Time: Average duration of risk intervals
- Longest Session: Longest continuous risk period
- Detection Events: Number of high-risk muscle activations
- React - Component-based UI library
- TypeScript - Type-safe JavaScript
- Vite - Fast build tool
- Tailwind CSS - Utility-first CSS framework
- shadcn/ui - Accessible UI components
- MediaPipe - Computer vision framework
- Firebase - Backend services
- Arduino - Microcontroller platform
- pyFirmata - Python-Arduino communication
- FastAPI - Python web framework
- SciPy/NumPy - Scientific computing
- StandardFirmata - Arduino communication protocol