###### Abstract  
Sleep apnea, characterized by breathing interruptions or slow breathing at night, can cause various health issues. Detecting respiratory rate (RR) using Wireless Fidelity (Wi-Fi) can identify sleep disorders without physical contact avoiding sleep disruption. However, traditional methods using Network Interface Cards (NICs) like the Intel Wi-Fi Link 5300 NIC are often costly and limited in channel state information (CSI) resolution. Our study introduces an effective strategy using the affordable ESP32 single-board computer for tracking RR through detailed analysis of Wi-Fi signal CSI. We developed a technique correlating Wi-Fi signal fluctuations with RR, employing signal processing methods--Hamped Filtering, Gaussian Filtering, Linear Interpolation, and Butterworth Low Pass Filtering--to accurately extract relevant signals. Additionally, noise from external movements is mitigated using a Z-Score for anomaly detection approach. We also implemented a local peak function to count peaks within an interval, scaling it to bpm for RR identification. RR measurements were conducted at different rates--Normal (12-16 bpm), Fast (>16 bpm), and Slow (<12 bpm)--to assess the effectiveness in both normal and sleep apnea conditions. Tested on data from 8 participants with distinct body types and genders, our approach demonstrated accuracy by comparing modeled sleep RR against actual RR measurements from the Vernier Respiration Monitor Belt. Optimal parameter settings yielded an overall average mean absolute deviation (MAD) of 2.60 bpm, providing the best result for normal breathing (MAD = 1.38). Different optimal settings were required for fast (MAD = 1.81) and slow breathing (MAD = 2.98). The results indicate that our method effectively detects RR using a low-cost approach under different parameter settings. sleep apnea; respiratory rate measurement; ESP32; channel state information (CSI); digital signal processing +
Footnote †: journal:  
transmission is the Doppler effect [4; 5], highlighting the role of Channel State Information (CSI) as a crucial physical layer metric. CSI helps in analyzing the propagation paths between transmitter and receiver, including any potential obstacles. CSI represents the characteristics of the Wi-Fi signal as it travels from the transmitter to the receiver, interacting with the surrounding environment [6]. This interaction affects the signal, and CSI captures these variations, providing detailed insight into how the signal is modified along its path. CSI is accessible at both the sending and receiving ends, allowing for a comprehensive understanding of the signal's journey. This is crucial because the receiver can also send data back, creating a two-way flow of information. The human body acts as a reflector for radio waves, including Wi-Fi signals [7]. Research studies [8; 9; 10] have shown that the human body significantly influences the CSI by altering the signal's propagation path. This alteration by the human body is crucial for applications that rely on precise understanding of signal behavior. Numerous studies have explored extracting complex features from Wi-Fi signals for monitoring RR. Network Interface Cards (NICs) are commonly used in research for CSI data collection [11]. [PERSON] et al. [12] proposed a multiple signal classification (MUSIC) based system for monitoring breath rates using CSI data collected with Intel Wi-Fi Link 5300 NIC and Linux. [PERSON] et al. [13] details how CSI from NICs can be used to estimate RRs in various environments. [PERSON] et al. [14] monitored respiratory and heart rates utilizing Intel Wi-Fi Link 5300 NIC and two miniPcs having Ubuntu operating software (OS). However, [PERSON] et al. [15] state that Intel Wi-Fi Link 5300 NIC has high deployment costs along with limitations in the resolution of CSI measurements. Furthermore, they highlight that the Atheros-CSI tool, another CSI monitoring solution, also has significant costs and a complex setup process.