Jump to content

Heart rate display based on Arduino and LCD


Recommended Posts

Brief introduction

Some time ago, I found a heart rate sensor module MAX30100. This module can collect 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 for monitoring blood pressure.

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 7-inch LCD serial port display module

4. MAX3232 module

Connection

2059402386_lcd-arduino-project(9).thumb.jpg.44f1ec290ee34bfefe213815d79b2305.jpg

GUI design

1971724342_lcd-arduino-project(12).thumb.jpg.ea9846cb6529eef62c077e77c1b453ba.jpg

Part of code

#include

#include "MAX30100_PulseOximeter.h"

 

#define REPORTING_PERIOD_MS 1000

 

// 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");

for(;;);

} else {

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("%");

 

tsLastReport = millis();

}

}

Results demo

1345900071_lcd-arduino-project(21).jpg.91b3026d467d8dd77e2cbe2307956ff1.jpg

45147355_lcd-arduino-project(22).jpg.97cb16b007142a215923950b3765b9c3.jpg

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...