This is the MAX300100 breakout board that reads heart rate or pulse oximetry. The chip has an integrated optical sensor that derives its reading from emitting two wavelength of light from the two LED’s then measures the absorbance of pulsing blood through a photodetector. The signal is processed by a low noise analog signal processing unit and communicated to the Microcontroller through the i2C Interface.
The MAX30100 operates from 1.8v and 3.3v voltage input and can be powered down through software with negligible standby current, permitting the power supply to remain connected at all times. The device is suitable for wearable devices like smart watch, medical monitoring equipment’s, fitness assistant and smart suits.
Required Components
- Arduino Microcontroller, ESP8266 (Arduino IDE Integrated), Teensy MCU (TeensyDuino Integrated),
- Buzzer / Alarm (Optional)
- LCD / OLED i2C Display (Optional)
- Solder Less Breadboard
- Jumper Wire
Wiring Diagram
MAX30100 Schematics Diagram
Source Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
#include <MAX30100.h> #include <MAX30100_BeatDetector.h> #include <MAX30100_Filters.h> #include <MAX30100_PulseOximeter.h> #include <MAX30100_Registers.h> #include <MAX30100_SpO2Calculator.h> #include <Wire.h> #define REPORTING_PERIOD_MS 500 /* PulseOximeter is the higher level interface to the sensor That offers: > Beat Reporting > Heart Pulse Rate Calculation > SP02 OXIDATION LEVEL Calculation */ PulseOximeter pox; const int numReadings=10; float filterweight=0.5; uint32_t tsLastReport = 0; uint32_t last_beat=0; int readIndex=0; int average_beat=0; int average_SpO2=0; bool calculation_complete=false; bool calculating=false; bool initialized=false; byte beat=0; void onBeatDetected() //Calls back when pulse is detected { viewBeat(); last_beat=millis(); } void viewBeat() { if (beat==0) { Serial.print("_"); beat=1; } else { Serial.print("^"); beat=0; } } void initial_display() { if (not initialized) { viewBeat(); Serial.print("14CORE | MAX30100 Pulse Oximeter Test"); Serial.println("--------------------------------------"); Serial.println("Place place your finger on the sensor"); Serial.println("--------------------------------------"); ; initialized=true; } } void display_calculating(int j){ viewBeat(); Serial.println("Measuring"); for (int i=0;i<=j;i++) { Serial.print(". "); } } void display_values() { Serial.print(average_beat); Serial.print("| Bpm "); Serial.print("| SpO2 "); Serial.print(average_SpO2); Serial.print("%"); } void calculate_average(int beat, int SpO2) { if (readIndex==numReadings) { calculation_complete=true; calculating=false; initialized=false; readIndex=0; display_values(); } if (not calculation_complete and beat>30 and beat<220 and SpO2>50) { average_beat = filterweight * (beat) + (1 - filterweight ) * average_beat; average_SpO2 = filterweight * (SpO2) + (1 - filterweight ) * average_SpO2; readIndex++; display_calculating(readIndex); } } void setup() { Serial.begin(115200); pox.begin(); pox.setOnBeatDetectedCallback(onBeatDetected); } // Make it sure that you need to call update as fast as possible void loop() { pox.update(); if ((millis() - tsLastReport > REPORTING_PERIOD_MS) and (not calculation_complete)) { calculate_average(pox.getHeartRate(),pox.getSpO2()); tsLastReport = millis(); } if ((millis()-last_beat>10000)) { calculation_complete=false; average_beat=0; average_SpO2=0; initial_display(); } } |
Downloads
We tried to use this code. It worked the first time, displaying the bpm and SO2 %. However, if we leave our finger the sensor, the code will not display another bpm or SO2 %, it will only spit out “^-^-….” continuously.
You need to place a function inside the loop that reads the sensor input value contentiously.
Hi, how to add it please? I am total beginer and this is my first project – using Arduino Lilypad and have same trouble – show me this:
_^_^Measuring
. . _Measuring
. . . ^Measuring
. . . . _Measuring
. . . . . ^_^_^_^_^_
I try with Nodemcu 12E, i use same connection but it dosenot work for me, can you help
Use this library > https://www.14core.com/wp-content/uploads/2017/08/MAX30100.zip
How can I add firebase realtime database connection code in this code plz plz
This is the code library for Firebase API call for Arduino
Follow this link just download and extract example code also available.
> https://www.14core.com/wp-content/uploads/2022/07/firebase-arduino-master.zip