ad space

Build Your Own Pulse Oximeter: A Step-by-Step Tutorial

Pulse oximeters have become essential medical devices, especially during health crises where monitoring oxygen saturation is crucial. In this tutorial, we'll guide you through building your own pulse oximeter using readily available components. This DIY project not only helps you understand the workings of pulse oximeters but also equips you with a functional device that can be used for basic health monitoring.

What is a Pulse Oximeter?

A pulse oximeter is a non-invasive device used to measure the oxygen saturation level (SpO2) in the blood and pulse rate. It works by emitting light through a part of the body, usually a fingertip, and measuring the amount of light absorbed by the blood. The variations in light absorption during the pulse cycle are used to calculate the oxygen saturation and pulse rate.

Components Required

  1. MAX30100 Sensor: A sensor that combines a pulse oximeter and heart-rate monitor module.
  2. Arduino UNO: A microcontroller board based on the ATmega328P.
  3. OLED Display: For displaying the SpO2 and pulse rate readings.
  4. Connecting Wires: For establishing connections between components.
  5. Breadboard: For assembling the circuit.

Step-by-Step Instructions

Step 1: Wiring the Components

Below is the circuit diagram that shows how to connect the MAX30100 Sensor, Arduino. OLED and buzzer.

MAX30100 Sensor Arduino connection diagram


  1. MAX30100 Sensor Connections:

    • VCC: Connect to 3.3V on the Arduino.
    • GND: Connect to the GND on the Arduino.
    • SCL: Connect to the A5 (SCL) on the Arduino.
    • SDA: Connect to the A4 (SDA) on the Arduino.

    MAX30100 Sensor Connections

     

  2. OLED Display Connections:

    • VCC: Connect to 5V on the Arduino.
    • GND: Connect to the GND on the Arduino.
    • SCL: Connect to the A5 (SCL) on the Arduino.
    • SDA: Connect to the A4 (SDA) on the Arduino.

    0-96-oled-display-module-arduino-500x500

Step 2: Installing Libraries

To make the Arduino communicate with the MAX30100 sensor and the OLED display, you need to install the following libraries in the Arduino IDE:

  • Adafruit GFX Library
  • Adafruit SSD1306 Library
  • MAX30100 Pulse Oximeter Library

You can install these libraries through the Arduino Library Manager.

Step 3: Writing the Code

Here's a sample code to get you started with reading the SpO2 and pulse rate and displaying them on the OLED screen:

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include "MAX30100_PulseOximeter.h"

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels

// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);

PulseOximeter pox;

uint32_t tsLastReport = 0;

void onBeatDetected() {
  Serial.println("Beat!");
}

void setup() {
  Serial.begin(115200);

  // Initialize the OLED display
  if(!display.begin(SSD1306_I2C_ADDRESS, OLED_RESET)) {
    Serial.println(F("SSD1306 allocation failed"));
    for(;;);
  }
  display.display();
  delay(2000); // Pause for 2 seconds

  display.clearDisplay();

  // Initialize the PulseOximeter
  if (!pox.begin()) {
    Serial.println("FAILED");
    for(;;);
  } else {
    Serial.println("SUCCESS");
  }

  pox.setOnBeatDetectedCallback(onBeatDetected);
}

void loop() {
  pox.update();

  // Make sure to call update as fast as possible
  if (millis() - tsLastReport > 1000) {
    Serial.print("Heart rate:");
    Serial.print(pox.getHeartRate());
    Serial.print("bpm / SpO2:");
    Serial.print(pox.getSpO2());
    Serial.println("%");

    display.clearDisplay();
    display.setTextSize(1);
    display.setTextColor(SSD1306_WHITE);
    display.setCursor(0,0);
    display.print("Heart rate: ");
    display.print(pox.getHeartRate());
    display.print(" bpm");
    display.setCursor(0,10);
    display.print("SpO2: ");
    display.print(pox.getSpO2());
    display.print(" %");

    display.display();

    tsLastReport = millis();
  }
}

 

Step 4: Uploading the Code

  1. Connect your Arduino UNO to your computer using a USB cable.
  2. Open the Arduino IDE and paste the above code into a new sketch.
  3. Select the correct board and port from the Tools menu.
  4. Click the Upload button to upload the code to the Arduino.

Step 5: Testing the Pulse Oximeter

Once the code is uploaded, the OLED display should show the heart rate and SpO2 readings. Place your fingertip on the MAX30100 sensor and observe the readings on the display. The sensor should detect your pulse and oxygen saturation level, displaying them in real-time.

Troubleshooting Tips

  • Ensure all connections are secure and correct.
  • Verify that the libraries are correctly installed in the Arduino IDE.
  • Make sure the sensor is clean and properly positioned on your fingertip for accurate readings.

Conclusion

Building your own pulse oximeter is a rewarding project that enhances your understanding of biosensors and their applications. With the MAX30100 sensor, Arduino, and an OLED display, you can create a functional pulse oximeter that provides real-time health data. This project not only serves as a practical tool but also as an educational experience in the field of health monitoring technology. Start building your pulse oximeter today and explore the fascinating world of biomedical electronics!

Post a Comment

Previous Post Next Post