Heart rate is a fundamental indicator of mental health, with heart rate variability (HRV) playing a particularly significant role. HRV refers to the variation in time intervals between heartbeats, reflecting autonomic nervous system function and overall physiological resilience. It is measured using time-domain, frequency-domain, or non-linear methods. Higher HRV is associated with greater adaptability and lower stress levels, while lower HRV is linked to conditions such as PTSD, depression, and anxiety disorders.
Studies have shown that HRV differs between healthy individuals and those with PTSD. In a resting state, people with PTSD typically exhibit lower HRV compared to healthy controls. When exposed to emotional triggers, their HRV may decrease even further, indicating heightened sympathetic nervous system activation and reduced parasympathetic regulation. Bessel van der Kolk’s work in “The Body Keeps the Score” highlights how trauma affects autonomic regulation, leading to dysregulated physiological responses under stress.
There are two primary methods for measuring heart rate: electrocardiography (ECG) and photoplethysmography (PPG).
Feature | ECG | PPG |
Measurement Principle | Uses electrical signals produced by heart activity | Uses light reflection to detect blood flow changes |
Accuracy | Gold standard for medical HR monitoring | Uses ECG as reference for HR comparison |
Heart Rate (HR) Measurement | Highly accurate | Suitable for average or moving average HR |
Heart Rate Variability (HRV) | Can extract R-peak intervals with millisecond accuracy | Limited by sampling rate, better for long-duration measurements (>5 min) |
Time to Obtain Reading | Quick, no long settling time required | Requires settling time for ambient light compensation, motion artifact correction |
pic | sensor name | link | price | what it measures | specification | features | usage case |
Gravity: Analog Heart Rate Monitor Sensor (ECG) for Arduino | buy | $19.90 | electrical activity of the heart | Input Voltage: 3.3-6V (5V recommended)Output Voltage: 0-3.3VInterface: AnalogOperating current: <10mA | Heart Rate Monitor Sensor x1Sensor cable – Electrode Pads (3 connector) x1Biomedical Sensor Pad x6 | https://emersonkeenan.net/arduino-hrv/ | |
Gravity:Analog/Digital PPG Heart Rate Sensor | buy | $16.00 | blood volume changing | Input Voltage (Vin): 3.3 – 6V (5V recommended) Output Voltage: 0 – Vin (Analog), 0/ Vin (Digital) Operating current: <10mA | Analog (pulse wave) & Digital(heart rate), configurable output | https://www.dfrobot.com/blog-767.html | |
MAX30102 PPG Heart Rate and Oximeter Sensor | buy | $21.90 | blood volume changing + blood oxygen saturation | Power Supply Voltage: 3.3V/5VWorking Current: <15mACommunication Method: I2C/UARTI2C Address: 0x57 | https://community.dfrobot.com/makelog-313158.html | ||
Fermion: MAX30102 PPG Heart Rate and Oximeter Sensor | buy | $15.90 | blood volume changing + blood oxygen saturation | Power Supply: 3.3VWorking Current: <15mACommunication: I2C/UARTI2C Address: 0x57 | https://community.dfrobot.com/makelog-311968.html | ||
SparkFun Single Lead Heart Rate Monitor | buy | $21.50 | electrical activity of the heart | Operating Voltage – 3.3VAnalog OutputLeads-Off DetectionShutdown PinLED Indicator | no electrodes extra cables cost $5.50 extra electrodes $8.95 | https://anilmaharjan.com.np/blog/diy-ecg-ekg-electrocardiogram | |
Sparkfun: Pulse Sensor | buy | $26.95 | blood volume changing | Input Voltage (VCC) – 3V to 5.5VOutput Voltage – 0.3V to VCCSupply Current – 3mA to 4mA | https://microcontrollerslab.com/pulse-sensor-esp32-tutorial/ | ||
SparkFun Pulse Oximeter and Heart Rate Sensor | buy | $42.95 | blood volume changing + blood oxygen saturation | I2C interface I2C Address: 0x55 | https://github.com/sparkfun/SparkFun_Bio_Sensor_Hub_Library | ||
Keyestudio AD8232 ECG Measurement Heart Monitor Sensor Module | buy | 9,25€ | electrical activity of the heart | Power voltage:DC 3.3VOutput:analog outputInterface(connect RA, LA, RL): 3PIN, 2.54PIN or earphone jack | https://wiki.keyestudio.com/Ks0261_keyestudio_AD8232_ECG_Measurement_Heart_Monitor_Sensor_Module |
ECG records the electrical activity of the heart using electrodes placed on the skin, providing high accuracy in detecting R-R intervals, which are critical for HRV analysis. PPG, in contrast, uses optical sensors to detect blood volume changes in peripheral tissues, such as fingertips or earlobes. While PPG is convenient and widely used in consumer devices, it is more susceptible to motion artifacts and may not provide the same precision in HRV measurement as ECG.
Additionally, some PPG sensors include pulse oximetry functionality, measuring both heart rate and blood oxygen saturation (SpO2). One such sensor is the MAX30102, which uses red and infrared LEDs to measure oxygen levels in the blood. The sensor determines SpO2 by comparing light absorption in oxygenated and deoxygenated blood. Since oxygen levels can influence cognitive function and stress responses, these sensors have potential applications in mental health monitoring. However, SpO2 does not provide direct information about autonomic nervous system function or HRV, making ECG a more suitable method for this project.
For this project, ECG is the preferred method due to its superior accuracy in HRV analysis. Among available ECG sensors, the AD8232 module is a suitable choice for integration with microcontrollers such as Arduino. The AD8232 is a single-lead ECG sensor designed for portable applications. It amplifies and filters ECG signals, making it easier to process the data with minimal noise interference. The module includes an output that can be directly read by an analog input pin on an Arduino, allowing real-time heart rate and HRV analysis.
HRV is calculated based on the time intervals between successive R-peaks in the ECG signal. One of the most commonly used HRV metrics is the root mean square of successive differences (RMSSD), which is computed using the formula:
where RRi represents the ith R-R interval, and N is the total number of intervals. Higher RMSSD values indicate greater parasympathetic activity and better autonomic balance. Among ECG sensors available on the market, the Gravity: Analog Heart Rate Monitor Sensor (ECG) is the most suitable for this project. It is relatively inexpensive, includes electrode patches in the package, and has well-documented Arduino integration, making it an optimal choice for HRV measurement in experimental and practical applications.