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

**URL:** <https://forum.arduino.cc/t/arduino-uno-r3-with-max30102-sensor-and-1-3-oled-display-showing-incorrect-no-values/1192633>\
**Category:** General Guidance\
**Created:** [November 23, 2023, 12:21pm UTC](https://forum.arduino.cc/t/arduino-uno-r3-with-max30102-sensor-and-1-3-oled-display-showing-incorrect-no-values/1192633 "2023-11-23T12:21:01Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![arudinouser](https://avatars.discourse-cdn.com/v4/letter/a/54ee81/32.png) [@arudinouser](https://forum.arduino.cc/u/arudinouser)\
**Post date:** [November 23, 2023, 12:21pm UTC](https://forum.arduino.cc/t/arduino-uno-r3-with-max30102-sensor-and-1-3-oled-display-showing-incorrect-no-values/1192633/1 "2023-11-23T12:21:02Z")

</div>

Here is my Connection Diagram:

 ![Screenshot 2023-11-23 174115](https://europe1.discourse-cdn.com/arduino/original/4X/8/6/e/86e0b557d881485a975c76905398b857a067e502.png)

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:

```arduino
#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);
}

```

---

<div class="post-metadata">

**Author:** ![paulpaulson](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/paulpaulson/32/363643_2.png) [@paulpaulson](https://forum.arduino.cc/u/paulpaulson)\
**Post date:** [November 23, 2023, 1:09pm UTC](https://forum.arduino.cc/t/arduino-uno-r3-with-max30102-sensor-and-1-3-oled-display-showing-incorrect-no-values/1192633/2 "2023-11-23T13:09:19Z")

</div>

> [@arudinouser](#):
>
> I don't know how to solve this issue.

Hello [arudinouser](https://forum.arduino.cc/u/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++.

---

<div class="post-metadata">

**Author:** ![jim-p](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/jim-p/32/922840_2.png) [@jim-p](https://forum.arduino.cc/u/jim-p)\
**Post date:** [November 23, 2023, 1:21pm UTC](https://forum.arduino.cc/t/arduino-uno-r3-with-max30102-sensor-and-1-3-oled-display-showing-incorrect-no-values/1192633/3 "2023-11-23T13:21:50Z")

</div>

Try setting the MAX30105 I2C speed to I2C\_SPEED\_STANDARD

---

<div class="post-metadata">

**Author:** ![arudinouser](https://avatars.discourse-cdn.com/v4/letter/a/54ee81/32.png) [@arudinouser](https://forum.arduino.cc/u/arudinouser)\
**Post date:** [November 23, 2023, 1:56pm UTC](https://forum.arduino.cc/t/arduino-uno-r3-with-max30102-sensor-and-1-3-oled-display-showing-incorrect-no-values/1192633/4 "2023-11-23T13:56:27Z")

</div>

It didn't worked.

---

<div class="post-metadata">

**Author:** ![xfpd](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/xfpd/32/1120236_2.png) [@xfpd](https://forum.arduino.cc/u/xfpd)\
**Post date:** [November 25, 2023, 7:38am UTC](https://forum.arduino.cc/t/arduino-uno-r3-with-max30102-sensor-and-1-3-oled-display-showing-incorrect-no-values/1192633/5 "2023-11-25T07:38:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![arudinouser](https://avatars.discourse-cdn.com/v4/letter/a/54ee81/32.png) [@arudinouser](https://forum.arduino.cc/u/arudinouser)\
**Post date:** [November 25, 2023, 6:35am UTC](https://forum.arduino.cc/t/arduino-uno-r3-with-max30102-sensor-and-1-3-oled-display-showing-incorrect-no-values/1192633/6 "2023-11-25T06:35:37Z")

</div>

Here is the reference code for calculating glucose level.

 ![Screenshot 2023-11-25 120139](https://europe1.discourse-cdn.com/arduino/original/4X/6/0/5/605dc96e6e4fdee233e4586f37805856171a0f86.png)

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.

---

<div class="post-metadata">

**Author:** ![markd833](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/markd833/32/1186928_2.png) [@markd833](https://forum.arduino.cc/u/markd833)\
**Post date:** [November 25, 2023, 6:56am UTC](https://forum.arduino.cc/t/arduino-uno-r3-with-max30102-sensor-and-1-3-oled-display-showing-incorrect-no-values/1192633/7 "2023-11-25T06:56:00Z")

</div>

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

Have you read:

> [@Glucometer with MAX30102](https://forum.arduino.cc/t/glucometer-with-max30102/1179083):
>
> Hello. I'm currently undertaking a project to make a non-invasive glucometer using NIR(Near Infrared). I've been digging a lot lately about how to get these data from a human finger, i've been trying some formula using beer lambert's law which has been unsuccessful in giving me a plausible result. I don't need a precise result but at least something close by that i can work with, So far i have only static result that remain the same no matter the blood glucose of the patient. I am using a MAX30…

It may provide some information.

---

<div class="post-metadata">

**Author:** ![TomGeorge](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/tomgeorge/32/215261_2.png) [@TomGeorge](https://forum.arduino.cc/u/TomGeorge)\
**Post date:** [November 25, 2023, 7:07am UTC](https://forum.arduino.cc/t/arduino-uno-r3-with-max30102-sensor-and-1-3-oled-display-showing-incorrect-no-values/1192633/8 "2023-11-25T07:07:08Z")

</div>

HI, @arudinouser

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

Is this the project?

> [@Arduino UNO R3 with MAX30102 sensor and 1.3' OLED display showing Incorrect/No values](https://forum.arduino.cc/t/arduino-uno-r3-with-max30102-sensor-and-1-3-oled-display-showing-incorrect-no-values/1192633):
>
> 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; …

Did you get the display to work?

Tom.. 😀 👍 ☕ 🇦🇺

---

<div class="post-metadata">

**Author:** ![arudinouser](https://avatars.discourse-cdn.com/v4/letter/a/54ee81/32.png) [@arudinouser](https://forum.arduino.cc/u/arudinouser)\
**Post date:** [November 25, 2023, 7:14am UTC](https://forum.arduino.cc/t/arduino-uno-r3-with-max30102-sensor-and-1-3-oled-display-showing-incorrect-no-values/1192633/9 "2023-11-25T07:14:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![xfpd](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/xfpd/32/1120236_2.png) [@xfpd](https://forum.arduino.cc/u/xfpd)\
**Post date:** [November 25, 2023, 7:31am UTC](https://forum.arduino.cc/t/arduino-uno-r3-with-max30102-sensor-and-1-3-oled-display-showing-incorrect-no-values/1192633/10 "2023-11-25T07:31:40Z")

</div>

> [@arudinouser](#):
>
> constantly getting values between 50 - 60.

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

---

<div class="post-metadata">

**Author:** ![arudinouser](https://avatars.discourse-cdn.com/v4/letter/a/54ee81/32.png) [@arudinouser](https://forum.arduino.cc/u/arudinouser)\
**Post date:** [November 25, 2023, 7:39am UTC](https://forum.arduino.cc/t/arduino-uno-r3-with-max30102-sensor-and-1-3-oled-display-showing-incorrect-no-values/1192633/11 "2023-11-25T07:39:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![xfpd](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/xfpd/32/1120236_2.png) [@xfpd](https://forum.arduino.cc/u/xfpd)\
**Post date:** [November 25, 2023, 7:54am UTC](https://forum.arduino.cc/t/arduino-uno-r3-with-max30102-sensor-and-1-3-oled-display-showing-incorrect-no-values/1192633/12 "2023-11-25T07:54:55Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![arudinouser](https://avatars.discourse-cdn.com/v4/letter/a/54ee81/32.png) [@arudinouser](https://forum.arduino.cc/u/arudinouser)\
**Post date:** [November 25, 2023, 8:15am UTC](https://forum.arduino.cc/t/arduino-uno-r3-with-max30102-sensor-and-1-3-oled-display-showing-incorrect-no-values/1192633/13 "2023-11-25T08:15:30Z")

</div>

Classmate Who?

BPM is coming fine

---

<div class="post-metadata">

**Author:** ![PerryBebbington](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/perrybebbington/32/238766_2.png) [@PerryBebbington](https://forum.arduino.cc/u/PerryBebbington)\
**Post date:** [November 25, 2023, 8:25am UTC](https://forum.arduino.cc/t/arduino-uno-r3-with-max30102-sensor-and-1-3-oled-display-showing-incorrect-no-values/1192633/14 "2023-11-25T08:25:55Z")

</div>

@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

> [@How to get the best out of this forum](https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum/679966):
>
> See also [FAQ - Arduino Forum](https://forum.arduino.cc/faq) for general rules on forum behaviour and etiquette. Hello, Welcome to the Arduino Forum. This guide explains how to get the best out of this forum. Please read and follow the instructions below. Being new here you might think this is having rules for the sake of rules, but that is not the case. If you don’t follow the guidelines all that happens is there is a long exchange of posts while we try to get you to tell us what we need in order to help you, which is fru…

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

Thank you.

---

<div class="post-metadata">

**Author:** ![zwieblum](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/zwieblum/32/427702_2.png) [@zwieblum](https://forum.arduino.cc/u/zwieblum)\
**Post date:** [November 25, 2023, 8:51am UTC](https://forum.arduino.cc/t/arduino-uno-r3-with-max30102-sensor-and-1-3-oled-display-showing-incorrect-no-values/1192633/15 "2023-11-25T08:51:25Z")

</div>

> [@arudinouser](#):
>
> Here is the reference code for calculating glucose level.

Is that a bad joke?

---

<div class="post-metadata">

**Author:** ![xfpd](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/xfpd/32/1120236_2.png) [@xfpd](https://forum.arduino.cc/u/xfpd)\
**Post date:** [November 25, 2023, 9:01am UTC](https://forum.arduino.cc/t/arduino-uno-r3-with-max30102-sensor-and-1-3-oled-display-showing-incorrect-no-values/1192633/16 "2023-11-25T09:01:48Z")

</div>

> [@zwieblum](#):
>
> 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](https://www.researchgate.net/publication/360289594_Non-Invasive_Blood_Glucose_Level_Monitoring_for_Enhancement_using_ML)

---

<div class="post-metadata">

**Author:** ![arudinouser](https://avatars.discourse-cdn.com/v4/letter/a/54ee81/32.png) [@arudinouser](https://forum.arduino.cc/u/arudinouser)\
**Post date:** [November 25, 2023, 9:23am UTC](https://forum.arduino.cc/t/arduino-uno-r3-with-max30102-sensor-and-1-3-oled-display-showing-incorrect-no-values/1192633/17 "2023-11-25T09:23:37Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![zwieblum](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/zwieblum/32/427702_2.png) [@zwieblum](https://forum.arduino.cc/u/zwieblum)\
**Post date:** [November 25, 2023, 9:25am UTC](https://forum.arduino.cc/t/arduino-uno-r3-with-max30102-sensor-and-1-3-oled-display-showing-incorrect-no-values/1192633/18 "2023-11-25T09:25:58Z")

</div>

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".

---

<div class="post-metadata">

**Author:** ![arudinouser](https://avatars.discourse-cdn.com/v4/letter/a/54ee81/32.png) [@arudinouser](https://forum.arduino.cc/u/arudinouser)\
**Post date:** [November 25, 2023, 11:14am UTC](https://forum.arduino.cc/t/arduino-uno-r3-with-max30102-sensor-and-1-3-oled-display-showing-incorrect-no-values/1192633/19 "2023-11-25T11:14:53Z")

</div>

are you saying that its not possible?

---

<div class="post-metadata">

**Author:** ![zwieblum](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/zwieblum/32/427702_2.png) [@zwieblum](https://forum.arduino.cc/u/zwieblum)\
**Post date:** [November 25, 2023, 12:16pm UTC](https://forum.arduino.cc/t/arduino-uno-r3-with-max30102-sensor-and-1-3-oled-display-showing-incorrect-no-values/1192633/20 "2023-11-25T12:16:49Z")

</div>

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

[Next page](https://forum.arduino.cc/t/arduino-uno-r3-with-max30102-sensor-and-1-3-oled-display-showing-incorrect-no-values/1192633.md?page=2)
