Skip to content

Measure Heart pulses/BPM And Oxygen saturation SpO² with MAX30102 and Arduino



Hello, and welcome to this tutorial where I’m testing another module to measure BPM, after the 1$ module dodgy tests, here we are with another one it’s the MAX30102, I’ll use it to measure my BPM and Pulse oximetry with the help of an Arduino UNO board, and also using an OLED display + Buzzer for a little BPM related project that you can find below.

The MAX30102 is an integrated pulse oximetry and heart-rate monitor biosensor module. It includes internal LEDs, photodetectors, optical elements also i²c compatible and with the help of the SparkFun library it will be easy to measure these parameters, and don’t forget that the module has a built-in temperature sensor and it’s actually very accurate and stable but it’s not meant to measure body temperature.

You can find it in different shapes but the important is the chip used, (I’m using the black one, WAVGAT):

 

Module main chip and different variants of the module.

Hardware:

For this tutorial, I used the module alone with the Arduino to test its functions, and for the project I add an OLED and a buzzer. In case you don’t know how to use the OLED screen or the buzzer check these tutorials:



Wiring:

The MAX30102 Can use the i²c ,so wire it with the Arduino board using the usual A4/A5 with SDA/SCL same with the OLED, the first is powered by 5v and the second by 3.3v, the buzzer is also using 5v/GND and it’s I/O wired with D3, if you’re using 2 pins buzzer: GND with GND and (+) (don’t forget a resistor) with D3.

Wiring.png
Wiring of MAX30102 + OLED + Buzzer with Arduino UNO

Libraries:

If you’re using the module alone download only its library (The first one), the other two are for the OLED display used in the project.

Codes:

Code 1: Library example – HeartBeat_Plotter

 

Code 2:  Library example – SpO2

 

 



Code 3: Library example – Temperature_Sense

 

Code 4: Heart rate measuring and display on OLED + buzzer sound

The code I’ve used that works with the OLED and Buzzer, it’s a modified version of “HeartRate” code. Download the code here, or see below:

 

Test:

After wiring the components, upload the code.

Test_1.jpg
It asks you to place your finger

Put your finger on the sensor, relax for a while until you hear the buzzer is synchronized with your heart beats, or you see that the heart pictures change following your heart beats.

Test_2.jpg
And the measure should be okay



Making a BPM picture:

Both hearts are BPM pictures and in the code you’ll see them as this format:

ImagesBPM
BPM pictures stored on the Arduino Flash memory

To make them you can follow Adafruit tutorial or continue here:

First thing to do is to make a 2 colors picture (Black with White background is better) and don’t forget to scale it (my OLED is 128×32 px) some are (128×64) so you should stay at this limits.

Pics hearts
From PNG to Monochrome BMP

For the project I took two different heart pictures, scale them and most important !!

They must be “Monochrome Bitmap” you can save them as this format from you picture editing software or just “MS Paint”

paint pic.png
Pics format

Once you have the picture scaled and in the right format open the LCD Assistant (Download and unzip)

LCDAssist1
Open the LCD Assistant
LCDAssist2
Load your picture
LCDAssist3
Note the Width and Height
LCDAssist3_1
Save Output and give it a name and path
LCDAssist4
Open with notepad
LCDAssist5
Here you have your picture



And to call it in the code, here’s how in my code

Meaning

And here you go make what you want.

I hope it works for and don’t forget to subscribe to the YouTube channel for more content.

Yassine View All

Automation and Electrical Engineer, Electronics amateur trying to share my little projects.

11 thoughts on “Measure Heart pulses/BPM And Oxygen saturation SpO² with MAX30102 and Arduino Leave a comment

  1. hello, I am recently working with nodemcu and max30102 and I had a problem. red light in max30102 won’t turn on. I’ve checked all the power things and I am sure nothing was wrong. the red light will turn on if I connect ird or rd pin to the ground. and also the program was stuck on initializing. I tried to change to Arduino Uno and it’s all same.

  2. HELLO VERY GOOD MORNING YOUR TUTORIAL WORKS WELL, DO YOU THINK YOU COULD HELP ME BY ADDING SPO2 THE OXYGENATION OF BLOOD TO THE PROJECT?

    PLEASE

    y crear una app para el celular
    and create an app so you can see the spo2 bpm levels and a set point in case the levels are not correct

    tambien pienso incluir el nivel de azucar en la sangre

  3. Hi,
    I have got the heart rate monitor working, however I am not seeing any results on the serial plotter because the code does not include that.
    I would really appreciate if you could send me the code you used to run it successfully?
    Many thanks.

    • Hello, please check the video you’ll see which one I used, I can’t remember, it was either a library example or something modified that I left a link to download it…

  4. hi i have a problem with the code, it shows error compiling for board arduino uno . can anyone explain to me. how to solve?

  5. Ciao ,penso non serva chiederti informazioni o modifiche,in quanto hai solo copiato un esempio dalla libreria!!!

Leave a Reply

Discover more from SURTR TECHNOLOGY

Subscribe now to keep reading and get access to the full archive.

Continue reading