PRISM (pH & Rehydration Intensity Sensor Module) is an innovative health monitoring system that analyzes color and pH levels of urine to provide real-time health insights. The system uses the TCS34725 color sensor and pH sensors connected to Arduino, with a Node.js backend for data processing and a Next.js frontend for visualization.
PRISM.mp4
- Project Design Assistant: Sebastian Silva
- Software development: Nathan Tam
- Hardware/Electrical Engineering: Edmond Ter Pogosyan
- Technical Research & Analysis: Anchita Ganesh
- CAD Modeling & Prototyping: Ernesto Tellez Perez & Connor McVicker
- pH Levels: Monitor acidity/alkalinity (normal range: 4.5-8.5)
- Color Analysis: 10-point health scale (1=excellent, 10=critical)
- Hydration Status: Real-time dehydration detection
- Health Alerts: Automatic notifications for concerning readings
- Real-time Monitoring: Continuous sensor data collection
- Machine Learning: K-means clustering for color classification
- pH Averaging: 10-second rolling buffer for stable readings
- Health Scoring: 1-10 scale based on color analysis
- Alert System: Automatic health concern notifications
- Live Dashboard: Real-time data visualization
- Historical Analysis: Trend tracking and analytics
- WebSocket Updates: Instant data streaming
- Responsive Design: Mobile and desktop compatible
- Health Recommendations: Personalized advice based on readings
- TCS34725 Integration: 16-bit color sensor support
- Serial Communication: Arduino to backend data flow
- SQLite Database: Persistent data storage
- REST API: Comprehensive data access endpoints
- TypeScript: Type-safe development
- Docker Ready: Containerized deployment
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β β β β β β
β Hardware β β Backend β β Frontend β
β β β β β β
β Arduino Uno β β Node.js API β β Next.js Web β
β TCS34725 βββββΆβ TypeScript βββββΆβ React App β
β pH Sensor β β SQLite DB β β Tailwind CSS β
β β β WebSocket β β Real-time UI β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β β β
Serial USB Port 3001 Port 3000
- Arduino reads TCS34725 color sensor and pH sensor
- Serial Communication sends data to backend via USB
- Backend Processing averages pH, classifies color, stores data
- Machine Learning analyzes color using K-means clustering
- WebSocket Streaming pushes real-time updates to frontend
- Dashboard Display shows live health metrics and trends
- Node.js 18+ and npm/pnpm
- Arduino IDE for hardware programming
- TCS34725 Color Sensor and pH sensor (optional for development)
git clone https://github.com/your-username/PUMA.git
cd PUMA# Install all dependencies
npm run install-all
# Start both backend and frontend simultaneously
npm run devThis starts both servers with auto-recompilation:
- Backend: http://localhost:3001
- Frontend: http://localhost:3000
Backend Setup:
cd backend
npm install
npm run build
npm run dev # Development with mock dataFrontend Setup:
cd ../frontend
npm install
npm run dev # Development serverSee TCS34725 Setup Guide for complete hardware integration.
PUMA/
βββ README.md # This file
βββ .gitignore # Git ignore rules
βββ backend/ # Node.js/TypeScript Backend
β βββ src/
β β βββ services/
β β β βββ SerialService.ts # Arduino communication
β β β βββ ColorClassificationService.ts # ML color analysis
β β β βββ DataProcessingService.ts # pH averaging & alerts
β β β βββ DatabaseService.ts # SQLite operations
β β βββ routes/ # REST API endpoints
β β βββ config/ # TCS34725 configuration
β β βββ types/ # TypeScript definitions
β β βββ utils/ # Logging and utilities
β βββ README.md # Backend documentation
β βββ TCS34725_SETUP.md # Hardware setup guide
β βββ package.json
βββ frontend/ # Next.js React Frontend
β βββ app/
β β βββ dashboard/ # Health monitoring dashboard
β β βββ ui/ # Reusable components
β β βββ layout.tsx
β βββ public/ # Static assets
β βββ package.json
βββ hardware/ # Arduino code (future)
βββ arduino_sensors/
| Component | Purpose | Specification |
|---|---|---|
| Arduino Uno/Nano | Microcontroller | USB connection required |
| TCS34725 RGB Sensor | Color measurement | I2C, 3.3V power |
| pH Sensor | Acidity measurement | Analog output |
| Jumper Wires | Connections | Male-to-male |
| USB Cable | Data transmission | Arduino to computer |
TCS34725 Arduino pH Sensor
-------- ------- ---------
VCC β 3.3V VCC β 5V
GND β GND GND β GND
SDA β A4 OUT β A0
SCL β A5
Important: TCS34725 requires 3.3V power, NOT 5V!
-
Install Dependencies
# Backend cd backend && npm install # Frontend cd ../frontend && npm install
-
Environment Configuration
# Backend environment cp backend/.env.example backend/.env -
Database Initialization
cd backend npm run build # Database auto-initializes on first run
-
Build Applications
# Backend cd backend && npm run build # Frontend cd ../frontend && npm run build
-
Start Services
# Backend (production) cd backend && npm start # Frontend (production) cd ../frontend && npm start
Perfect for testing without hardware:
# Terminal 1: Backend with mock TCS34725 data
cd backend
npm run dev
# Terminal 2: Frontend development server
cd frontend
npm run devVisit http://localhost:3000 to see the dashboard with simulated health data.
With Arduino connected:
# Configure Arduino COM port
# Edit backend/.env:
ARDUINO_PORT=COM3 # Windows
# ARDUINO_PORT=/dev/ttyUSB0 # Linux
ARDUINO_AUTO_DETECT=true
# Start backend
cd backend && npm start
# Start frontend
cd frontend && npm start- Real-time Monitoring: View live pH and color readings
- Health Trends: Analyze historical data patterns
- Alert System: Receive notifications for health concerns
- Recommendations: Get personalized hydration advice
GET /health # System health check
GET /api/status # Detailed system statusGET /api/readings/latest # Most recent reading
GET /api/readings # Paginated readings (?limit=100&offset=0)
GET /api/readings/range # Date range query (?start=2024-01-01&end=2024-01-02)GET /api/analytics # Weekly analytics (?days=7)
GET /api/ph/buffer # Current pH buffer statistics
GET /api/clusters # Color classification clustersGET /api/recommendations/:score # Health advice for score (1-10)POST /api/simulate # Simulate reading (development)
POST /api/clusters/retrain # Retrain ML clustersClient β Server:
requestLatestData- Request latest reading
Server β Client:
-
newReading- New processed reading with recommendations -
healthAlert- Health concern notifications -
clustersUpdated- Updated ML clusters -
Normal Range: 4.5-8.5
-
Acidic: < 4.5 (may indicate UTI, ketosis)
-
Alkaline: > 8.5 (may indicate infection)