The MAX30100 IC is an integrated pulse oximetry module two LEDs, a photodetector, optimized optics, and low-noise analogue signal processing designed for the wearable devices and medical devices. The MAX30102 IC is an upgrade to The MAX30100 and The MAX30101 IC. Here is the datasheet of MAX30102 (website of MAXIM). The PDF will give you the outlook of the working principle of the thing. Practically the work in Arduino world is joining the things, installing the libraries and testing the codes. There is little complexity.
The basic question can be “Which MAX30102 module to purchase?” Unfortunately, the answer is not easy. I found the one build/sold by Maker Focus (or it can be its clone). This is the photograph of that thing :
The build quality of this module looks better than the rest available. The cheapest version with green colour PCB has an error in the circuit design. The story to cover-up that error by the Chinese manufacturer is quite funny :
---
1 | https://reedpaper.wordpress.com/2018/08/22/pulse-oximeter-max30100-max30102-how-to-fix-wrong-board/ |
How much fun it is, that kind of “error” makes the module far from being perfect. This is the problem with the Chinese manufacturers. I hope that the module built/sold by Maker Focus is of better quality. You need to compare the reading with a standard device for fine-tuning. But if the circuit design is “fixed” in the mentioned way, no code on this earth can fix it. He has a piece of scary information:
Everything I said below applies equally to the new MAX30102 modules and old modules with discontinued MAX30100 chip since they are assembled on the same boards.
The one build/sold by Maker Focus is not known to him. BUT, the Maxim max30102 sensor used is mounted on a MH-ET LIVE breakout board and datasheet does not state that LED1 is Red and LED2 is Infrared (IR). LED1 should be IR and LED2 is Red – which means the things are swapped. We are using the library for Sparkfun’s hardware, not of these things. This is another point which you probably need to check/rectify.
As usual, we will use the Arduino IDE for ESP32. If we can succeed with the basic test, we can easily transfer the data over the internet. Most of the snippets on the internet are for MAX30100 IC, not MAX30102 IC. MAX30102 IC is more sensitive and code should not differ much. The MAX30102 build/sold Maker Focus supports the Arduino library named “Sparkfun MAX3010x Pulse and Proximity Sensor Library” :
1 | https://github.com/sparkfun/SparkFun_MAX3010x_Sensor_Library |
The connection is easy, we will use 3v3, GND, pin 21 and pin 22 :
ESP32’s 3v3 will connect to ==>MAX30102’s Vin
ESP32’s GND will connect to ==>MAX30102’s GND
ESP32’s SDA (21) will connect to ==> MAX30102’s SDA
ESP32’s SCL (22) will connect to ==> MAX30102’s SCL
The test code for the above thing is :
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 | #include <Wire.h> #include "MAX30105.h" MAX30105 particleSensor; // initialize MAX30102 with I2C void setup() { Serial.begin(115200); while(!Serial); //We must wait for Teensy to come online delay(100); Serial.println(""); Serial.println("MAX30102"); Serial.println(""); delay(100); // Initialize sensor if (particleSensor.begin(Wire, I2C_SPEED_FAST) == false) //Use default I2C port, 400kHz speed { Serial.println("MAX30105 was not found. Please check wiring/power. "); while (1); } // I have changed the ledbrightness byte ledBrightness = 255; //Options: 0=Off to 255=50mA byte sampleAverage = 1; //Options: 1, 2, 4, 8, 16, 32 // I have changed the ledmode byte ledMode = 3; //Options: 1 = Red only, 2 = Red + IR, 3 = Red + IR + Green int sampleRate = 400; //Options: 50, 100, 200, 400, 800, 1000, 1600, 3200 int pulseWidth = 69; //Options: 69, 118, 215, 411 int adcRange = 16384; //Options: 2048, 4096, 8192, 16384 particleSensor.setup(ledBrightness, sampleAverage, ledMode, sampleRate, pulseWidth, adcRange); //Configure sensor with these settings } void loop() { particleSensor.check(); //Check the sensor while (particleSensor.available()) { // read stored IR Serial.print(particleSensor.getFIFOIR()); Serial.print(","); // read stored red Serial.println(particleSensor.getFIFORed()); // read next set of samples particleSensor.nextSample(); } } |
When a finger will be placed on the sensor of MAX30102 module (use something like a rubber band, tape, or velcro), then the printout to the Arduino serial plotter should show.
You can further modify your thing following these guides (adapt for ESP32) :
1 2 3 4 5 | https://create.arduino.cc/projecthub/gatoninja236/open-source-pulse-oximeter-for-covid-19-4764c5?f=1 https://create.arduino.cc/projecthub/jeffreymagee/attiny85-pulse-oximeter-and-photoplethysmograph-e3f907?ref=similar&ref_id=329610&offset=0 https://github.com/jeffmer/tinyPulsePPG https://github.com/Protocentral/Pulse_MAX30102 https://www.instructables.com/id/Pulse-Oximeter-With-Much-Improved-Precision/ |
My intention to write this article was for making the readers ready for the next IoT projects. ESP32 itself has no use for just local testing/playing/building. Why I am “playing” so the late phase of the pandemic with SpO2 can be a question. Actually there was a hackthathon by IBM covering COVID-19. Giving ready-to-use hints would not be fair.
Tagged With https://thecustomizewindows com/2020/09/pulse-oximeter-with-esp32-and-max30102/ , esp32 mx30100 , max30102 arduino , Max30102 arduino program , max30102 esp32 , max30102 instructable , max30102 instructables , signal