Week14

Week 14 Progress: Data Analysis and Final Testing Improvements

Objective:

The primary goal of Week 14 was to complete a comprehensive round of performance tests on the ankle monitoring system and to conduct a thorough analysis of the collected sensor data. Emphasis was placed on evaluating the system’s ability to detect swelling through trend analysis, as well as verifying the accuracy of filtering techniques in eliminating short-term noise. Alongside empirical testing, the effectiveness of the core embedded logic written in C++ was further validated.


Implementation:

A key element of the test was real-time monitoring of ADC (Analog-to-Digital Converter) output values from the flex sensor under simulated swelling conditions. The image below shows the plotted sampled ADC values and their corresponding filtered values (exponentially smoothed):

From this graph, we can observe two trends:

  • The blue line shows raw sampled data, which fluctuates significantly due to ambient noise, flex inconsistency, and subtle movements.

  • The orange dotted line, however, represents the filtered value, calculated using an Exponential Moving Average (EMA). It reflects a much smoother, clearer downward trend corresponding to simulated ankle swelling.

  • The dashed regression line over the raw data also confirms an overall decline in signal, but it’s less immediately readable than the EMA-filtered values.

This proves the filtering pipeline’s effectiveness in highlighting long-term physiological trends over noisy raw input.

In firmware design, two EMA filters are implemented:

      1.Short-term EMA (line 91):

    emaValue = emaAlpha * rawValue + (1 - emaAlpha) * emaValue;
  • Smoothing factor emaAlpha = 0.2
  • Captures fast but small fluctuations to reflect momentary bend or minor swelling.

     2. Long-term EMA (line 100):

    longTermFiltered = longTermAlpha * currentSample + (1 -            longTermAlpha) * longTermFiltered;
  • With longTermAlpha = 0.1, this targets macro trends, such as sustained swelling.
  • Only sampled every 15 seconds to mimic real-world swelling progression.

state machine transitions between MOVING and STATIONARY states. When stationary, the system looks for three consecutive downward-trending EMA values, triggering an alarm if detected:

    if (trendWindow[i-3] > trendWindow[i-2] > trendWindow[i-1]) {
        alarmTriggered = true;
    }

This logical block acts as a trend-based early warning mechanism.

Results:

  • EMA-filtered ADC values offer a clearer indication of downward trends versus noisy raw data.

  • Testing confirms that the trend detection logic effectively identifies swelling when stable readings are sustained.

  • The ADC chart shows visible correlation between increased flex resistance and decreased voltage—an indicator of swelling.

  • Overall, the embedded logic successfully fulfills the project’s original goal of trend-based early detection in wearable healthcare.




Comments

Popular posts from this blog

Week9

Week1