System Architecture
Hardware, API endpoints, and data flow documentation
IoT Hardware: Arduino Nano 33 BLE Sense Rev2
Board Specifications
| Microcontroller | nRF52840 (ARM Cortex-M4) |
| Clock Speed | 64 MHz |
| Flash Memory | 1 MB |
| SRAM | 256 KB |
| Connectivity | Bluetooth 5.0 LE |
| Operating Voltage | 3.3V |
| Dimensions | 45 x 18 mm |
Onboard Sensors
| IMU (Accelerometer/Gyro) | BMI270 + BMM150 |
| Microphone (PDM) | MP34DT06JTR |
| Temperature/Humidity | HS3003 |
| Barometric Pressure | LPS22HB |
| Light/Proximity/Gesture | APDS-9960 |
Sensor to Metric Mapping
| Metric | Sensor Used | Processing Method | Update Rate | Status |
|---|---|---|---|---|
| cough_count | MP34DT06JTR (PDM Mic) | Audio classification via TinyML model | Per event | ACTIVE |
| steps | BMI270 (Accelerometer) | Peak detection algorithm on Z-axis | Continuous | ACTIVE |
| audio_doctor_count | MP34DT06JTR (PDM Mic) | Keyword spotting (Edge Impulse) | Per event | ACTIVE |
| audio_nurse_count | MP34DT06JTR (PDM Mic) | Keyword spotting (Edge Impulse) | Per event | ACTIVE |
| heart_rate | External: MAX30102 | PPG signal processing | 1 Hz | PLANNED |
| temperature | HS3003 | Direct I2C read | 0.1 Hz | PLANNED |
| spo2 | External: MAX30102 | Red/IR ratio calculation | 1 Hz | PLANNED |
| respiration_rate | BMI270 (Accelerometer) | Chest movement FFT analysis | 0.5 Hz | PLANNED |
REST API Endpoints
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/v1/patients | List all patients with summary stats |
| POST | /api/v1/patients | Create new patient |
| GET | /api/v1/patients/{id} | Get patient details |
| GET | /api/v1/patients/{id}/timeseries | Get time-series data for charting |
| GET | /api/v1/patients/{id}/anomalies | Get anomalies for patient |
| POST | /api/v1/patients/{id}/readings | BLE Device Endpoint - Submit sensor reading |
| GET | /api/v1/analytics/summary | Global analytics summary |
| GET | /api/v1/analytics/trends | Daily trend data |
| POST | /api/v1/chat | RAG-powered AI chat for patient queries |
Data Collection Flow
[Arduino]
Nano 33 BLE Sense
Sensors + BLE
->
[API]
REST API
FastAPI
->
[DB]
SQLite DB
Storage
->
[ML]
ML Models
Anomaly Detection
Future Metrics
Additional metrics planned for future implementation include SpO2, heart rate variability, sleep quality scoring, fall detection, voice stress analysis, and room temperature monitoring.
Technology Stack
Py
Python 3.10+
Backend Language
API
FastAPI
Web Framework
SQL
SQLAlchemy
ORM
Viz
Plotly.js
Visualization
pd
Pandas
Data Processing
np
NumPy
Numerical Computing
sk
Scikit-learn
ML Models
J2
Jinja2
Templates