Week10

Week 10 Progress: Exponential Moving Average and Trend Detection


Objective

To apply signal processing techniques to smooth ADC data and detect abnormal trends that may suggest ankle swelling. The techniques include:

  1. Short-term smoothing using EMA (Exponential Moving Average)

  2. Long-term trend detection by evaluating the slope of consecutive filtered values


What is EMA?


The Exponential Moving Average is a recursive smoothing filter calculated by:

EMAt=αXt+(1α)EMAt1​

Where:

  • XtX_{t} is the current data point

  • α\alpha is the smoothing constant (0 < α < 1)

A lower α means stronger smoothing but slower response.


Implementation Details

1. Short-Term EMA (Real-Time Filtering)

  • Applied on 200 averaged samples every 2 seconds.
  • Removes noise from breathing, minor twitches, or slight sensor jitter.
2. Long-Term EMA (Trend Filter)

  • Samples are further passed through another EMA with a lower alpha (0.1) for trend detection.

Trend Detection Logic

When the system is in the STATIONARY state, the firmware tracks the slope of filtered values every 15 seconds.

If three consecutive values form a strictly decreasing sequence, swelling is assumed:

  • A trend window is maintained using a sliding array.
  • If conditions are met, alarmTriggered = true.

Results

ModuleOutcome

EMA filter

Real-time signal became significantly smoother and more stable

Long-term tracking

Allowed safe and low-noise detection of physiological changes
Alarm logic
Only triggered under clear, sustained declines in signal (fewer false positives)

Comments

Popular posts from this blog

Week13

Week9

Week1