Project showcase
MAX30102 and Blynk

MAX30102 and Blynk © GPL3+

Really? A pitch? What is this?

  • 5,693 views
  • 1 comment
  • 2 respects

Components and supplies

Necessary tools and machines

09507 01
Soldering iron (generic)

Apps and online services

About this project

One day job, don't fret.

Code

Final_scriptArduino
Just upload and run
#include <BlynkSimpleStream.h>
#include <Wire.h>
#include "MAX30105.h"
#include "heartRate.h"
#include "spo2_algorithm.h"
MAX30105 poxSensor;
const byte RATE_SIZE = 4; //Increase this for more averaging. 4 is good.
byte rates[RATE_SIZE]; //Array of heart rates
byte rateSpot = 0;
long lastBeat = 0; //Time at which the last beat occurred
float beatsPerMinute;
int beatAvg;

//auth
char auth[] = "dbd2e3a3462d406592d3408ffc8ec655";
//Widget
WidgetLCD lcd1(V4);
void setup()
{
  Serial.begin(9600);
  poxSensor.begin(Wire, I2C_SPEED_FAST);
  Blynk.begin(Serial, auth);
  poxSensor.setup();
  poxSensor.setPulseAmplitudeRed(0x0A);
  poxSensor.setPulseAmplitudeGreen(0);
}
void loop()
{
  Blynk.run();
  //lcd.print(0, 0, "IR");
  //lcd1.print(0, 0, "BPM");
  long irValue = poxSensor.getIR();
  float temperature = poxSensor.readTemperature();
  Blynk.virtualWrite(V5, temperature);
  //lcd.print(0, 1, irValue);
  if (checkForBeat(irValue) == true)
  {
    //We sensed a beat!
    long delta = millis() - lastBeat;
    lastBeat = millis();
    //lcd1.print(0, 0, "BPM");
    beatsPerMinute = 60 / (delta / 1000.0);
    //lcd1.print(0, 1, beatsPerMinute);
    if (beatsPerMinute < 255 && beatsPerMinute > 20)
    {
      rates[rateSpot++] = (byte)beatsPerMinute; //Store this reading in the array
      rateSpot %= RATE_SIZE; //Wrap variable

      //Take average of readings
      lcd1.print(0, 0, "AverageBeat");
      beatAvg = 0;
      for (byte x = 0 ; x < RATE_SIZE ; x++)
        beatAvg += rates[x];
      beatAvg /= RATE_SIZE;
      lcd1.print(0, 1, beatAvg);
    } 
  }
  
}

Schematics

Circuit diagram
Really this question
Ckt diagram bb z9faeqhcnu

Comments

Similar projects you might like

MAX30100 And Blynk

Project showcase by Vlad_the_destroyer

  • 8,386 views
  • 0 comments
  • 13 respects

Arduino MKR1000 & Blynk

Project tutorial by Lintang Wisesa

  • 4,416 views
  • 0 comments
  • 4 respects

Measure Heart Rate and SpO2 with MAX30102

Project tutorial by SurtrTech

  • 180,064 views
  • 58 comments
  • 256 respects

Monitoring Temperature Remotely with Blynk for Dummies

Project in progress by Cmtelesann

  • 17,063 views
  • 14 comments
  • 22 respects
Add projectSign up / Login