Posts

Showing posts from December, 2024

Week10

Image
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: Short-term smoothing using EMA (Exponential Moving Average) 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: E M A t = α ⋅ X t + ( 1 − α ) ⋅ E M A t − 1​ Where: X t X_{t} X 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 D...

Week9

Image
Week 9 Progress: State Machine Design and System Modularity Objective To modularize the ankle monitoring code by implementing a two-state state machine (MOVING / STATIONARY) to detect whether the user is currently in motion or in a stable position for trend detection. The goal is to trigger alarm conditions only when reliable stationary measurements are available. Implementation: State Machine Architecture The firmware now uses a simple finite state machine (FSM) with two primary states: MOVING : The user is moving, sensor data fluctuates significantly, and trend evaluation is temporarily disabled. STATIONARY : The user is still. Trend data is collected to determine if ankle swelling is occurring. 📌 Transition Logic: Transition from MOVING → STATIONARY happens when sensor variation over a defined window is small (low deviation). Transition from STATIONARY → MOVING happens when at least 3 significantly different readings appear within the window (indicating movement or p...