Online
Edge Layerv1.4.2
Battery72hr
ProtocolBLE 5.0
Sensors4 active

Wearable Layer

Smart Watch

ESP32-based wearable device with biometric sensing, fall detection, GPS tracking, and BLE emergency triggers. Runs independent firmware and functions as a standalone safety device even without smartphone connectivity.

MAX30102

HR + SpO₂ Sensor

Optical heart rate and blood oxygen sensor via PPG. Integrated temperature compensation for accurate outdoor readings.

PPGI2C100Hz

ADXL345

3-Axis Accelerometer

High-resolution accelerometer for activity detection, step counting, and fall detection algorithm input at 400Hz.

±16gSPI400Hz

NEO-6M GPS

Location Tracking

Satellite GPS for outdoor location tracking. Cached last-known position when signal unavailable. Power-gated when indoors.

2.5m CEPUARTPower-gated

BLE 5.0 Stack

GATT · ADV · Notify

Bluetooth LE for data streaming to gateway (MiniPC). Uses GATT notifications for real-time data and advertisements for emergency broadcast.

GATTNotifyADV

Power Manager

1100mAh LiPo · Sleep modes

Dynamic power management: full-rate sampling when active, reduced rate in sleep, GPS power-gated when indoor. 72hr typical life.

Deep sleepPower-gateADC

Emergency Trigger

Fall · Button · BLE alert

Dual-trigger emergency: physical button press (3s hold) or automatic fall detection. Broadcasts via BLE advertisement + MQTT alert.

Interrupt-drivenFail-safeBLE ADV

Sensor Specification Matrix

All sensors connected to ESP32-S3 · I2C bus @ 400kHz

SensorMeasurementRangeAccuracySample Rate
MAX30102Heart Rate + SpO₂HR: 30–250bpm / SpO₂: 70–100%±2bpm / ±1.5%100Hz / 50Hz
ADXL345Acceleration (3-axis)±16g±0.5g400Hz
NEO-6M GPSLatitude / LongitudeGlobal2.5m CEP5Hz
ADC (battery)Battery voltage3.0–4.2V LiPo±10mV1Hz
Push buttonEmergency triggerBinary—Interrupt

MQTT Payload Schema

wearable/payload.json
json
// Wearable MQTT payload schema (JSON)
{
  "device_id": "watch-001",
  "timestamp": "2024-11-15T08:32:14.231Z",
  "vitals": {
    "heart_rate": { "bpm": 72, "confidence": 0.96 },
    "spo2":       { "percent": 97, "confidence": 0.94 },
    "steps":      3420
  },
  "motion": {
    "activity": "walking",  // idle | walking | running | fall
    "fall_detected": false,
    "ax": 0.12, "ay": -0.08, "az": 9.78
  },
  "location": {
    "lat": 24.7136, "lng": 46.6753,
    "accuracy_m": 3.2,
    "source": "gps"  // gps | last_known | unavailable
  },
  "system": {
    "battery_pct": 82,
    "rssi_dbm": -62,
    "firmware": "v1.4.2"
  }
}

Fall Detection Algorithm

firmware/fall_detect.cpp
cpp
// ESP32 fall detection (Arduino C++)
#define FALL_THRESHOLD    2.5f   // g-force spike
#define STILLNESS_PERIOD  2000   // ms after spike
#define SAMPLE_RATE_MS    10     // 100Hz

float magnitude(float ax, float ay, float az) {
  return sqrt(ax*ax + ay*ay + az*az);
}

void IRAM_ATTR accel_isr() {
  float g = magnitude(accel.ax, accel.ay, accel.az);
  
  if (g > FALL_THRESHOLD && !fall_candidate) {
    fall_candidate = true;
    fall_candidate_time = millis();
  }
  if (fall_candidate && millis() - fall_candidate_time > STILLNESS_PERIOD) {
    if (magnitude(accel.ax, accel.ay, accel.az) < 1.2f) {
      trigger_emergency_alert(FALL_DETECTED);
    }
    fall_candidate = false;
  }
}
BLE Connection LifecycleESP32 ↔ MiniPC Gateway
Power On
ADV broadcast
→
Scan
Gateway discovers
→
Connect
GATT pairing
→
Stream
Notify @ 100ms
→
RSSI Drop
Timeout 5s
→
Auto-Reconnect
Exponential backoff