Medical equipment for health monitoring is typically costly, but there is an option. Whether you simply want to be aware of your heart rate or are caring for someone with health conditions that must be monitored, there’s an option that you can build yourself.
In this project, we’ll design a portable health monitor that can be used to monitor the vital signs. The device can be used at home or when traveling. It’s built using the following:
- AD8232 ECG sensor
- MLX90614 body temperature sensor
- MAX30100 pulse oximeter
- Heart rate sensor
All of these sensors are relatively low-cost and easily available. The microcontroller used in the project is ESP32. Alternatively, Arduino NANO 33 IoT or any capable microcontroller of a small form factor can be used. The vitals monitored from the sensors are displayed on an SSD1306 OLED screen.
The device is prototyped on a breadboard. It can be hardwired on a perfboard and enclosed in a suitable casing to use as a portable gadget.
- ESP32 x1
- AD8232 ECG sensor x1
- MLX90614 body temperature sensor
- MAX30100 pulse oximeter sensor
- Connecting wires or Dupont wires
AD8232 ECG sensor
AD8232 is a single-lead electrocardiogram (ECG or EKG) sensor designed for monitoring heart activity. Developed by Analog Devices, the AD8232 is commonly used in various applications, including health and fitness devices, medical monitoring equipment, and wearable technology. It’s designed for single-lead ECG monitoring and is suitable for basic heart rate monitoring and rhythm analysis.
The low-power sensor includes integrated analog signal conditioning circuitry, which filters and amplifies the raw ECG signal. The sensor supports various electrode configurations, of which adhesive electrodes on the chest or other convenient locations for single-lead ECG measurement is the most common. The sensor communicates with a microcontroller over an SPI interface.
MLX90614 body temperature sensor
MLX90614 is an infrared thermometer sensor developed by Melexis for non-contact temperature measurements, including body temperature. The sensor is used in many applications, including medical devices, industrial temperature sensing, and consumer electronics.
MLX90614 includes a thermopile sensor for measuring the temperature and a separate ambient temperature sensor. Both sensors work to compensate for the ambient temperature, enhancing the accuracy of temperature measurements. The sensor comes factory-calibrated, simplifying the integration process for easy use. The sensor communicates with a microcontroller through the I2C interface.
MAX30100 pulse oximeter sensor
Developed by Maxim Integrated, the MAX30100 is a versatile sensor module for pulse oximetry and heart-rate monitoring. Its primary function is to measure heart rate and blood oxygen saturation (SpO2). It uses a red LED to measure heart rate and an infrared (IR) LED to measure the SpO2.
A photodetector receives the light transmitted through or reflected from the user’s skin. Ambient light cancellation algorithms eliminate interference from external light sources, ensuring accurate readings. The sensor communicates with a microcontroller through an I2C interface.
To build this monitoring device, we must interface the AD8232 ECG sensor, the MLX90614 body temperature sensor, and the MAX30100 pulse oximeter sensor with ESP32. The SSD1306 OLED must be interfaced with the microcontroller to display the user’s vitals. The AD8232 sensor has an analog output, while MLX90614 and MAX30100 communicate sensor data over an I2C interface.
To interface the AD8232 ECG sensor, connect its 3.3V and GND pins with ESPE32’s 3.3V and GND pins. Next, connect the sensor’s output terminal with one of ESP32’s analog input pin, such as A0.
To interface the MLX90614 sensor, connect its 3.3V and GND pins to ESP32’s 3.3V and GND pins. Connect the MLX90614’s SDA and SCL pins with ESP32’s D21 and D22 pins. Now repeat these same steps for the MAX30100 and SSD1306 sensors (with the I2C interface).
These connections are demonstrated in the below circuit diagram.
The required libraries
Fortunately, we already have libraries to work with the MAX30100 and MLX90614 sensors. The other libraries required include:
- The Adafruit MLX90614 library is required for the MLX90614 sensor.
- The MAX30100_PulseOximeter library for the MAX30100.
- The Adafruit_SSD1306 and Adafruit_GFX libraries are required to work with the SSD1306 OLED display.
If you do not yet have these libraries installed, do so by going to Tools-> Manage Libraries in Arduino IDE. You might need to download the MAX30100_PulseOximeter library from GitHub (use this link) and install the library by going to Sketch-> Include Library -> Add .ZIP Library.
For your convenience, the MAX30100_PulseOximeter library is attached below as a zip file.
How it works
The portable health monitor tracks a user’s pulse rate, oxygen level, body temperature, and heart rate. ESP32 receives the raw ECG value from the output terminal of the AD8232 ECG sensor. This value is obtained at the analog input pin of ESP32. The MLX90614 and MAX30100 sensors communicate their values through the I2C interface.
The values received from both sensors are retrieved through functions from their respective libraries. The MLX90614 transmits the body temperature in Celsius, and the MAX30100 transmits the SPO2 (in percentage) and the heart rate (in BPM) values. The ESP32 measures all of a person’s vitals through these sensors. They’re transmitted to the serial console and displayed on the SSD1306 OLED screen
The sketch begins by importing the Wire.h, Adafruit_GFX.h, Adafruit_SSD1306.h, MAX30100_PulseOximeter.h, and Adafruit_MLX90614.h libraries. The libraries must first be installed via the library manager in Arduino IDE or as a ZIP. Wire.h is required to handle the data communication over the I2C interface. The Adafruit_GFX.h and Adafruit_SSD1306.h libraries are used for the SSD1306 OLED display. The MAX30100_PulseOximeter.h is the library for the MAX30100 body temperature sensor, and the Adafruit_MLX90614.h works with MLX90614 oximeter sensor.
The variables are declared for the pin assignment with the AD8232 sensor and the SSD1306 OLED. An object of the Adafruit_SSD1306 class is instantiated, followed by the instantiation of objects of the PulseOximeter and Adafruit_MLX90614 classes.
In the setup() function, the baud rate for serial debug is set to 115200 bps. The SSD1306 OLED and the MLX90614 sensor are initialized, and if they’re working correctly, a message is transmitted to the serial console. Finally, the pulse oximeter is initialized.
In the loop() function, ESP32 reads values from the AD8232, MAX30100, and MLX90614. The temperature, heart rate, oxygen level, and ECG (raw) values are transmitted to the serial console. The same values are displayed on SSD1306 OLED.
You may also like:
Filed Under: Applications, Medical Electronics, Tech Articles