# Leveraging IoT Devices for Atrial Fibrillation Detection: A Comprehensive Study of AI Techniques
## 2 Materials and Methods  
### Dataset and Pre-Processing  
To prototype the acquisition of PPG signals using an IoT device, a Pulse Sensor connected to an Arduino board is suitable [17], as depicted in Figure 1. With the sensor in place, we can collect signals from various patients over an extended period. While this setup demonstrates the feasibility of acquiring PPG signals in real-time using low-cost hardware, to minimize reliance on private datasets and ensure the reproducibility of our results, we utilized the MIMIC PERform AF Dataset [21], a well-known and widely referenced resource in the literature. Although consumer devices, such as smartwatches and fitness trackers, can also acquire PPG signals minimally obtrusively, the MIMIC dataset provides a controlled environment for signal acquisition, ensuring consistency in the data used for training and testing our models.  
The chosen dataset includes recordings from 35 adults in intensive care units (ICUs) during routine care, including 19 subjects with atrial fibrillation (AF) and 16 control subjects. Each participant contributed a 20-minute PPG recording sampled at 125 Hz. These data are extracted from the MIMIC-III Waveform Database [22; 23], which contains thousands of recordings of multiple physiologic signals collected from bedside patient monitors of adults (aged 16 years or older) admitted to ICUs between 2001 and 2012.  
Several data preprocessing steps applied to PPG signals are essential for enhancing signal quality, which is crucial for accurate atrial fibrillation (AF) detection and analysis. The techniques utilized [24; 25] include windowing, band-pass filtering, baseline correction, normalization, and artifact removal. The entire preprocessing pipeline is illustrated in Figure 2.  
In detail, the PPG signals were initially segmented into non-overlapping 15-s windows. This was a critical step for capturing the temporal variations essential for identifying atrial fibrillation (AF)-related features. To ensure the robustness and reliability of the dataset, any windows containing missing values were excluded from further analysis. This resulted in a refined dataset comprising 2722 clean window samples. Subsequently, a band-pass filter with a cutoff frequency of 5.5 Hz was applied to the PPG signals. This filtering process was vital for preserving cardiovascular-related frequency components while effectively removing unwanted noise, thereby enhancing the quality of the data for subsequent examination.  
To improve the clarity of the pulse waveforms, baseline drift and low-frequency components were eliminated using a polynomial fitting technique of degree five. This approach effectively mitigated these unwanted elements from the signals. Additionally, to facilitate consistent comparisons across different subjects and recordings, a normalization process was applied to standardize the amplitudes of the PPG signals. Finally, an artifact removal procedure was implemented to further enhance data quality. This involved identifying and removing extreme data points based on a threshold-based method. This comprehensive preprocessing strategy significantly refined the dataset, preparing it for subsequent analysis and ensuring the integrity of the results.  
Figure 1: IoT Devices for PPG Acquisition: PulseSensor and Arduino Board.