Arduino UNO R3 with MAX30102 sensor and 1.3' OLED display showing Incorrect/No values

Here is my Connection Diagram:

When I comment the code oled then it shows values for BPM and vice versa if commented BPM code then oled code works I don't know how to solve this issue. Also I am new to Arduino, Your help will be really appreciatable. Thank You!

Here is the code:

#include <Wire.h>
#include "MAX30105.h"
#include "heartRate.h"
#include <SoftwareSerial.h>
#include "U8glib.h"

U8GLIB_SH1106_128X64 oled(U8G_I2C_OPT_NONE);

MAX30105 particleSensor;

const byte rxPin = 9;
const byte txPin = 8;
SoftwareSerial BTSerial(rxPin, txPin); // RX TX

const byte RATE_SIZE = 4;
const int IR_THRESHOLD = 7000;
const int MIN_BPM = 20;
const int MAX_BPM = 255;

byte rates[RATE_SIZE];
byte rateSpot = 0;
long lastBeat = 0;
int beatAvg;
float beatsPerMinute;

void setup() {
  pinMode(rxPin, INPUT);
  pinMode(txPin, OUTPUT);
  BTSerial.begin(9600);
  Serial.begin(115200);

  particleSensor.begin(Wire, I2C_SPEED_FAST);
  particleSensor.setup();
  particleSensor.setPulseAmplitudeRed(0x0A);
}

void printOLED() {
  oled.firstPage();
  do {
    oled.setFont(u8g_font_profont15);
    oled.setPrintPos(12, 15);
    oled.print("$ My App $");
    oled.setPrintPos(0, 30);
    oled.print("BPM: ");
    oled.setPrintPos(30, 30);
    oled.print(beatsPerMinute);
    oled.setPrintPos(0, 45);
    oled.print("Avg BPM: ");
    oled.setPrintPos(60, 45);
    oled.print(beatAvg);
    oled.setPrintPos(0, 60);
  } while (oled.nextPage());
}

void loop() {
  long irValue = particleSensor.getIR();

  if (irValue > IR_THRESHOLD) {

    if (checkForBeat(irValue)) {
      long delta = millis() - lastBeat;
      lastBeat = millis();

      beatsPerMinute = 60 * 1000 / delta;

      if (beatsPerMinute < MAX_BPM && beatsPerMinute > MIN_BPM) {
        rates[rateSpot++] = static_cast<byte>(beatsPerMinute);
        rateSpot %= RATE_SIZE;

        beatAvg = 0;
        for (byte x = 0; x < RATE_SIZE; x++) {
          beatAvg += rates[x];
        }
        beatAvg /= RATE_SIZE;
      }
    }
  } else {
    beatAvg = 0;
  }

  printOLED();
  delay(200);
}


Hello arudinouser

Welcome to the world's best Arduino forum ever.

I assume that you have written the programme by yourself, then it is quite easy to find the error.

There's a trick to figuring out why something isn't working:

Use a logic analyzer to see what happens.
Put Serial.print statements at various places in the code as diagnostic prints to see the values of variables, especially ones that control the motors, and determine whether they meet your expectations.

Have a nice day and enjoy coding in C++.

Try setting the MAX30105 I2C speed to I2C_SPEED_STANDARD

It didn't worked.

I think the wifi RX is 3v3, not 5v coming from Arduino pin 8.

Here is the reference code for calculating glucose level.

I tried it but I am constantly getting values between 50 - 60.

So can anyone guide me through this. Thank You!

I am using arduino UNO R3 and MAX30102 sensor.

For future reference, pictures of bits of code are not helpful.

Have you read:

It may provide some information.

HI, @arudinouser

https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum

Is this the project?

Did you get the display to work?

Tom.. :grinning: :+1: :coffee: :australia:

Currently I have removed that code and working on Glucose level monitoring using the same sensor.

Results of "50 - 60" are from your calculation in your sketch. What values are you expecting, and did you use the right formula?

Normal Blood Glucose levels are in range of 70 - 100.

Either your sensor is bad, your calculation is bad, or your classmate is hypoglycemic.
Ask yourself:

  1. Does your sensor work for BPM?
  2. Is your classmate hospitalized?
  3. What remains?

Classmate Who?

BPM is coming fine

@arudinouser,

Your two or more topics on the same or similar subject have been merged.

Please do not duplicate your questions as doing so wastes the time and effort of the volunteers trying to help you as they are then answering the same thing in different places.

Please create one topic only for your question and choose the forum category carefully. If you have multiple questions about the same project then please ask your questions in the one topic as the answers to one question provide useful context for the others, and also you won’t have to keep explaining your project repeatedly.

Repeated duplicate posting could result in a temporary or permanent ban from the forum.

Could you take a few moments to Learn How To Use The Forum

It will help you get the best out of the forum in the future.

Thank you.

Is that a bad joke?

No... yes? It appears people are publishing this and getting paid.
https://www.researchgate.net/publication/360289594_Non-Invasive_Blood_Glucose_Level_Monitoring_for_Enhancement_using_ML

Yes, at first I also thought its not possible but then I saw various papers So, I made plan on doing it as my final year project.

There is a reason why 99% of all published papers are not worth the paper they are printed on. e.g.: the paper you linked does not give any reason why that would work. No physics. Just believe. We called that "fund raising".

are you saying that its not possible?

There is no way that works as advertised. It's on par with the "one lead ECG".