Pulse Oximeter With MAX30105, NodeMCU and an SSD1306 OLED Screen

by taste_the_code in Circuits > Gadgets

7393 Views, 82 Favorites, 0 Comments

Pulse Oximeter With MAX30105, NodeMCU and an SSD1306 OLED Screen

Oximeter Monitor with OLED screen and MAX30105 sensor on NodeMCU

In today's project, I tried to build my own pulse monitor that measures my heart rate in beats per minute (bpm) but also monitors the oxygen saturation levels in my blood, using an MAX30105 oximeter sensor coupled with an OLED screen.

This sensor is fascinating in that it's highly sensitive to changes in light, particularly with infrared, which allows us to detect pulse and oxygen saturation by analyzing the color fluctuations in our fingers as blood flows through it. It's pretty impressive how such a small sensor, commonly used in smoke detectors, can be repurposed for personal health monitoring.

Before we jump into the project details, I want to express my gratitude to PCBWay for sponsoring this project. Their support for DIY enthusiasts and commitment to quality PCB production is invaluable. PCBWay offers flexible solutions for prototyping and small batch production, ensuring your projects turn out precisely as planned. Thank you, PCBWay, for being a trusted partner in the electronics hobbyist community. Check out their services and take advantage of their welcome bonus for your creations.

Disclaimer: The DIY pulse oximeter project outlined in this article is intended for educational and recreational purposes only. It is not a substitute for professional medical equipment and should not be used to make medical decisions or diagnose health conditions. The accuracy of the readings from this device has not been clinically validated and may not match the precision or reliability of a certified medical device. If you have concerns about your health or require medical monitoring of your pulse or oxygen saturation levels, consult with a healthcare professional and use an approved medical-grade pulse oximeter. Always prioritize safety and accuracy when it comes to health monitoring.

Supplies

Understanding the MAX30105 Sensor

MVI_1172.MP4.00_00_09_12.Still001.jpg

The MAX30105 sensor is an intriguing component in our DIY pulse oximeter project. Initially designed for smoke detection thanks to its optical sensibilities, this little device boasts an impressive ability to also track biological changes. When we place a finger on it, it precisely measures the fluctuations in light caused by the pulsing blood within our finger. The colors in our skin, as they vary with each heartbeat, inform the sensor about our pulse rate and how well our blood is oxygenated.

Equipped with red, infrared, and green LEDs, the MAX30105 sensor can perform different types of measurements—beyond the basic smoke detection—for which it was originally intended. For instance, these LEDs are pivotal in distinguishing various particles in the air or monitoring the vascular changes in our fingertips to compute our vital health stats. In this DIY setup, we focus on the sensor's biomedical application, particularly measuring pulse and blood oxygen levels.

Wiring the Components

MVI_1167.MP4.00_00_03_05.Still001.jpg
MVI_1172.MP4.00_01_03_26.Still002.jpg

Wiring our DIY pulse oximeter is straightforward. We'll be wiring the MAX30105 sensor and the OLED display to our chosen microcontroller, the ESP8266, which serves as the brain of our device. The components will use the I2C communication protocol, requiring just a couple of pins to transmit data.

First, we'll connect our OLED display. The OLED operates on 3.3 volts, so we'll connect its VCC pin to the 3.3V output on the ESP8266. GND goes to GND. When it comes to data, the SCL pin on the OLED connects to pin D1 on the ESP8266, and the SDA pin to D2. This sets up our screen to receive data from the microcontroller.

Now, for the MAX30105 sensor, we'll power it with 5 volts from the ESP8266 to ensure it operates smoothly, plugging VCC into the 5V (Vin) pin. GND goes to GND, the same as with the OLED. Since the MAX30105 sensor communicates via I2C protocol as well, we connect the SCL and SDA pins to the same D1 and D2 pins on the ESP8266, allowing them to share the bus.

It's essential to ensure that all connections are secure and correct before powering the device. A stable connection between our microcontroller and the sensor/OLED will lead to reliable and accurate readings. Now that we've got everything connected, it's almost time to bring our pulse oximeter to life with some programming magic!

Programming the NodeMCU

2024-02-13 07-44-07.mp4.00_01_37_16.Still001.jpg
2024-02-13 07-44-07.mp4.00_03_03_13.Still002.jpg
MVI_1171.MP4.00_00_19_04.Still001.jpg
MVI_1171.MP4.00_00_57_27.Still003.jpg
MVI_1165.MP4.00_00_02_29.Still001.jpg

Now that our wiring is in place, we’ll get started with programming the NodeMCU microcontroller to read data from the MAX30105 sensor and display the results on our OLED screen. I'll be using the Arduino IDE for this purpose. Before diving into the code, ensure that you’ve installed the necessary libraries to interact with the sensor and the display. Specifically, we need the MAX3010X library for the sensor and the Adafruit SSD1306 library for the OLED.

Firstly, we include our libraries at the beginning of our sketch. With the right libraries in place, initializing the sensor and the display is up next. We'll set up the appropriate addresses and create instances for both the sensor and the OLED. For the MAX30105 sensor, we'll be initiating it with default settings, which work well for basic measurements. If you want to get fancy with calibration for more accurate results, you can tweak these settings later.

Moving onto the main part of our code, we’ll establish a serial connection to communicate with the PC for debugging purposes; this step is always helpful in understanding what's happening behind the scenes. Following that, there will be a check to ensure our NodeMCU can communicate with both the sensor and the OLED screen. If there’s an issue, the system will provide an error message and halt the process.

Inside the main loop, we continuously read the data from the sensor. If a finger is detected on the sensor – yes, the sensor is smart enough to know that – we proceed to collect the heart rate and oxygen saturation data. The retrieved data is then sent to the OLED display for visualization. We ensure the display refreshes with each new set of data. This cycle repeats, giving us real-time updates of our pulse and oxygen saturation levels.

If you want to replicate the project for yourself, the full code is available on my website.

Calibration and Potential Improvements

MVI_1176.MP4.00_00_47_03.Still001.jpg
MVI_1179.MP4.00_00_32_08.Still001.jpg

With the pulse oximeter prototype assembled and programmed, the next vital step is calibration. This process ensures that the readings we receive mirror actual physiological conditions accurately. Since I lack a standardized reference oximeter, I've stuck to the default settings provided by the library. However, for those who seek precision, comparing and adjusting the sensor's output against a medical-grade oximeter would be the way to go.

To learn more about the calibration of Spo2 measurements, check out this link.

Calibration involves a bit of trial and error; you may need to modify certain parameters in the code based on the sensor's documentation, which details how to adjust values to match your specific readings. Keep in mind that individual physiology, such as skin thickness and composition, can affect readings—something I noticed when measurements differed between myself, my child, and my spouse.

As I experimented with the setup, potential improvements became clear. For instance, the sensor's readings can be sensitive to how the finger is placed—too much pressure can lead to inaccuracies. Future versions could incorporate a more stable and consistent method of finger attachment, such as a fixed clamp or a strap, to standardize the pressure applied. Another area to explore is enhancing the algorithms that process the sensor data, and filtering out noise and motion artifacts to improve reliability.

Continuous refinement is key to DIY projects, and each iteration can lead to a more reliable and useful device. I'm open to your insights and experiences—if you've worked with the MAX30105 sensor or similar projects, I'd love to read your suggestions in the comments on how to enhance this pulse oximeter further.

Next Steps

MVI_1173.MP4.00_00_08_08.Still001.jpg
MVI_1171.MP4.00_00_30_18.Still002.jpg

I hope you've found this Instructable interesting. While the device I've created might not replace medical-grade equipment, it stands as a testament to the power of DIY electronics. It's been a great exercise in understanding how health monitoring technology works and how we can create our tools at home.

Looking forward, there's always room for enhancement. Whether it's refining the calibration process, improving the stability of the readings, or integrating with other systems like home automation for more intelligent applications, the possibilities are vast.

Remember, the full code and additional resources are available on my website and in the related project video, for those who want to replicate or extend this project. Your feedback, experiences, and ideas are welcomed—please share them so we can all learn and improve together.

I look forward to seeing where you take your DIY pulse oximeter. Keep exploring, keep building, and most importantly, have fun with it!