Friday, 9 October 2026

Motion-Aware Personalized Cuffless Blood-Pressure Estimation System

Motion-Aware Personalized Cuffless Blood Pressure Estimation Using ESP32

ESP32-Based ECG and SpO2 Monitoring System - How-to Guide and Editable Circuit | Cirkit Designer
 
 
 
 
ECG With PPG Using Arduino : 9 Steps (with Pictures) - Instructables
 
 
 
 
How to Build a Fitness Wristband Prototype with ESP32 — ESP32 project | Schematik
 
11
 
 

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

GitHub - HB9IIU/ESP32-ISS-Tracker
 
 
 

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.

 
Heart Rate Monitor Kit with AD8232 ECG Sensor Module Kit
 – Indian Hobby Center
 
 
 

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 Heart Rate Oxygen Pulse Sensor
 
 
 

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.

 
Sunfounder GY-521 MPU-6050 6 DOF Gyro Accelerometer IMU - RobotShop
 
 
 

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.

 
0.96 Inch I2C OLED Display Module Blue & Yellow 4-Pin
 
 
 

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

  1. Acquire ECG signals using AD8232.

  2. Acquire optical PPG signals using MAX30102.

  3. Measure movement using MPU6050.

  4. Detect ECG R-peaks and PPG pulse peaks or pulse feet.

  5. Calculate heart rate (HR) from ECG or PPG.

  6. Calculate pulse arrival time (PAT), and estimate PTT only if the required second timing reference is available.

  7. Develop a personalized blood pressure estimation model using calibration measurements.

  8. Reduce motion-related errors by checking signal quality and IMU activity.

  9. Display measurements on the OLED.

  10. 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.

Analog Devices
+2

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 0x57 and 0x68, 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

Automatic ECG Diagnosis Using Convolutional Neural Network | MDPI
 
 
 
 
Frontiers | Analysis on Four Derivative Waveforms of Photoplethysmogram (PPG) for Fiducial Point Detection
 
 
 
 
Unlocking HRV Insights: Smartphone-Based PPG Signal Analysis | by Benjamin Gallois PhD | Medium
 
8
 
 

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:

  1. Read the analog output of the AD8232.

  2. Sample it at a consistent rate.

  3. Remove baseline drift and unwanted high-frequency noise.

  4. Detect each valid R-peak.

  5. 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.

Analog Devices
+1

Your ESP32 can:

  1. Read the red and infrared sample buffers.

  2. Remove slow baseline variation.

  3. Detect the start of each pulse wave, or its peak.

  4. Calculate pulse-to-pulse intervals.

  5. 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:

RR=t2−t1RR=t_2-t_1RR=t2−t1

When time is measured in seconds:

HR=60RR\boxed{HR=\frac{60}{RR}}HR=RR60

Example:

  • First R-peak: 1.00 seconds

  • Next R-peak: 1.80 seconds

  • R–R interval: 0.80 seconds

HR=600.80=75 BPMHR=\frac{60}{0.80}=75\ \text{BPM}HR=0.8060=75 BPM

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.

PAT=tPPG−tECG R\boxed{PAT=t_{\text{PPG}}-t_{\text{ECG R}}}PAT=tPPG−tECG R

For example, if the R-peak occurs at 2.000 s and the chosen PPG pulse-foot point occurs at 2.240 s:

PAT=2.240−2.000=0.240 sPAT=2.240-2.000=0.240\ \text{s}PAT=2.240−2.000=0.240 s

Therefore:

PAT=240 ms\boxed{PAT=240\ \text{ms}}PAT=240 ms

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.

PTT=tdistal pulse−tproximal pulse\boxed{PTT=t_{\text{distal pulse}}-t_{\text{proximal pulse}}}PTT=tdistal pulse−tproximal pulse

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.

Royal Society of Chemistry Publications
+1

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.

DOI
+1

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:

SBP^=a0+a1PAT+a2HR+a3M\widehat{SBP}=a_0+a_1 PAT+a_2 HR+a_3 MSBP=a0+a1PAT+a2HR+a3M
DBP^=b0+b1PAT+b2HR+b3M\widehat{DBP}=b_0+b_1 PAT+b_2 HR+b_3 MDBP=b0+b1PAT+b2HR+b3M

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:

A=ax2+ay2+az2A=\sqrt{a_x^2+a_y^2+a_z^2}A=ax2+ay2+az2

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:

M=StdDev⁡(A)M=\operatorname{StdDev}(A)M=StdDev(A)

You can also include gyroscope magnitude:

G=ωx2+ωy2+ωz2G=\sqrt{\omega_x^2+\omega_y^2+\omega_z^2}G=ωx2+ωy2+ωz2

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

ECGProcessor

ECG filtering and R-peak detection

PPGProcessor

MAX30102 acquisition, pulse detection and quality checks

MotionProcessor

MPU6050 acquisition and motion score

TimingProcessor

ECG–PPG synchronization and PAT calculation

HeartRateProcessor

Heart rate from valid beat intervals

BPModel

Personalized model and calibration parameters

OLEDManager

Display pages and measurement status

AlertManager

Local warnings and notification rules

WiFiManager

Network connection and reconnection

DataLogger

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.h and Adafruit_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.h and HTTPClient.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.

  1. Bench test: Verify each sensor independently, check I²C communication and confirm that the ECG analog signal remains within the ESP32 ADC input range.

  2. Signal test: Collect ECG and PPG simultaneously. Confirm that each ECG R-peak is paired with the appropriate subsequent PPG pulse.

  3. Motion test: Compare signal quality during rest and controlled movement. Confirm that the system rejects unreliable measurements instead of displaying misleading values.

  4. Reference data collection: Collect synchronized sensor features and reference cuff readings using a consistent, ethically appropriate protocol.

  5. Model development: Train the personalized model on one subset of observations and test it on separate observations from the same person.

  6. 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.

  7. 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.

PMC
+1

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.

TDK Product Center
+1

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:

  1. Stage 1: Read AD8232, MAX30102 and MPU6050 data and display HR, PAT and motion status on the OLED.

  2. Stage 2: Implement ECG–PPG synchronization, filtering, peak detection and signal-quality rejection.

  3. Stage 3: Collect paired cuff-reference measurements and develop the personalized BP model.

  4. 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:

PAT=tPPG fiducial−tECG R peak\mathrm{PAT} = t_{\mathrm{PPG\ fiducial}} - t_{\mathrm{ECG\ R\ peak}}PAT=tPPG fiducial−tECG R peak

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:

SBP=a1(1PAT)+b1\mathrm{SBP} = a_1 \left(\frac{1}{\mathrm{PAT}}\right) + b_1SBP=a1(PAT1)+b1
DBP=a2(1PAT)+b2\mathrm{DBP} = a_2 \left(\frac{1}{\mathrm{PAT}}\right) + b_2DBP=a2(PAT1)+b2

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:

BP=a0+a1+a21PTT2\mathrm{BP} = a_0 + \sqrt{a_1 + a_2\frac{1}{\mathrm{PTT}^2}}BP=a0+a1+a2PTT21

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

Component Purpose Notes
ESP32 DevKit V1 Main controller, Wi-Fi/Bluetooth alerts Use 3.3 V logic
AD8232 ECG module ECG acquisition 3-electrode configuration
MAX30102 PPG / pulse signal Finger or earlobe sensor
MPU-6050 Accelerometer + gyroscope Motion and posture detection
0.96-inch SSD1306 OLED Local display I2C, address usually 0x3C
Buzzer Audio alert Optional
Push button Calibration / silence alarm Optional
Li-ion battery + TP4056 Portable power Add protection circuit
Electrodes, cables, strap ECG and PPG contact Good skin contact is critical

4. Pin Connection Diagram

Use a common 3.3 V supply and common ground.

ESP32 Pin Connected To Signal
3V3 AD8232 VCC, MAX30102 VIN, MPU-6050 VCC, OLED VCC 3.3 V
GND All module GND pins Common ground
VP / GPIO36 AD8232 OUTPUT ECG analog input
GPIO21 MAX30102 SDA, MPU-6050 SDA, OLED SDA I2C SDA
GPIO22 MAX30102 SCL, MPU-6050 SCL, OLED SCL I2C SCL
GPIO25 Buzzer Alert output
GPIO26 Calibration button Input pull-up
GPIO27 Optional status LED Alert indicator

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

Signal Recommended sampling Filtering
ECG 250–500 Hz Band-pass 0.5–40 Hz; Pan-Tompkins R-peak detection
PPG 100–250 Hz Band-pass 0.5–8 Hz; baseline removal and smoothing
Accelerometer 50–100 Hz Low-pass filter; compute motion magnitude
Gyroscope 50–100 Hz Low-pass filter; detect rotation/movement

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:

amag=ax2+ay2+az2a_{\mathrm{mag}} = \sqrt{a_x^2 + a_y^2 + a_z^2}amag=ax2+ay2+az2

Then compute a short-window standard deviation or high-pass energy:

M=1N∑i=1N(ai−aˉ)2M = \sqrt{\frac{1}{N}\sum_{i=1}^{N}(a_i-\bar{a})^2}M=N1i=1∑N(ai−aˉ)2

Classify each 2–5 second window:

Motion level Condition Action
Rest M<T1M < T_1M<T1 Accept PAT values
Mild motion T1≤M<T2T_1 \le M < T_2T1≤M<T2 Accept only high-quality beats; median filter
Motion artifact M≥T2M \ge T_2M≥T2 Reject PAT/BP update; display “Motion detected”
Sensor loose PPG amplitude low or unstable Alert “Adjust finger sensor”
ECG poor contact No R-peaks / unstable RR Alert “Check ECG electrodes”

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

  1. Read ECG using ADC.

  2. Read MAX30102 IR/Red PPG samples.

  3. Read MPU-6050 acceleration and gyro.

  4. Filter ECG and PPG.

  5. Detect ECG R-peaks.

  6. Detect PPG foot and systolic peak.

  7. Calculate PAT for each matched beat.

  8. Check motion and signal-quality conditions.

  9. Update rolling median PAT.

  10. Estimate SBP and DBP using personalized calibration.

  11. Update OLED.

  12. Send alert if abnormal HR, poor signal, high motion, or BP threshold crossing.

Example Arduino-style pseudocode

cpp
 
#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:

  1. Band-pass filter ECG.

  2. Differentiate.

  3. Square the signal.

  4. Moving-window integrate.

  5. Apply adaptive threshold.

  6. 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

HR=60RR interval in seconds\mathrm{HR} = \frac{60}{\mathrm{RR\ interval\ in\ seconds}}HR=RR interval in seconds60

Use the median of the last 5 RR intervals.

9. Personal Calibration Procedure

This is essential for “personalized” BP estimation.

Calibration protocol

  1. Ask the user to sit quietly for 5 minutes.

  2. Attach ECG electrodes and place MAX30102 on the finger.

  3. Keep the hand at heart level.

  4. Measure reference BP using a validated cuff BP monitor.

  5. Record 30–60 seconds of ECG, PPG, and IMU data.

  6. Compute median PAT during the measurement.

  7. Repeat after light exercise, such as 2–3 minutes of stepping or walking, once HR and BP have begun changing.

  8. Take another cuff reading and record PAT.

  9. Repeat until you have at least 5–8 reference BP/PAT pairs spanning a useful BP range.

  10. 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:

xi=1000PATix_i = \frac{1000}{\mathrm{PAT}_i}xi=PATi1000

where PAT is in milliseconds.

Fit:

SBPi=a1xi+b1\mathrm{SBP}_i = a_1x_i + b_1SBPi=a1xi+b1
DBPi=a2xi+b2\mathrm{DBP}_i = a_2x_i + b_2DBPi=a2xi+b2

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

Reading Cuff SBP Cuff DBP Median PAT 1000/PAT1000/\mathrm{PAT}1000/PAT
1 118 76 220 ms 4.55
2 124 79 210 ms 4.76
3 131 84 198 ms 5.05
4 138 88 188 ms 5.32
5 145 92 178 ms 5.62

10. OLED Display Layout

Example display:

text
 
Motion-Aware BP Monitor ------------------------ HR : 78 bpm PAT : 212 ms SBP : 124 mmHg DBP : 81 mmHg Motion : LOW Signal : GOOD Status : Monitoring

During bad signal:

text
 
WARNING Motion detected BP estimate paused Adjust sensors

11. Alert Conditions

Send alerts through Blynk, MQTT, Telegram, Firebase, or a local Wi-Fi web server. MQTT is a good choice for IoT projects.

Condition Alert
HR < 50 bpm or > 120 bpm for 30 s Abnormal heart rate
SBP > 140 mmHg or DBP > 90 mmHg repeatedly Possible elevated BP
SBP < 90 mmHg or DBP < 60 mmHg repeatedly Possible low BP
Motion artifact for > 10 s Movement detected
ECG leads disconnected Check ECG electrodes
PPG signal absent Check finger sensor
Calibration missing Run calibration
Sudden large PAT change Possible posture/sensor change

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:

json
 
{ "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 MAX30105 or SparkFun MAX3010x

  • MPU6050_light or Adafruit MPU6050

  • PubSubClient for MQTT

  • WiFi.h

  • Preferences.h for saving calibration constants

14. Project Block Diagram

text
 
+----------------+ 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 / Cloud

15. 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:

MAE=1n∑i=1n∣BPest,i−BPref,i∣\mathrm{MAE} = \frac{1}{n}\sum_{i=1}^{n}| \mathrm{BP}_{est,i} - \mathrm{BP}_{ref,i} |MAE=n1i=1∑n∣BPest,i−BPref,i∣
RMSE=1n∑i=1n(BPest,i−BPref,i)2\mathrm{RMSE} = \sqrt{\frac{1}{n}\sum_{i=1}^{n}(\mathrm{BP}_{est,i} - \mathrm{BP}_{ref,i})^2}RMSE=n1i=1∑n(BPest,i−BPref,i)2

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