MAX30100 always zero when combine with other sensor

Hi, this is my first time using arduino and sorry abt my english. im try to combine both MAX30100 code with MH-Z19B code but the MAX30100 always zero and my MH-Z19B there is some value. individually, both sensor work perfectly. if combine max30100 become an issue

this is my full code

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include "MAX30100_PulseOximeter.h"
LiquidCrystal_I2C lcd(0x27,16,2);
#define REPORTING_PERIOD_MS     1000

int DataPin = 6;
int ppmrange = 5000;
unsigned long pwmtime;
int PPM = 0;
float pulsepercent=0;
PulseOximeter pox;
uint32_t tsLastReport = 0;

void onBeatDetected()
{
    Serial.println("Beat!");
}
void setup() {
  lcd.init();
  lcd.clear();         
  lcd.backlight();
  pinMode(DataPin, INPUT);
  Serial.begin(115200);
  lcd.print("Initializing...");
  delay(3000);
  if (!pox.begin()) {
       Serial.println("FAILED");
        for(;;);
    } else {
        Serial.println("SUCCESS");
   }

     pox.setIRLedCurrent(MAX30100_LED_CURR_7_6MA);
 
    // Register a callback for the beat detection
   pox.setOnBeatDetectedCallback(onBeatDetected);  

}

void loop() {
  pwmtime = pulseIn(DataPin, HIGH, 2000000) / 1000;
        float pulsepercent = pwmtime / 1004.0;
        PPM = ppmrange * pulsepercent;
        pox.update();
    if (millis() - tsLastReport > REPORTING_PERIOD_MS) {
       // lcd.clear();
        lcd.setCursor(0,0);
        lcd.print("Smoke Level:");
        lcd.print(PPM);
        delay(5000);
        lcd.setCursor(0,1);
        lcd.print("BPM : ");
        lcd.print(pox.getHeartRate());
        lcd.setCursor(0,2);
        lcd.print("SpO2: ");
        lcd.print(pox.getSpO2());
        lcd.print("%");
    }
}

Welcome to the forum

Your topic was MOVED to its current forum category which is more appropriate than the original as it has nothing to do with Installation and Troubleshooting of the IDE

Have you ensured this is a software problem? Does the problem occur if you connect both sensors but use only the example code for the MAX30100?
If it does, post links to the hardware (not the sensor chip but the exact breakout board or better it's schematics!) and a wiring diagram.

Software problem

here my schematics im really sorry i dont have a proper sofware since im new in this field might ask what software shall i use? to draw schematic but here the picture

trust me this is my schematic diagram.

i tried every advices from this forum regarding this problem and still does not works but some user from youtube said i need to separate my microprocessor to solve my issue becuase apparently the max30100 is "high baudrate or something like that" i need to separate it bascially two microprocessor or buy max30102 and replace max30100 with max30102 and that user use that and work..

That aren't schematics but it works as a wiring diagram. I'm still missing the links to the used hardware.

The MAX30100 library you use set the I2C speed to 400kHz. Depending on the LDC module you use this might work or might fail. As you still didn't provide links to your hardware we cannot check.
You can check if that's the problem by using the line

Wire.setClock(400000);

before every call of the pox object and the line

Wire.setClock(100000);

after that call and before you call any method on the lcd object.

Of course the lines like

won't work anymore. You have to split that up to make the calls around. Save the values into a variable in a block before you call any LCD method.

for ur first queations
here the link

  1. max30100 : https://a.aliexpress.com/_m0X8J4q
  2. mhz19b : https://a.aliexpress.com/_mNaCbQ6
  3. LCD : Lcd1602 1602 Lcd Module Blue / Yellow Green Screen 16x2 Character Lcd Display Pcf8574t Pcf8574 Iic I2c Interface 5v For Arduino - Lcd Modules - AliExpress
  4. UNO : 1set Uno R3 Official Box Atmega16u2 / Uno+wifi R3 Mega328p Chip Ch340g For Arduino Uno R3 Development Board Wemos Esp8266 - Integrated Circuits - AliExpress

for second questions stil doesnot work

for final question, i dont understand what u mean

btw thank you for entertain me because from my last reply i actually give up and bought max30102

Which version (color)? And no, the difference is not just the board's color!

Then post the changed code!

If that's just for your entertainment we can immediately stop. There a lot of others who actually want help.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.