---
title: "Wearable Activity + Fall"
description: "The two cores (motionfeatures, falldetect) are host-unit-tested on nativesim/native/64; the full app runs end-to-end on nativesim with synthetic motion (incl. an injected fall). No model ships (stub + deterministic fallback); the fall detector needs no model. HiL on a real wearable + a trained model is bench-gated."
source: https://docs.alplab.ai/sdk/examples/wearable-activity-fall
---

# `wearable-activity-fall`

:::warning[`[UNTESTED]` — v0.9 paper-correct]
The two cores (`motion_features`, `fall_detect`) are host-unit-tested on `native_sim/native/64`; the full app runs end-to-end on native_sim with synthetic motion (incl. an injected fall). No model ships (stub + deterministic fallback); the fall detector needs no model. HiL on a real wearable + a trained model is bench-gated.
:::

Body-worn IMU edge node: read a 6-axis IMU, classify coarse **activity** (idle/walk/run/stairs) with a small NPU model, and detect **falls** with a rule-based 3-phase detector. Targets wearables / elder-care / lone-worker safety.

Source: [`examples/ai/wearable-activity-fall/`](https://github.com/alplabai/alp-sdk/tree/main/examples/ai/wearable-activity-fall).

## Honest scope

Body-worn motion sensing. Detects falls + coarse activity. **Not** medical-grade, not a certified fall alarm, no gait/health diagnostics. The fall detector is a physics heuristic (tunable thresholds: free-fall → impact → stillness), not a guarantee.

## Pipeline

```
ICM-42670 accel+gyro (I2C, 100 Hz, +/-16 g)
  | every sample -> fall_detect (free-fall -> impact -> stillness)
  | 256-sample window -> motion_features (RMS/SMA/cadence/jerk/tilt)
  |   -> <alp/inference.h> activity classifier (deterministic fallback)
  -> WACT record per window
```

The IMU runs at ±16 g so fall impacts (several g) do not clip.

`motion_features.c` runs its window maths on [`<alp/dsp.h>`](https://docs.alplab.ai/sdk/api/dsp): `alp_dsp_stats_f32()` reduces the accel/gyro magnitudes, their AC-coupled residuals, and the jerk series, while a one-stage `ALP_DSP_STAGE_FFT` chain supplies the cadence spectrum. No hand-rolled FFT remains.

## `board.yaml`

```yaml
libraries:
  - name: tflite-micro
    cores: [m55_hp]
  - name: cmsis-dsp
    cores: [m55_hp]

som:
  sku: E1M-AEN801

preset: e1m-evk
supported_boards:
  - e1m-evk
  - e1m-x-evk

pins:
  - { e1m: E1M_I2C0, macro: EVK_I2C_BUS_SENSORS, doc: "ICM-42670 IMU bus" }

cores:
  a32_cluster:
    os: "off"
  m55_hp:
    app: ./src
    inference:
      default_arena_kib: 64
    peripherals:
      - i2c                   # ICM-42670 link.

chips:
  - icm42670                  # 6-axis IMU; accel + gyro.

diagnostics:
  log_level: info
```

A `som.sku` flip to `E1M-V2M101` does not reach the DEEPX DX-M1: the DX-M1 is an A55 / Linux-only backend, and `E1M-V2M101` has only `a55_cluster` and `m33_sm` (no `m55_hp`). An M33 build gets the TFLM CPU kernels; a DX-M1 path needs an A55 / Yocto app.

## Expected output

```
# WACT,t_s,activity,confidence,fall,impact_g
WACT,2.56,WALK,0.91,0,0.0
WACT,12.80,IDLE,0.74,1,4.8
```

## See also

- [`<alp/inference.h>`](https://docs.alplab.ai/sdk/api/inference) · [`<alp/dsp.h>`](https://docs.alplab.ai/sdk/api/dsp) · [`<alp/chips/icm42670.h>`](https://docs.alplab.ai/sdk/chips)
- [`rail-predictive-maintenance`](https://docs.alplab.ai/sdk/examples/rail-predictive-maintenance) — same IMU, infrastructure survey
- [Examples overview](https://docs.alplab.ai/sdk/examples/overview)
