Motion-Aware Personalized Cuffless Blood Pressure Estimation Using ESP32
Your project is an advanced IoT-based biomedical monitoring system that combines ECG, PPG and motion sensing to estimate blood pressure without using a conventional inflatable blood pressure cuff.
The main idea is to use an ESP32 to acquire physiological signals, calculate heart rate and pulse transit-related timing features, identify movement-related errors, display results on an OLED, and send alerts when abnormal readings or signal-quality problems are detected.
1. Recommended final project title
Motion-Aware Personalized Cuffless Blood Pressure Estimation Using ESP32, ECG, PPG and IMU Sensors with IoT Health Alerts
Alternative academic title:
An IoT-Based Personalized Cuffless Blood Pressure Estimation System Using ECG–PPG Pulse Transit Time and Motion Artifact Compensation.
2. Project overview
ESP32 microcontroller
Main processing and communication unit
Reads the sensors, processes signal data, calculates timing features and heart rate, manages the OLED, and sends measurements to a cloud workflow over Wi-Fi.
AD8232 ECG sensor
Electrical activity of the heart
Captures an ECG waveform. The R-wave detection provides a timing reference for calculating pulse arrival time when synchronized with the PPG signal.
MAX30102 PPG sensor
Optical pulse waveform
Uses red and infrared LEDs with a photodetector to measure changes in light absorption associated with pulsatile blood volume. It supports pulse detection and pulse-wave timing analysis.
MPU6050 IMU sensor
Movement and orientation
Measures three-axis acceleration and three-axis angular velocity. Its data can help identify movement, reject unreliable measurements and select low-motion signal segments.
OLED display
Real-time local interface
Displays heart rate, signal quality, motion state, estimated systolic and diastolic blood pressure when adequately calibrated, and system alerts.
3. Main objectives
-
Acquire ECG signals using AD8232.
-
Acquire optical PPG signals using MAX30102.
-
Measure movement using MPU6050.
-
Detect ECG R-peaks and PPG pulse peaks or pulse feet.
-
Calculate heart rate (HR) from ECG or PPG.
-
Calculate pulse arrival time (PAT), and estimate PTT only if the required second timing reference is available.
-
Develop a personalized blood pressure estimation model using calibration measurements.
-
Reduce motion-related errors by checking signal quality and IMU activity.
-
Display measurements on the OLED.
-
Transmit valid measurements and alerts through Wi-Fi to a dashboard, database or messaging service.
Important scientific distinction: PAT and PTT are not the same. With your listed sensors, ECG plus one peripheral PPG sensor directly provides PAT, not true PTT. This matters for the accuracy and academic validity of the project.
4. Block diagram
Human physiological signals
ECG electrical activity · Peripheral blood-volume pulse · Body movement
AD8232
ECG / R-peaks
MAX30102
PPG / pulse timing
MPU6050
Motion / orientation
ESP32 signal processing
Filtering → peak detection → HR and PAT → motion-quality assessment → personalized BP model
OLED display
Measurements and status
Wi-Fi / IoT
Data logging and alerts
The ESP32 is the central controller. All three sensors provide different types of information, and the processor combines them to decide whether a measurement is reliable enough to display or transmit.
5. Hardware components required
|
Component |
Quantity |
Purpose |
|---|---|---|
|
ESP32 DevKit |
1 |
Processing and Wi-Fi |
|
AD8232 ECG module |
1 |
ECG acquisition |
|
MAX30102 module |
1 |
Optical PPG acquisition |
|
MPU6050 module |
1 |
Motion sensing |
|
0.96-inch I²C OLED, SSD1306 |
1 |
Live display |
|
ECG electrodes and leads |
1 set |
ECG signal pickup |
|
Breadboard and jumper wires |
As required |
Prototyping |
|
USB power supply or suitable battery |
1 |
Power |
|
Cuff-based BP monitor for calibration |
1 |
Reference blood pressure measurements |
The AD8232 is a single-lead ECG front end, the MAX30102 is an optical heart-rate/pulse-oximetry sensor, and the MPU6050 is a six-axis accelerometer/gyroscope.
6. ESP32 wiring connections
The following is a proposed pin assignment for an ESP32 DevKit V1. It is a starting point, not a verified wiring diagram for every breakout-board revision.
|
Module pin |
ESP32 pin |
Function |
|---|---|---|
|
AD8232 OUTPUT |
GPIO 34 |
ECG analog input |
|
AD8232 LO+ |
GPIO 32 |
Optional lead-off detection |
|
AD8232 LO− |
GPIO 33 |
Optional lead-off detection |
|
MAX30102 SDA |
GPIO 21 |
I²C data |
|
MAX30102 SCL |
GPIO 22 |
I²C clock |
|
MPU6050 SDA |
GPIO 21 |
Shared I²C data |
|
MPU6050 SCL |
GPIO 22 |
Shared I²C clock |
|
OLED SDA |
GPIO 21 |
Shared I²C data |
|
OLED SCL |
GPIO 22 |
Shared I²C clock |
|
OLED VCC/GND |
Suitable supply/GND |
Power and ground |
|
MAX30102 VCC/GND |
Per module specifications |
Power and ground |
|
MPU6050 VCC/GND |
Per module specifications |
Power and ground |
|
AD8232 supply/GND |
Per module specifications |
Power and ground |
Important electrical precautions
-
GPIO 34 is input-only, which makes it suitable for reading the ECG analog output.
-
The MAX30102 and MPU6050 share I²C only if their addresses do not conflict with other devices. The usual addresses are
0x57and0x68, respectively; confirm with an I²C scanner. -
ESP32 GPIOs are not 5 V tolerant. Ensure every signal connected to an ESP32 input stays within its permitted voltage range.
-
The bare MAX30102 chip requires 1.8 V and a separate 3.3 V LED supply. Breakout boards vary, so follow the specific module's power and level-shifting design.
Analog Devices+1
Electrical safety: Do not connect a person wearing ECG electrodes to a mains-powered or otherwise non-isolated circuit. For human testing, use a battery-powered, appropriately isolated setup and safe electrode practices. This prototype is not a medical device.
7. Understanding ECG, PPG, HR, PAT and PTT
A. ECG — electrocardiogram
ECG records the heart's electrical activity. In a typical beat, the QRS complex contains the prominent R-peak.
Your processing steps are:
-
Read the analog output of the AD8232.
-
Sample it at a consistent rate.
-
Remove baseline drift and unwanted high-frequency noise.
-
Detect each valid R-peak.
-
Record the timestamp of each peak.
The R-peak is used as a timing reference. It does not directly measure blood pressure.
B. PPG — photoplethysmography
PPG measures changes in light detected through or reflected from tissue as blood volume changes with each pulse.
The MAX30102 supplies red and infrared optical measurements. For pulse timing, the infrared waveform is commonly used, although the best channel and algorithm depend on signal quality and sensor placement.
Your ESP32 can:
-
Read the red and infrared sample buffers.
-
Remove slow baseline variation.
-
Detect the start of each pulse wave, or its peak.
-
Calculate pulse-to-pulse intervals.
-
Check whether the waveform is sufficiently clear for timing analysis.
For PAT, using the PPG pulse foot or rising edge often gives a meaningful arrival-time reference. A peak-based reference is possible but must be defined consistently.
C. HR — heart rate
Heart rate is the number of heartbeats per minute, measured in BPM.
If two consecutive valid ECG R-peaks occur at times t1t_1t1 and t2t_2t2, the R–R interval is:
When time is measured in seconds:
Example:
-
First R-peak: 1.00 seconds
-
Next R-peak: 1.80 seconds
-
R–R interval: 0.80 seconds
In practice, calculate a robust average over several valid beats rather than relying on one interval. Reject missed peaks, duplicate peaks and motion-corrupted segments.
D. PAT — pulse arrival time
PAT is the interval between the electrical activation reference in ECG and the arrival of the peripheral pulse in PPG.
For example, if the R-peak occurs at 2.000 s and the chosen PPG pulse-foot point occurs at 2.240 s:
Therefore:
Use synchronized timestamps and a consistent definition of the PPG reference point. Both signals need sufficient sampling resolution for accurate timing.
E. PTT — pulse transit time
PTT is the time taken by a pulse wave to travel between two arterial measurement sites.
For true PTT, you need two suitably positioned pulse-wave measurement sites, such as two PPG sensors at different locations.
With your current setup — one ECG sensor and one MAX30102 — the directly measurable quantity is PAT, not true PTT. PAT includes both the cardiac pre-ejection period and the subsequent pulse transit interval.
You can either:
-
Keep your current hardware and accurately describe the method as ECG–PPG PAT-based BP estimation; or
-
Add a second pulse sensor at a separate site if direct PTT measurement is an essential research objective.
The MPU6050 is not a second pulse sensor and cannot independently supply a second arterial pulse-wave timestamp.
8. How blood pressure is estimated without a cuff
This is the most important part of the project.
A conventional cuff measures blood pressure using pressure applied to an artery. Your proposed system estimates blood pressure indirectly from physiological signals.
The underlying idea is that changes in arterial stiffness and blood pressure can influence the speed and shape of the arterial pulse wave. PAT, PTT and PPG waveform characteristics can therefore serve as features in a blood pressure estimation model.
However, the relationship is affected by other factors, including pre-ejection period, vascular tone, temperature, age and individual physiology. PAT alone does not provide a universal conversion from milliseconds to mmHg.
Recommended personalized estimation method
Step 1 — Collect reference measurements
Measure blood pressure using a validated cuff-based monitor while simultaneously recording ECG, PPG and motion data. Collect repeated paired observations under a consistent protocol.
Step 2 — Extract signal features
Calculate PAT, heart rate, PPG pulse amplitude, pulse intervals and waveform-shape features. Record motion intensity and signal-quality scores.
Step 3 — Build a personalized model
Fit a model using that individual's reference blood pressure and sensor features. Linear regression is a reasonable research baseline; more complex models can be compared later.
Step 4 — Estimate SBP and DBP
Run the trained model on valid feature windows. Display the estimates only when the model is applicable and the signals meet the quality requirements.
Step 5 — Validate and recalibrate
Compare the estimates with independent reference readings and test whether performance degrades with movement or over time.
What does personalization mean?
Different people may have different relationships between PAT and blood pressure. Personalization means calibrating the estimation model to a specific user instead of assuming that one equation works for everyone.
A simple research model could be:
Here:
-
PATPATPAT is pulse arrival time.
-
HRHRHR is heart rate.
-
MMM represents selected motion or signal-quality features.
-
aia_iai and bib_ibi are coefficients fitted from training data.
-
SBP^\widehat{SBP}SBP and DBP^\widehat{DBP}DBP are estimated systolic and diastolic blood pressure.
These are example model structures, not validated clinical equations. Do not assign arbitrary coefficients or convert PAT directly into a blood pressure value and present it as accurate.
For a first prototype, compare a PAT-only model with a model incorporating HR and PPG features. Add motion features only if they improve performance on independent test data.
9. Motion awareness using MPU6050
Motion awareness is a key feature that differentiates your project from a basic ECG–PPG monitor.
Body movement can disturb ECG electrode contact, change finger pressure on the optical sensor and introduce motion artifacts into PPG. These disturbances can produce incorrect peak detections and unreliable timing features.
The MPU6050 provides:
-
Accelerometer values: ax,ay,aza_x,a_y,a_zax,ay,az
-
Gyroscope values: ωx,ωy,ωz\omega_x,\omega_y,\omega_zωx,ωy,ωz
A. Calculate movement intensity
A basic acceleration magnitude is:
When acceleration is expressed in units of ggg, a stationary sensor typically measures a magnitude near 1g1g1g, because gravity is included.
To estimate movement, remove the slowly varying gravity component or calculate acceleration variation over a window. A simple method is the standard deviation of acceleration magnitude:
You can also include gyroscope magnitude:
These features can be combined into a motion score. Establish the thresholds experimentally for your hardware placement and sampling rate.
B. Motion-aware decision logic
|
Condition |
System action |
|---|---|
|
Low motion + clear ECG + clear PPG |
Accept the measurement window |
|
High motion + distorted PPG |
Mark the estimate unreliable |
|
ECG R-peaks missing or inconsistent |
Reject the timing calculation |
|
PPG pulse not detected reliably |
Reject the timing calculation |
|
Motion stops |
Wait for stable signals, then reacquire |
|
Wi-Fi disconnected |
Continue local monitoring and queue data if memory permits |
Important: Low MPU6050 movement does not guarantee good signal quality. A finger can press differently against the PPG sensor while the IMU remains nearly stationary. Motion sensing must therefore supplement, not replace, ECG and PPG quality checks.
C. Example ESP32 logic
Read ECG, PPG and IMU samples
|
v
Calculate ECG and PPG signal quality
|
v
Calculate motion score
|
v
Are all signals sufficiently reliable?
/ \
No Yes
| |
Show MOTION / Detect R-peaks
POOR SIGNAL and PPG pulse feet
| |
Reject BP estimate Calculate HR and PAT
|
v
Run calibrated model
|
v
Display valid estimate
and transmit data
This is the preferred behavior: when the person moves too much, the system should report “Measurement Unreliable” instead of producing a potentially misleading blood pressure number.
10. ESP32 software architecture
You can develop the firmware in Arduino IDE using separate logical modules.
|
Software module |
Main responsibility |
|---|---|
|
|
ECG filtering and R-peak detection |
|
|
MAX30102 acquisition, pulse detection and quality checks |
|
|
MPU6050 acquisition and motion score |
|
|
ECG–PPG synchronization and PAT calculation |
|
|
Heart rate from valid beat intervals |
|
|
Personalized model and calibration parameters |
|
|
Display pages and measurement status |
|
|
Local warnings and notification rules |
|
|
Network connection and reconnection |
|
|
Timestamped measurements and data transmission |
Recommended sampling and processing
These are starting points for experimentation, not guaranteed optimal settings.
-
ECG: approximately 250–500 samples/second for initial R-peak timing work.
-
PPG: approximately 100–200 samples/second as an initial configuration.
-
IMU: approximately 50–100 samples/second for movement tracking.
-
OLED refresh: a few times per second rather than on every sensor sample.
-
Wi-Fi transmission: send processed summaries periodically rather than blocking the sensor acquisition loop.
The ECG and PPG streams need accurate timestamps and a common time base. If they are read sequentially over I²C and analog ADC, account for sampling delays. Hardware timers, buffered acquisition and non-blocking code are preferable to long delay() calls.
Recommended Arduino IDE libraries
-
Wire.h— I²C communication. -
Adafruit_GFX.handAdafruit_SSD1306.h— compatible SSD1306 OLEDs. -
MAX30105.h— commonly used library interface for MAX30102-compatible devices; verify the library and module configuration. -
An MPU6050 library, such as an appropriate Adafruit or electronic-component library.
-
WiFi.handHTTPClient.h— ESP32 Wi-Fi and HTTP transmission.
The exact library APIs depend on the installed versions. Begin by testing each sensor separately before integrating the signal-processing algorithms.
11. OLED display design
Your OLED can display the live sensor information and the quality of the measurement.
MOTION-AWARE BP
HR
75 BPM
PAT
240 ms
BP
-- / --
SIGNAL: GOOD
MOTION: LOW
Illustrative UI only — not actual sensor data
The example shows a placeholder for blood pressure until the personalized model has been calibrated and validated. An SSD1306 OLED has limited space, so use multiple display pages for detailed information.
Recommended display pages:
-
Page 1: HR, PAT and measurement quality.
-
Page 2: ECG and PPG signal status.
-
Page 3: Estimated SBP/DBP, only when valid.
-
Page 4: Wi-Fi status, alert state and device ID.
Do not display a fixed or randomly generated BP value when calibration has not been completed.
12. Abnormal-condition detection and alerts
Your project can send alerts for several different types of events. It is important to distinguish sensor faults from physiological abnormalities.
|
Event |
Detection method |
Suggested response |
|---|---|---|
|
Poor ECG signal |
Missing or distorted R-peaks |
Show ECG signal warning |
|
Poor PPG signal |
Low-quality waveform or unreliable pulse detection |
Request repositioning of finger |
|
Excessive movement |
IMU motion score above the validated threshold |
Suppress BP estimation temporarily |
|
Invalid PAT |
Missing ECG or PPG timing reference |
Reject measurement |
|
Unusual HR |
Validated HR limits or sustained abnormal pattern |
Display a caution and send an optional notification |
|
Estimated BP outside a configured range |
Calibrated model output and quality checks |
Flag for confirmation with a validated cuff |
|
Sensor disconnected |
I²C error, invalid readings or lead-off detection |
Display sensor fault |
|
Wi-Fi failure |
Connection timeout |
Continue local monitoring and retry transmission |
For the prototype, an abnormal reading should trigger a monitoring alert, not a diagnosis. A cuffless estimate must not be used by itself to decide whether a person has hypertension or needs emergency treatment.
Example alert message
⚠️ MOTION-AWARE HEALTH MONITOR ALERT
Device ID: ESP32_BP_01
Heart Rate: [HR] BPM
Pulse Arrival Time: [PAT] ms
Estimated Blood Pressure: [SBP]/[DBP] mmHg
Motion Status: [LOW / HIGH]
Signal Quality: [GOOD / POOR]
Date: [DATE]
Time: [TIME]
Alert: [ABNORMAL READING / POOR SIGNAL / SENSOR FAULT]
Please confirm any unusual blood pressure reading with a validated blood pressure monitor. This prototype is intended for research and educational monitoring, not medical diagnosis.
13. IoT integration with ESP32
Since the ESP32 has Wi-Fi, you can extend the project with cloud logging and remote alerts.
ESP32 biomedical monitor
ECG · PPG · HR · PAT · IMU motion score · Signal quality
Wi-Fi + HTTP request
Transmit timestamped measurement summaries
n8n webhook automation
Validate payload → store records → evaluate notification rules
Google Sheets
History
Gmail
Email alerts
Telegram
Notifications
Recommended cloud data fields
|
Field |
Example |
|---|---|
|
DEVICE_ID |
ESP32_BP_01 |
|
HEART_RATE_BPM |
75 |
|
PAT_MS |
240 |
|
PPG_QUALITY |
GOOD |
|
ECG_QUALITY |
GOOD |
|
MOTION_SCORE |
Measured value |
|
MOTION_STATUS |
LOW |
|
EST_SBP |
Model output or null |
|
EST_DBP |
Model output or null |
|
BP_MODEL_STATUS |
CALIBRATED / NOT_CALIBRATED |
|
ALERT_STATUS |
NORMAL / POOR_SIGNAL / SENSOR_FAULT |
|
DATE |
Device date |
|
TIME |
Device time |
The example HR and PAT values are illustrative. Your firmware should send actual measurements. Include units in field names or the payload documentation, use synchronized timestamps, and never store an invalid BP estimate as though it were a valid reading.
For your first implementation, I recommend building the sensor acquisition and OLED display first, followed by the n8n webhook and Google Sheets logging. Add email or Telegram notifications after the measurements are reliable.
14. Calibration and testing plan
Personalized cuffless BP estimation is the research component that will require the most work.
-
Bench test: Verify each sensor independently, check I²C communication and confirm that the ECG analog signal remains within the ESP32 ADC input range.
-
Signal test: Collect ECG and PPG simultaneously. Confirm that each ECG R-peak is paired with the appropriate subsequent PPG pulse.
-
Motion test: Compare signal quality during rest and controlled movement. Confirm that the system rejects unreliable measurements instead of displaying misleading values.
-
Reference data collection: Collect synchronized sensor features and reference cuff readings using a consistent, ethically appropriate protocol.
-
Model development: Train the personalized model on one subset of observations and test it on separate observations from the same person.
-
Validation: Evaluate bias, mean absolute error, limits of agreement, repeatability and performance during changes in motion and over time. Do not use training-set accuracy as proof of performance.
-
IoT testing: Check timestamps, disconnected Wi-Fi behavior, missing fields, duplicate uploads and alert delivery.
A recent American Heart Association scientific statement highlights the importance of calibration and ongoing validation for cuffless BP devices. Research performance cannot be assumed to transfer to other people or real-world conditions.
For a student project, use an established BP measurement device as the reference and obtain appropriate supervision and consent for any human-subject testing.
15. Project advantages and limitations
Advantages
-
No inflatable cuff is needed during the intended estimation process.
-
Combines electrical, optical and motion signals.
-
Motion-aware quality checks can reduce unreliable estimates.
-
Local display works independently of cloud connectivity.
-
Wi-Fi supports data logging and remote notifications.
-
Personalized modelling creates a meaningful research component.
Limitations
-
PAT is not equivalent to true PTT.
-
PAT includes pre-ejection period, which can vary independently of blood pressure.
-
The MPU6050 detects movement but does not directly correct all ECG and PPG artifacts.
-
BP estimation requires individual calibration and independent validation.
-
The ESP32's computational and memory constraints may affect the choice of model.
-
Sensor placement, skin contact, temperature and changes in physiology may affect the results.
-
The prototype cannot be assumed to meet medical-device accuracy or safety requirements.
For context, the MPU6050 is listed as obsolete by its manufacturer, so it remains suitable for many educational prototypes but is not necessarily the best choice for a new production design.
16. Final project specification
Motion-Aware Personalized Cuffless BP Monitor
Controller
ESP32
Physiological sensors
AD8232 + MAX30102
Motion sensor
MPU6050
Local interface
OLED display
Core calculations
HR + PAT + signal quality
Research algorithm
Personalized BP model
Connectivity
Wi-Fi + n8n + cloud logging
Safety feature
Motion-aware measurement rejection
17. What I recommend building first
Develop the project in four stages:
-
Stage 1: Read AD8232, MAX30102 and MPU6050 data and display HR, PAT and motion status on the OLED.
-
Stage 2: Implement ECG–PPG synchronization, filtering, peak detection and signal-quality rejection.
-
Stage 3: Collect paired cuff-reference measurements and develop the personalized BP model.
-
Stage 4: Connect ESP32 to n8n, Google Sheets and Telegram/Gmail for remote monitoring and notifications.
The critical point is that Stage 1 can produce real HR and PAT measurements, but valid personalized systolic and diastolic BP estimates require the calibration and validation work in Stage 3.
One important question before I prepare the complete Arduino IDE code and circuit connections: do you want to keep your existing three sensors (AD8232 + MAX30102 + MPU6050) and implement PAT-based BP estimation, or are you planning to add a second PPG sensor for actual PTT-based estimation?
Below is a complete project blueprint for a Motion-Aware Personalized Cuffless Blood-Pressure Estimation System using ESP32, AD8232 ECG, MAX30102 PPG, MPU-6050 IMU, and an OLED display. The core idea is to compute Pulse Arrival Time (PAT) from the ECG R-peak to a PPG fiducial point, use IMU data to reject motion-corrupted beats, and personalize BP estimation using cuff-based calibration.
Important safety note: This is a research/prototype device, not a certified medical blood-pressure monitor. Do not use its BP output for diagnosis or treatment decisions without clinical validation.
1. System Overview
Your system continuously acquires:
-
ECG from AD8232 → detects R-peaks and heart rate.
-
PPG from MAX30102 → detects pulse waveform, pulse rate, and PPG foot/peak.
-
IMU from MPU-6050 → detects motion, posture, and artifact.
-
ESP32 → filters signals, detects beats, calculates PAT/PTT, estimates personalized BP, displays results, and sends alerts.
-
OLED → shows HR, PAT, motion status, estimated SBP/DBP, and warnings.
The ECG R-wave is the proximal timing reference; the finger PPG pulse is the distal timing reference. The interval between them is technically PAT, not true PTT, because PAT includes the pre-ejection period (PEP): PAT=PEP+PTT\mathrm{PAT} = \mathrm{PEP} + \mathrm{PTT}PAT=PEP+PTT.nature+1
2. Working Principle
PAT calculation
For each accepted cardiac cycle:
Common PPG fiducial points are:
-
PPG foot: beginning of systolic upstroke; often more robust.
-
Maximum first derivative: steepest rising edge.
-
PPG systolic peak: easiest to detect but more affected by wave reflection.
Research commonly computes PAT from the ECG R-peak to either the PPG peak or maximum-slope point; both show strong inverse correlation with BP, though the relationship varies between individuals.cinc+1
PTT approximation
True PTT requires a proximal arterial waveform and excludes PEP. With only ECG and finger PPG, you measure PAT. For a student prototype, you can use PAT as a PTT surrogate, but label it clearly as PAT-based BP estimate. PTT is generally preferable for BP estimation because PAT includes variable PEP.nature+1
BP estimation
A practical personalized model is:
Use at least 5–10 cuff readings across resting and mildly elevated BP conditions to fit separate SBP and DBP calibration lines for each user. The inverse relationship between BP and PAT/PTT is well established, but the slope and intercept are person-specific, so calibration is essential.nature+2
A more advanced nonlinear model is:
This has been proposed for subject-specific cuffless BP estimation, but it needs more calibration points and is harder to implement on ESP32.arxiv
3. Hardware Bill of Materials
4. Pin Connection Diagram
Use a common 3.3 V supply and common ground.
AD8232 electrode placement:
-
RA: right arm, below clavicle.
-
LA: left arm, below clavicle.
-
RL: right lower abdomen or right hip; reference/drive electrode.
Keep ECG wires away from the MAX30102 and ESP32 Wi-Fi antenna to reduce noise.
5. Signal Acquisition Settings
A common processing pipeline uses a 0.5–40 Hz ECG band-pass filter and Pan-Tompkins R-peak detection, while PPG is commonly filtered around 0.5–8 Hz before peak/foot detection.nature+1
6. Motion-Aware Processing
This is the key novelty of your project. The MPU-6050 should not merely record motion—it should gate or down-weight unreliable PAT samples.
Motion metric
Compute acceleration magnitude:
Then compute a short-window standard deviation or high-pass energy:
Classify each 2–5 second window:
Set thresholds experimentally. Start with T1=0.15gT_1 = 0.15gT1=0.15g and T2=0.35gT_2 = 0.35gT2=0.35g, then tune for your mounting and user.
Quality rules
Reject a beat if any of these occur:
-
No ECG R-peak found.
-
PPG peak/foot not found.
-
PAT outside plausible range, e.g. 100–500 ms.
-
RR interval outside 300–1500 ms, i.e. roughly 40–200 bpm.
-
PPG amplitude too low or rapidly changing.
-
IMU motion threshold exceeded.
-
PAT differs too much from the rolling median.
Use the median of the last 5–10 valid PAT values rather than a single beat. Literature recommends averaging or taking the median over several beats to reduce respiratory and measurement artifacts.pmc.ncbi.nlm.nih
7. Firmware Pipeline
Main loop
-
Read ECG using ADC.
-
Read MAX30102 IR/Red PPG samples.
-
Read MPU-6050 acceleration and gyro.
-
Filter ECG and PPG.
-
Detect ECG R-peaks.
-
Detect PPG foot and systolic peak.
-
Calculate PAT for each matched beat.
-
Check motion and signal-quality conditions.
-
Update rolling median PAT.
-
Estimate SBP and DBP using personalized calibration.
-
Update OLED.
-
Send alert if abnormal HR, poor signal, high motion, or BP threshold crossing.
Example Arduino-style pseudocode
#include <Wire.h> #include <Adafruit_GFX.h> #include <Adafruit_SSD1306.h> #include "MAX30105.h" #include "MPU6050_light.h" #define ECG_PIN 36 #define BUZZER 25 #define CALIB_BUTTON 26 Adafruit_SSD1306 oled(128, 64, &Wire, -1); MAX30105 ppgSensor; MPU6050 mpu; float ecgBuffer[500]; float ppgBuffer[250]; float ax, ay, az; float patMedian = 0; float sbp = 0, dbp = 0; // Personalized calibration coefficients float sbpA = 0, sbpB = 0; float dbpA = 0, dbpB = 0; void setup() { Serial.begin(115200); Wire.begin(21, 22); oled.begin(SSD1306_SWITCHCAPVCC, 0x3C); oled.clearDisplay(); oled.setTextColor(SSD1306_WHITE); oled.display(); ppgSensor.begin(Wire, I2C_SPEED_FAST); ppgSensor.setup(60, 4, 2, 100, 411, 4096); mpu.begin(); mpu.calcGyroOffsets(); pinMode(BUZZER, OUTPUT); pinMode(CALIB_BUTTON, INPUT_PULLUP); } void loop() { readECG(); readPPG(); readIMU(); bool motionOK = isMotionAcceptable(); bool ecgOK = detectRPeaks(); bool ppgOK = detectPPGFeatures(); if (motionOK && ecgOK && ppgOK) { float pat = calculatePAT(); updatePATMedian(pat); if (isCalibrated()) { sbp = sbpA * (1000.0 / patMedian) + sbpB; dbp = dbpA * (1000.0 / patMedian) + dbpB; } displayData(); checkAlerts(); } else { showWarning(); } delay(10); }8. PAT and HR Detection Logic
ECG R-peak detection
Use a simplified Pan-Tompkins method:
-
Band-pass filter ECG.
-
Differentiate.
-
Square the signal.
-
Moving-window integrate.
-
Apply adaptive threshold.
-
Reject peaks closer than 250 ms to prevent double detection.
PPG fiducial detection
For each R-peak, search the following 50–500 ms window in PPG:
-
Find the PPG foot: local minimum before the rising edge.
-
Find maximum positive slope: maximum of first derivative.
-
Find systolic peak: maximum PPG value in the beat window.
For better robustness, use the maximum-slope point or PPG foot rather than the peak. Studies note that the PPG foot is less affected by wave reflections, while peak-based PAT is easier but can be less stable.nature+1
Heart rate
Use the median of the last 5 RR intervals.
9. Personal Calibration Procedure
This is essential for “personalized” BP estimation.
Calibration protocol
-
Ask the user to sit quietly for 5 minutes.
-
Attach ECG electrodes and place MAX30102 on the finger.
-
Keep the hand at heart level.
-
Measure reference BP using a validated cuff BP monitor.
-
Record 30–60 seconds of ECG, PPG, and IMU data.
-
Compute median PAT during the measurement.
-
Repeat after light exercise, such as 2–3 minutes of stepping or walking, once HR and BP have begun changing.
-
Take another cuff reading and record PAT.
-
Repeat until you have at least 5–8 reference BP/PAT pairs spanning a useful BP range.
-
Fit separate regression lines for SBP and DBP.
Exercise-based calibration is commonly used because it creates a wider BP range for fitting the PAT–BP relationship.arxiv+1
Calibration equations
For each calibration point:
where PAT is in milliseconds.
Fit:
Use least-squares regression on the ESP32 or preferably on a PC/phone app, then store a1,b1,a2,b2a_1,b_1,a_2,b_2a1,b1,a2,b2 in ESP32 NVS/Preferences.
Example calibration data table
10. OLED Display Layout
Example display:
Motion-Aware BP Monitor ------------------------ HR : 78 bpm PAT : 212 ms SBP : 124 mmHg DBP : 81 mmHg Motion : LOW Signal : GOOD Status : MonitoringDuring bad signal:
WARNING Motion detected BP estimate paused Adjust sensors11. Alert Conditions
Send alerts through Blynk, MQTT, Telegram, Firebase, or a local Wi-Fi web server. MQTT is a good choice for IoT projects.
Do not treat a single high/low estimate as an emergency. Require several consecutive valid readings before alerting.
12. Data Packet Format
For Wi-Fi/MQTT transmission:
{ "device_id": "ESP32_BP_01", "timestamp": 1760069100, "hr_bpm": 78.4, "pat_ms": 212.5, "sbp_mmhg": 124.1, "dbp_mmhg": 81.3, "motion_level": "LOW", "signal_quality": "GOOD", "ax": 0.02, "ay": -0.98, "az": 0.17, "ppg_ir": 52341, "ecg_raw": 1832, "alert": false }13. Required Libraries
Install these in Arduino IDE:
-
Adafruit SSD1306 -
Adafruit GFX -
Adafruit MAX30105orSparkFun MAX3010x -
MPU6050_lightorAdafruit MPU6050 -
PubSubClientfor MQTT -
WiFi.h -
Preferences.hfor saving calibration constants
14. Project Block Diagram
+----------------+ ECG electrodes ---> AD8232 ---> ESP32 ADC | Finger ---> MAX30102 ----------> I2C | IMU ------> MPU-6050 -----------> I2C | +--> Signal filtering +--> R-peak / PPG detection +--> Motion gating +--> PAT calculation +--> Personalized BP model | +-------------+--------------+ | | OLED display Wi-Fi / MQTT Alerts / Cloud15. Testing Plan
Stage 1: Sensor validation
-
Verify ECG waveform on Serial Plotter.
-
Verify PPG pulse and HR.
-
Verify IMU reacts to hand/arm movement.
-
Confirm OLED updates.
Stage 2: PAT validation
-
Sit still and record 2 minutes.
-
Check that PAT is stable and physiologically plausible.
-
Compare PAT-based pulse rate with HR from ECG.
-
Confirm PAT decreases slightly after mild exercise for most users.
Stage 3: Calibration validation
-
Collect 5–10 paired cuff BP and PAT readings.
-
Fit SBP and DBP models.
-
Calculate MAE, RMSE, and Bland–Altman limits.
-
Test on a separate day to check calibration drift.
Stage 4: Motion-aware validation
-
Record while sitting still.
-
Record while slowly moving the arm.
-
Record while walking.
-
Confirm the system rejects or flags motion-corrupted PAT values.
16. Evaluation Metrics
For each subject, compare estimated BP with cuff BP:
Also report:
-
Pearson correlation coefficient.
-
Bland–Altman bias and limits of agreement.
-
Percentage of estimates within ±5, ±10, and ±15 mmHg.
AAMI-style guidance is often cited as mean error below 5 mmHg and standard deviation below 8 mmHg, while BHS grading uses cumulative percentages of readings within 5, 10, and 15 mmHg.onlinelibrary.wiley
17. Main Limitations
-
ECG-to-PPG timing is PAT, not true PTT, because it includes PEP. PEP varies with exercise, posture, stress, and cardiovascular condition.nature+1
-
Finger PPG is highly motion-sensitive. Contact pressure, hand height, temperature, and movement can distort the waveform.pmc.ncbi.nlm.nih
-
Calibration drifts over time. Re-calibration is needed after days/weeks, major posture changes, medication changes, illness, or significant fitness changes.pmc.ncbi.nlm.nih
-
A single PAT value cannot reliably give absolute BP. Personal calibration and quality gating are mandatory.
-
This is not a medical device. It can be presented as a prototype for trend monitoring and research.
18. Suggested Project Title Options
-
Motion-Aware Personalized Cuffless Blood Pressure Monitoring Using ECG, PPG, and IMU
-
ESP32-Based Motion-Adaptive PAT/PTT System for Cuffless BP Estimation
-
Wearable Motion-Aware Cardiovascular Monitoring Using ECG, PPG, and IMU
-
Personalized Cuffless Blood Pressure Estimation with Motion Artifact Rejection
19. Abstract You Can Use
This project presents a motion-aware, personalized, cuffless blood-pressure estimation system based on an ESP32 microcontroller. The system simultaneously acquires ECG from an AD8232 sensor, photoplethysmogram signals from a MAX30102 sensor, and motion data from an MPU-6050 IMU. The ESP32 filters the signals, detects ECG R-peaks and PPG fiducial points, and computes pulse arrival time (PAT) for each valid heartbeat. IMU-based motion detection identifies periods of movement and rejects unreliable PAT samples, improving robustness. Heart rate, PPG features, and personalized calibration coefficients are used to estimate systolic and diastolic blood pressure. Results are displayed on an OLED screen, and abnormal heart rate, poor signal quality, excessive motion, or abnormal BP trends trigger alerts through Wi-Fi/MQTT. The proposed system demonstrates a low-cost wearable approach for continuous cardiovascular monitoring, while emphasizing the need for individual calibration and clinical validation.



No comments:
Post a Comment