Heart rate display based on Arduino and HMI
Posted: Wed Aug 18, 2021 4:00 pm
Arduino LCD display project brief introduction:
Some time ago, I found a heart rate sensor module MAX30100. This module can collect the blood oxygen and heart rate data of users, which is also simple and convenient to use.
According to the data, I found that there are libraries of MAX30100 in the Arduino library files. That is to say, if I use the communication between Arduino and MAX30100, I can directly call the Arduino library files without having to rewrite the driver files. This is a good thing, so I bought the module of MAX30100.
I decided to use Arduino to verify the heart rate and blood oxygen collection function of MAX30100. With STONE TFT LCD screen for monitoring blood pressure.
Note: this module by default only with 3.3 V level MCU communications, because it defaults to using IIC pin pull up the resistance of 4.7 K to 1.8 V, so there is no communication with the Arduino by default, if you want to commune with the Arduino and need two 4.7 K of the IIC pin pull-up resistor connected to the VIN pin, these contents will be introduced in the back of the chapter.
Functional assignments
Before starting this project, I thought about some simple features:
• Heart rate data and blood oxygen data were collected
• Heart rate and blood oxygen data are displayed through an LCD screen
Then the basic electronic materials are determined as follows:
1. Arduino Mini Pro development board
2. MAX30100 heart rate and blood oxygen sensor module
3. STONE STVI070WT-01 LCD serial port display module
4. MAX3232 module
hardware connection
The Arduino Mini Pro development board and STVI070WT TFT-LCD display screen are connected through UART, which requires level conversion through MAX3232, and then the Arduino Mini Pro development board and MAX30100 module are connected through the IIC interface. After thinking clearly, we can draw the following wiring picture:
GUI design
code
Compile the code, download it to the Arduino development board, and you're ready to start testing.
We can see that when the fingers leave the MAX30100, the heart rate and blood oxygen display 0. Place your finger on the MAX30100 collector to see your heart rate and blood oxygen levels in real-time.
Arduino LCD display project effect can be seen in the following picture:
Some time ago, I found a heart rate sensor module MAX30100. This module can collect the blood oxygen and heart rate data of users, which is also simple and convenient to use.
According to the data, I found that there are libraries of MAX30100 in the Arduino library files. That is to say, if I use the communication between Arduino and MAX30100, I can directly call the Arduino library files without having to rewrite the driver files. This is a good thing, so I bought the module of MAX30100.
I decided to use Arduino to verify the heart rate and blood oxygen collection function of MAX30100. With STONE TFT LCD screen for monitoring blood pressure.
Note: this module by default only with 3.3 V level MCU communications, because it defaults to using IIC pin pull up the resistance of 4.7 K to 1.8 V, so there is no communication with the Arduino by default, if you want to commune with the Arduino and need two 4.7 K of the IIC pin pull-up resistor connected to the VIN pin, these contents will be introduced in the back of the chapter.
Functional assignments
Before starting this project, I thought about some simple features:
• Heart rate data and blood oxygen data were collected
• Heart rate and blood oxygen data are displayed through an LCD screen
Then the basic electronic materials are determined as follows:
1. Arduino Mini Pro development board
2. MAX30100 heart rate and blood oxygen sensor module
3. STONE STVI070WT-01 LCD serial port display module
4. MAX3232 module
hardware connection
The Arduino Mini Pro development board and STVI070WT TFT-LCD display screen are connected through UART, which requires level conversion through MAX3232, and then the Arduino Mini Pro development board and MAX30100 module are connected through the IIC interface. After thinking clearly, we can draw the following wiring picture:
GUI design
code
- CODE: SELECT_ALL_CODE
#include
#include "MAX30100_PulseOximeter.h"
#define REPORTING_PERIOD_MS 1000
#define Heart_dis_addr 0x01
#define Sop2_dis_addr 0x05
#define connect_sta_addr 0x08
unsigned char heart_rate_send[8]= {0xA5, 0x5A, 0x05, 0x82,\
0x00, Heart_dis_addr, 0x00, 0x00};
unsigned char Sop2_send[8]= {0xA5, 0x5A, 0x05, 0x82, 0x00, \
Sop2_dis_addr, 0x00, 0x00};
unsigned char connect_sta_send[8]={0xA5, 0x5A, 0x05, 0x82, 0x00, \
connect_sta_addr,0x00, 0x00};
// PulseOximeter is the higher level interface to the sensor
// it offers:
// * beat detection reporting
// * heart rate calculation
// * SpO2 (oxidation level) calculation
PulseOximeter pox;
uint32_t tsLastReport = 0;
// Callback (registered below) fired when a pulse is detected
void onBeatDetected()
{
// Serial.println("Beat!");
}
void setup()
{
Serial.begin(115200);
// Serial.print("Initializing pulse oximeter..");
// Initialize the PulseOximeter instance
// Failures are generally due to an improper I2C wiring, missing power supply
// or wrong target chip
if (!pox.begin()) {
// Serial.println("FAILED");
// connect_sta_send[7]=0x00;
// Serial.write(connect_sta_send,8);
for(;;);
} else {
connect_sta_send[7]=0x01;
Serial.write(connect_sta_send,8);
// Serial.println("SUCCESS");
}
// The default current for the IR LED is 50mA and it could be changed
// by uncommenting the following line. Check MAX30100_Registers.h for all the
// available options.
pox.setIRLedCurrent(MAX30100_LED_CURR_7_6MA);
// Register a callback for the beat detection
pox.setOnBeatDetectedCallback(onBeatDetected);
}
void loop()
{
// Make sure to call update as fast as possible
pox.update();
// Asynchronously dump heart rate and oxidation levels to the serial
// For both, a value of 0 means "invalid"
if (millis() - tsLastReport > REPORTING_PERIOD_MS) {
// Serial.print("Heart rate:");
// Serial.print(pox.getHeartRate());
// Serial.print("bpm / SpO2:");
// Serial.print(pox.getSpO2());
// Serial.println("%");
heart_rate_send[7]=(uint32_t)pox.getHeartRate();
Serial.write(heart_rate_send,8);
Sop2_send[7]=pox.getSpO2();
Serial.write(Sop2_send,8);
tsLastReport = millis();
}
}
Compile the code, download it to the Arduino development board, and you're ready to start testing.
We can see that when the fingers leave the MAX30100, the heart rate and blood oxygen display 0. Place your finger on the MAX30100 collector to see your heart rate and blood oxygen levels in real-time.
Arduino LCD display project effect can be seen in the following picture: