0% found this document useful (0 votes)
832 views2 pages

Spo2 Max30100 Nodemcu & Blynk

This code configures a MAX30100 pulse oximeter sensor to measure heart rate and blood oxygen levels. It connects the sensor to an ESP8266 WiFi module and sends the sensor readings to a Blynk server every 1000ms for remote monitoring. The code initializes the pulse oximeter sensor, sets a callback function for detected heartbeats, reads the sensor values in a loop, and transmits the bpm and SpO2 values to the Blynk server.

Uploaded by

shashank gupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
832 views2 pages

Spo2 Max30100 Nodemcu & Blynk

This code configures a MAX30100 pulse oximeter sensor to measure heart rate and blood oxygen levels. It connects the sensor to an ESP8266 WiFi module and sends the sensor readings to a Blynk server every 1000ms for remote monitoring. The code initializes the pulse oximeter sensor, sets a callback function for detected heartbeats, reads the sensor values in a loop, and transmits the bpm and SpO2 values to the Blynk server.

Uploaded by

shashank gupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

#include <Wire.

h>
#include "MAX30100_PulseOximeter.h"
#define BLYNK_PRINT Serial
#include <Blynk.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

#define REPORTING_PERIOD_MS 1000

char auth[] = "ad5204cdb20149d8a913125366159000"; // You should get Auth


Token in the Blynk App.
char ssid[] = "Shashank"; // Your WiFi
credentials.
char pass[] = "shashank987";

// Connections : SCL PIN - D1 , SDA PIN - D2 , INT PIN - D0


PulseOximeter pox;

float BPM, SpO2;


uint32_t tsLastReport = 0;

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

void setup()
{
Serial.begin(115200);
pinMode(16, OUTPUT);
Blynk.begin(auth, ssid, pass);

Serial.print("Initializing Pulse Oximeter..");

if (!pox.begin())
{
Serial.println("FAILED");
for(;;);
}
else
{
Serial.println("SUCCESS");
pox.setOnBeatDetectedCallback(onBeatDetected);
}

// The default current for the IR LED is 50mA and it could be changed by
uncommenting the following line.
// pox.setIRLedCurrent(MAX30100_LED_CURR_7_6MA);

void loop()
{
pox.update();
Blynk.run();

BPM = pox.getHeartRate();
SpO2 = pox.getSpO2();
if (millis() - tsLastReport > REPORTING_PERIOD_MS)
{
Serial.print("Heart rate:");
Serial.print(BPM);
Serial.print(" bpm / SpO2:");
Serial.print(SpO2);
Serial.println(" %");

Blynk.virtualWrite(V7, BPM);
Blynk.virtualWrite(V8, SpO2);

tsLastReport = millis();
}
}

You might also like