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 test, here we are with another one it’s the MAX30102, I’ll use it to measure my BPM an Pulse oximetry with the help of an Arduino UNO board, and also using an OLED display + Buzzer for a little BPM related project.
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):
Components:
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.
Wiring:
The MAX30102 Can use the i²c so wired it with the Arduino board using that interface and as usual A4/A5 with SDA/SCL same with 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.

Libraries:
- SparkFun MAX30102 library: Download here
- Adafruit OLED SSD1306 library: Download here
- Adafruit GFX Library: Download here
Codes:
The codes I’ve used are from the library Examples, for the code I’ve made that works with the OLED and Buzzer, it’s a modified version of “HeartRate” code.
Test:
After wiring the components, upload the code.

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.

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

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.

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”

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






And to call it in the code, here’s how in my code
1 |
display.drawBitmap(5, 5, logo2_bmp, 24, 21, WHITE); |
Meaning
1 |
display.drawBitmap(Starting x pixel, Starting y pixel, pic name, pic width, pic height, color); |
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.
Categories
Yassine View All
Automation and Electrical Engineer, Electronics amateur trying to share my little projects.
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.
Did you check if the module is soldred right? Also try to run an i²c scanner to check if the module is responding or not.
hi how can i added 2 key for edit hour and minutes to this project??
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
please can you send me the libraries and the library that i am unable to download
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…
hi i have a problem with the code, it shows error compiling for board arduino uno . can anyone explain to me. how to solve?
Please make sure that you connected wiring properly with Arduino.
Ciao ,penso non serva chiederti informazioni o modifiche,in quanto hai solo copiato un esempio dalla libreria!!!
PLEASE SEND THIS CODE IN ENGLISH LANGUAGE IT IS VERY HELPFUL FOR ME ,THANK YOU