Introduction
In recent years, there has been a growing interest in monitoring vital signs such as heart rate using wearable devices. Heart rate monitoring can provide valuable insights into one’s health and fitness levels, and it is now possible to easily integrate this functionality into a variety of projects using microcontrollers like Arduino.
In this article, we will explore how to interface a “MAX30100 Heart Rate Monitoring Sensor” with an Arduino board and use it to measure and display real-time heart rate data.
What is MAX30100 Heart Rate Monitoring Sensor?
The MAX30100 Heart Rate Monitoring Sensor is a low-cost, high-performance, integrated sensor module for pulse oximetry and heart rate monitoring. It combines two LEDs, a photodetector, optimized optics, and low-noise analog signal processing to detect pulse oximetry and heart rate signals.
Hardware Components
To interface a MAX30100 Heart Rate Sensor with Arduino, you’ll need the following hardware components to get started:
Components | Value | Qty |
---|---|---|
Arduino UNO | – | 1 |
USB Cable Type A to B | – | 1 |
DC Power for Arduino | – | 1 |
Heart Rate Oximeter Sensor Module | MAX30100 | 1 |
16×2 LCD Display | – | 1 |
Potentiometer | 10KΩ | 1 |
Breadboard | – | 1 |
Jumper Wires | – | 1 |
Heart Rate Monitoring MAX30100 Sensor Pinout
PIN | FUNCTION |
VIN | 3.3V DC Input Voltage |
SCL | I2C Serial Clock Input |
SDA | I2C Bidirectional Serial Data |
INT | Active Low Interrupt (Open Drain) |
IRD | Cathode connection for IR LED and LED Driver (Leave floating in the circuit) |
R0 | Cathode connection for Red LED and LED Driver (Leave floating in the circuit) |
GND | Analog Ground |
MAX30100 Heart Rate Monitor Circuit
Make connections according to the circuit diagram given below.
Arduino | MAX30100 Sensor | 16×2 LCD |
---|---|---|
3v3 | VCC | |
GND | GND | |
A4 | SDA | |
A5 | SCL | |
D8 | RS | |
D9 | E | |
D10 | D4 | |
D11 | D5 | |
D12 | D6 | |
D13 | D7 |
Installing Arduino IDE
First, you need to install Arduino IDE Software from its official website Arduino. Here is a simple step-by-step guide on “How to install Arduino IDE“.
Installing Libraries
Before you start uploading a code, download and unzip the following libraries at /Program Files(x86)/Arduino/Libraries (default), in order to use the sensor with the Arduino board. Here is a simple step-by-step guide on “How to Add Libraries in Arduino IDE“.
Code
Now copy the following code and upload it to Arduino IDE Software.
Arduino Code for Heart Rate Monitoring
#include <Wire.h>
#include "MAX30100_PulseOximeter.h"
#include <LiquidCrystal.h>
#define UPDATE_TIME 1000
// variables and pin defination
const int rs = 8, en = 9, d4 = 10, d5 = 11, d6 = 12, d7 = 13;
byte heart [8] = {0b00000, 0b01010, 0b11111, 0b11111, 0b11111, 0b01110, 0b00100, 0b00000};
uint32_t previous_update_time = 0;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
PulseOximeter pulse;
void on_pulse_detected()
{
Serial.println("Pulse Detected!");
}
void setup() {
Serial.begin(115200);
Serial.print("Initializing Pulse Oximeter..");
lcd.createChar(2, heart);
lcd.begin(16, 2);
lcd.clear();
lcd.setCursor(2, 0);
lcd.print("Initializing");
lcd.setCursor(1, 1);
lcd.print("Pulse Oximeter");
delay(3000);
if (!pulse.begin()) {
Serial.println("Sensor begin Failed");
for (;;);
} else {
Serial.println("Sensor begin Success");
}
//set current
pulse.setIRLedCurrent(MAX30100_LED_CURR_7_6MA);
// for the pulse detection
pulse.setOnBeatDetectedCallback(on_pulse_detected);
}
void loop() {
pulse.update();
if (millis() - previous_update_time > UPDATE_TIME) {
// Display Result on LCD
lcd.clear();
lcd.setCursor(0, 0);
lcd.write((uint8_t)2);
lcd.print(" Rate:");
lcd.print(pulse.getHeartRate());
lcd.print("bpm");
lcd.setCursor(0, 1);
lcd.print(" SpO2 :");
lcd.print(pulse.getSpO2());
lcd.print("%");
previous_update_time = millis();
// Display Result on Serial Monitor
Serial.print("Heart ❤ Rate:");
Serial.print(pulse.getHeartRate());
Serial.println("bpm");
Serial.print(" SpO2 Level :");
Serial.print(pulse.getSpO2());
Serial.println("%");
previous_update_time = millis();
}
}
Code Explanation
This Arduino code demonstrates how to interface a MAX30100 heart rate monitoring sensor with an Arduino board and display real-time heart rate data on an LCD screen.
First, the necessary libraries are included and the pins for the LCD screen are defined. A custom character for displaying a heart symbol is also defined.
Next, the setup function initializes the pulse oximeter sensor and the LCD screen. If the sensor initialization is successful, the IR LED current is set and a callback function for pulse detection is set.
In the loop function, the pulse.update() function is called to update the pulse oximeter sensor data. The heart rate and SpO2 data is then displayed on the LCD screen and serial monitor, with the update time set to 1000ms.
Finally, the on_pulse_detected() function is called when a pulse is detected, which simply prints a message to the serial monitor.
Overall, this code provides a basic framework for interfacing the MAX30100 sensor with an Arduino board and displaying heart rate data, which can be further developed for various health and fitness applications.
Applications
- Fitness trackers and activity monitors
- Smartwatches and wearable devices
- Medical monitoring and diagnostic equipment
- Sleep tracking and analysis devices
- Stress and anxiety monitoring devices
- Gaming and virtual reality applications for measuring heart rate variability
- Sports and athletic training devices for measuring heart rate during exercise
- Personal health and wellness devices for tracking heart rate trends over time
- Remote patient monitoring systems for monitoring heart rate and other vital signs from a distance.
Conclusion
interfacing a MAX30100 heart rate monitoring sensor with an Arduino board is a relatively simple process that opens up a world of possibilities for monitoring and analyzing heart rate data. Whether you are developing a fitness tracker, a medical device, or simply looking to incorporate heart rate monitoring into your project, the MAX30100 sensor and Arduino board combination provide a flexible and cost-effective solution.