Maker Pro
Espruino

ESP32-Based Patient Health Monitoring System with a 7-Inch Smart HMI Display

November 28, 2026 by Rachana Jain
Share
banner

This project demonstrates an ESP32-based health monitoring prototype that collects data from the MAX30102, AD8232, and LM35 sensors and displays the readings on a 7-inch ESP32-P4 Smart HMI Display. It uses two ESP32 controllers connected through an RS485 communication link. An LVGL-based touchscreen dashboard displays heart rate, SpO₂, respiration

A useful monitoring interface should do more than display individual sensor readings. It should bring different measurements together, make them easy to interpret, and allow users to examine how the readings change over time.

For this project, I built a multi-parameter monitoring prototype using an ESP32 DevKit C, three sensors, and a 7-inch ESP32-P4 Smart HMI Display.

The system collects ECG, optical pulse-oximetry, and temperature data on a separate sensor controller. The readings are transmitted to the display through RS485, where an LVGL-based interface presents them in a graphical dashboard.

One interesting aspect of this build is the use of two separate controllers. Instead of making one ESP32 handle both sensor acquisition and graphical processing, the design separates these responsibilities.

Hardware Components

The project uses the following main components:

  • ESP32 DevKit C: Collects and processes the sensor readings on the target side.
  • VIEWE ESP32-P4 Smart HMI Display: Provides the main monitoring interface with a 7-inch touchscreen.
  • MAX30102 Pulse Oximeter Sensor: Uses red and infrared LEDs with a photodetector to obtain optical measurements for SpO₂ estimation.
  • AD8232 ECG Module: Captures the electrical activity of the heart and provides an analog ECG signal.
  • LM35 Temperature Sensor: Provides an analog temperature output with a sensitivity of 10 mV/°C.
  • Two TTL-to-RS485 Converters: Transfer serial data between the sensor controller and display.
  • Two 4.7 kΩ Resistors: Provide external I2C pull-ups for the MAX30102.
  • Breadboard and Jumper Wires: Used for prototyping and making the connections.

Why Use the ESP32-P4 Smart HMI Display?

The display serves as the central interface for viewing the collected measurements. Its larger screen makes it possible to organize several parameters into a single dashboard instead of relying on a small character LCD or OLED.

The main hardware features used in this project include:

  • ESP32-P4 dual-core RISC-V processor running at 400 MHz
  • ESP32-C6 wireless co-processor with Wi-Fi 6 and Bluetooth 5
  • 7-inch MIPI-DSI IPS TFT display with 1024 × 600 resolution
  • Capacitive multi-touch functionality
  • 32 MB PSRAM and 16 MB Flash
  • RS485 interface
  • LVGL graphics library support
  • USB Type-C connectivity

The LVGL library is particularly useful here because it supports graphical elements such as parameter cards, buttons, charts, and waveform displays.

System Architecture: Two ESP32 Controllers

The system is divided into two units.

1. Sensor-side controller

An ESP32 DevKit C acts as the data acquisition controller. It receives information from the three sensors:

  • MAX30102 communicates through I2C.
  • AD8232 provides an analog ECG signal.
  • LM35 provides an analog voltage corresponding to temperature.

The ESP32 processes the readings and prepares responses when it receives measurement requests from the display.

2. Display-side controller

The ESP32-P4 Smart HMI Display acts as the central controller. It requests the required measurements, receives the responses, and updates the graphical interface.

This arrangement keeps sensor acquisition separate from display processing. It also allows the two firmware projects to be developed and maintained independently.

Understanding the Sensors

MAX30102: Optical SpO₂ Measurement

The MAX30102 uses photoplethysmography (PPG) to measure changes in blood volume through optical sensing.

It contains red and infrared LEDs along with a photodetector. The sensor illuminates the fingertip, and the reflected light is measured to obtain optical data.

In this particular implementation, the MAX30102 is used for SpO₂ estimation. Its heart-rate output is not used because the project obtains heart rate separately from the AD8232.

The sensor communicates with the ESP32 through I2C at address 0x57.

Connections:

  • ESP32 3.3V to MAX30102 Vin
  • ESP32 GND to MAX30102 GND
  • ESP32 GPIO 22 to SCL
  • ESP32 GPIO 21 to SDA

An important hardware observation came up while interfacing this module. Some MAX30102 breakout boards have onboard SDA and SCL pull-ups connected to an internal 1.8V regulator. In this build, those two onboard pull-up resistors were removed and external 4.7 kΩ pull-ups were connected to 3.3V. This resolved the I2C detection issue encountered with the module.

AD8232: ECG Signal Acquisition

The AD8232 is a single-lead ECG front-end module. It detects the small electrical signals generated by the heart and provides an analog output that can be sampled by the ESP32 ADC.

Three electrodes are used: RA, LA, and RL. The module also provides LO+ and LO− digital outputs for lead-off detection.

Connections:

  • ESP32 3.3V to AD8232 3.3V
  • ESP32 GND to AD8232 GND
  • ESP32 GPIO 34 to Output
  • ESP32 GPIO 33 to LO−
  • ESP32 GPIO 32 to LO+

The SDN pin is not used in this implementation.

The ECG signal is used for waveform visualization and heart-rate processing. The project also estimates respiration rate from the AD8232 ECG signal rather than using a separate respiration sensor.

LM35: Temperature Measurement

The LM35 is an analog temperature sensor with a linear output scale of 10 mV/°C. Its output voltage is read through an ESP32 ADC input and converted into a temperature value.

Connections:

  • ESP32 5V to LM35 Vcc
  • ESP32 GND to LM35 GND
  • ESP32 GPIO 35 to LM35 Out

Connecting the Controllers Using RS485

The two ESP32 controllers communicate through two TTL-to-RS485 converter modules.

On the sensor side, the ESP32 sends serial data through its UART interface. The first converter changes these UART signals into differential RS485 signals. The data travels through the A+ and B− lines to the second converter, which converts the incoming signals back into UART for the ESP32-P4 display.

Sensor-side ESP32 connections:

  • 3.3V to converter 3.3V
  • GPIO 16 to converter Rx
  • GPIO 17 to converter Tx
  • GND to converter GND

ESP32-P4 display connections:

  • 3.3V to converter 3.3V
  • GPIO 47 to converter Rx
  • GPIO 46 to converter Tx
  • GND to converter GND

Connect the corresponding A+ and B− RS485 terminals between both converters.

RS485 is used here to demonstrate a more expandable communication arrangement. A direct UART connection could also work between one sensor controller and one display. With suitable addressing and communication firmware, the RS485 arrangement can be extended to support multiple sensor-side units connected to a central display.

How the System Works?

The operation follows a request-and-response approach.

First, the sensor-side ESP32 initializes the MAX30102, AD8232, LM35, and UART communication interface. It then waits for commands from the ESP32-P4 display.

When a user opens a measurement screen, the display sends a command through the RS485 link. The sensor-side controller identifies the requested parameter, obtains the corresponding sensor data, and returns a response.

The display receives the response, decodes the data, and updates the relevant dashboard element.

The communication uses a simple command structure:

Command format:

[Slave_Address] [Command]

For example: 01 F1

Response format:

[Slave_Address] [Command] [Status] [Response Data]

The project uses these command codes:

  • 0xF1 – Heart rate: Two bytes, with BPM multiplied by 10. Source: AD8232.
  • 0xF2 – Respiration rate: Two bytes, with breaths per minute multiplied by 10. Estimated from the AD8232 ECG signal.
  • 0xF3 – SpO₂: One byte representing the percentage. Source: MAX30102.
  • 0xF4 – Temperature: Two bytes, with temperature in °C multiplied by 10. Source: LM35.
  • 0xF5 – ECG waveform: 50 signed 16-bit samples. Source: AD8232.

This command-based approach allows the display to request individual measurements instead of continuously receiving every parameter.

Designing the Dashboard with LVGL

The ESP32-P4 display runs an LVGL-based graphical interface.

The main screen presents the monitored parameters, and users can select an individual parameter to open its dedicated screen. Separate views are provided for heart rate, SpO₂, temperature, respiration rate, and ECG waveform.

The display controller requests updated readings over RS485 and refreshes the relevant values and graphs. It also maintains a buffer containing the latest 60 seconds of ECG samples, allowing the waveform to be visualized over time.

The touchscreen makes navigation between these screens straightforward and provides a more interactive experience than a basic text-based display.

Firmware and Development Environment

The project uses separate development environments for the two controllers.

Sensor-side firmware:

  • Arduino IDE version 2.3.9 or above
  • SparkFun_MAX3010x_Sensor_Library version 1.1.2

Display-side firmware:

  • Visual Studio Code version 1.144.0 or above
  • ESP-IDF extension version 2.3.0 or above
  • ESP-IDF version 5.5.5
  • Python version 3.11.2
  • LVGL port version 9.2.3, included in the project source package

The sensor firmware runs on the ESP32 DevKit C, while the display firmware runs on the ESP32-P4 Smart HMI Display.

Testing the Project

After completing the connections and uploading the firmware to both controllers, power on the system.

The ESP32-P4 initializes the LVGL interface and RS485 communication before displaying the main dashboard.

You can then select individual measurement screens:

  • Open the heart-rate screen and connect the AD8232 electrodes to view the calculated heart-rate reading.
  • Place a finger over the MAX30102 sensing area and open the SpO₂ screen to view the estimated oxygen saturation.
  • Open the temperature screen to request the LM35 reading.
  • Select the ECG waveform screen to request and display samples from the AD8232.
  • Open the respiration-rate screen to view the value estimated from the ECG signal.

The display updates the relevant reading or graph after receiving the response from the sensor-side controller.

The detailed project guide, including the complete hardware connections, firmware package, and implementation walkthrough, is available in the original tutorial published on Play with Circuit:

ESP32 Patient Health Monitoring System tutorial

Conclusion

This project brings together biomedical sensor interfacing, ESP32-based data acquisition, RS485 communication, and graphical interface development in one embedded systems application.

The most interesting design decision is the separation of sensor acquisition and display processing across two controllers. It provides a modular structure that can be maintained independently and potentially expanded with additional sensor nodes.

For makers and embedded developers, it is also a practical way to explore how different sensor interfaces and communication technologies can work together with a modern touchscreen HMI.

Disclaimer: This is an educational electronics prototype. Its sensors, algorithms, and measurements have not been clinically validated. It is not intended for medical diagnosis, treatment decisions, or replacement of professional medical advice.

Author

Avatar
Rachana Jain

I'm an avid Arduino and electronics enthusiast with a passion for tinkering, experimenting, and bringing innovative ideas to life.

Related Content

Comments


You May Also Like