How to solve this nodemcu with many sensor problem?

Hello friends
im doing one project which collects health parameter of the patient so I'm using ESP8266 module as main controller and sensors MAX30100 pulse and Spo2 ,Blood pressure sensor with serial out(Blood Pressure Sensor - Serial output [1437] : Sunrom Electronics/Technologies) , and MLX IR temperature sensor ... so I googled many time I did not found how to connect two I2C device to one SCL and SDA line and I'm also interfacing Blood pressure sensor along I'm nebie in ESP8266 and Arduino coding .... and I tried interfacing blood pressure sensor and MAX30100 but both not working here is code for that ... please I really need help ... if anyone know how solve please contact me on this mail ID (1MS18TE400@gmail.com)

#include <Wire.h>
#include <SoftwareSerial.h>
#include "MAX30100_PulseOximeter.h"
//#include <Adafruit_MLX90614.h>
#define BLYNK_PRINT Serial
#include <Blynk.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

#define REPORTING_PERIOD_MS 100
char auth = ""; // You should get Auth Token in the Blynk App.
char ssid = ""; // Your WiFi credentials.
char pass = "";

PulseOximeter pox;
SoftwareSerial portTwo(15, 13);
//Adafruit_MLX90614 mlx = Adafruit_MLX90614();

uint32_t tsLastReport = 0;

int spo2;
char sbuffer[30], ch;
unsigned char pos;
unsigned char read1, read2, read3;

//double temp_amb = 0;
//double temp_obj = 0;
//double calibration = 2.36;
void onBeatDetected()
{
Serial.println("Beat!");

}
char mygetchar(void)
{ //receive serial character from sensor (blocking while nothing received)
while (!portTwo.available());
return portTwo.read();
}

void setup()
{
Serial.begin(115200);
Serial1.begin(9600);
portTwo.begin(9600);
Blynk.begin(auth, ssid, pass);

Serial.print("Initializing pulse oximeter..");

// Initialize the PulseOximeter instance
// Failures are generally due to an improper I2C wiring, missing power supply
// or wrong target chip
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);
// mlx.begin();
}

void loop()
{
Blynk.run();

pox.update();
spo2 = pox.getSpO2();
if (millis() - tsLastReport > REPORTING_PERIOD_MS) {
Serial.print("bpm / SpO2:");
Serial.print(spo2);
Serial.println("%");
Blynk.virtualWrite(V4, spo2);
tsLastReport = millis();
}
delay(10000);
///code for blood pressure sensor
ch = mygetchar(); //loop till character received
if (ch == 0x0A) // if received character is , 0x0A, 10 then process buffer
{
pos = 0; // buffer position reset for next reading

// extract data from serial buffer to 8 bit integer value
// convert data from ASCII to decimal
read1 = ((sbuffer[1] - '0') * 100) + ((sbuffer[2] - '0') * 10) + (sbuffer[3] - '0');
read2 = ((sbuffer[6] - '0') * 100) + ((sbuffer[7] - '0') * 10) + (sbuffer[8] - '0');
read3 = ((sbuffer[11] - '0') * 100) + ((sbuffer[12] - '0') * 10) + (sbuffer[13] - '0');

// Do whatever you wish to do with this sensor integer variables
// Show on LCD or Do some action as per your application
// Value of variables will be between 0-255

// example: send demo output to serial monitor on "Serial"
Serial.print("SYSTOLIC:");
Serial.print(read1);
Serial.print('\n');
Serial.print("DYSTOLIC:");
Serial.print(read2);
Serial.print('\n');
Serial.print("PULSE");
Serial.print(read3);
Serial.print('\n');
Serial.println();

} else { //store serial data to buffer
sbuffer[pos] = ch;
pos++;
}
delay(10000);

}

Please read the first topic "How to get the best from Forum", especially how to post code.

SCL, SDA, handles the I2C bus. The point using a bus is that it allows several devices ti be connected providing they use different addresses.

hello railroader
i tried providing addresses i getting error like "this syntax not with this model"
code-
mlx.begin(0x5A)
when I connect both sensor not even single sensor shows the output and I even connect the 4.7k pullup resistor to sda and scl line

Try and post the code the proper way. I found smileys and squares in it.
Have You verified that You use the proper address values? Have You trued using an address finding sketch?

#include<SPI.h>
#include <Wire.h>
#include "MAX30100_PulseOximeter.h"
#include <Adafruit_MLX90614.h>
#define BLYNK_PRINT Serial
#include <Blynk.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#define REPORTING_PERIOD_MS     100

char auth[] = "";    // You should get Auth Token in the Blynk App.
char ssid[] = "";                       // Your WiFi credentials.
char pass[] = "";

Adafruit_MLX90614 mlx = Adafruit_MLX90614();
PulseOximeter pox;

uint32_t tsLastReport = 0;
double temp_amb = 0;
double temp_obj = 0;
double calibration = 2.36;
int SpO2 = 0;

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



void setup() {
  Serial.begin(115200);
  mlx.begin();
  Blynk.begin(auth, ssid, pass);

  if (!pox.begin(0x57)) {
    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() {
  Blynk.run();
  pox.update();
  temp_amb = mlx.readAmbientTempC();
  temp_obj = mlx.readObjectTempC();
  SpO2 = pox.getSpO2();

  if (millis() - tsLastReport > REPORTING_PERIOD_MS) {
    Serial.print("bpm / SpO2:");
    Serial.print(SpO2);
    Serial.println("%");
    Serial.print("Room Temp = ");
    Serial.println(temp_amb);
    Serial.print("Object temp = ");
    Serial.println(temp_obj);

    Blynk.virtualWrite(V3, temp_obj);
    Blynk.virtualWrite(V4, SpO2);

    tsLastReport = millis();
  }
  delay(1000);


}

here this is the code which i using for to interface the max30100 and mlx90614 sensor
in(!pox.begin(0x57)) this line whenever I add the device address I'm getting error message..invalid conversion from 'int' to 'PulseOximeterDebuggingMode'

Check how to use the pox library, what kind if variable it expects.

Thats why im here im not getting proper information about that product

Look into the library files for that info.. h,. cpp, whatever..

#include <Arduino.h>

#include "MAX30100_PulseOximeter.h"


PulseOximeter::PulseOximeter() :
    state(PULSEOXIMETER_STATE_INIT),
    tsFirstBeatDetected(0),
    tsLastBeatDetected(0),
    tsLastBiasCheck(0),
    tsLastCurrentAdjustment(0),
    redLedCurrentIndex((uint8_t)RED_LED_CURRENT_START),
    irLedCurrent(DEFAULT_IR_LED_CURRENT),
    onBeatDetected(NULL)
{
}

bool PulseOximeter::begin(PulseOximeterDebuggingMode debuggingMode_)
{
    debuggingMode = debuggingMode_;

    bool ready = hrm.begin();

    if (!ready) {
        if (debuggingMode != PULSEOXIMETER_DEBUGGINGMODE_NONE) {
            Serial.println("Failed to initialize the HRM sensor");
        }
        return false;
    }

    hrm.setMode(MAX30100_MODE_SPO2_HR);
    hrm.setLedsCurrent(irLedCurrent, (LEDCurrent)redLedCurrentIndex);

    irDCRemover = DCRemover(DC_REMOVER_ALPHA);
    redDCRemover = DCRemover(DC_REMOVER_ALPHA);

    state = PULSEOXIMETER_STATE_IDLE;

    return true;
}

void PulseOximeter::update()
{
    hrm.update();

    checkSample();
    checkCurrentBias();
}

float PulseOximeter::getHeartRate()
{
    return beatDetector.getRate();
}

uint8_t PulseOximeter::getSpO2()
{
    return spO2calculator.getSpO2();
}

uint8_t PulseOximeter::getRedLedCurrentBias()
{
    return redLedCurrentIndex;
}

void PulseOximeter::setOnBeatDetectedCallback(void (*cb)())
{
    onBeatDetected = cb;
}

void PulseOximeter::setIRLedCurrent(LEDCurrent irLedNewCurrent)
{
    irLedCurrent = irLedNewCurrent;
    hrm.setLedsCurrent(irLedCurrent, (LEDCurrent)redLedCurrentIndex);
}

void PulseOximeter::shutdown()
{
    hrm.shutdown();
}

void PulseOximeter::resume()
{
    hrm.resume();
}

void PulseOximeter::checkSample()
{
    uint16_t rawIRValue, rawRedValue;

    // Dequeue all available samples, they're properly timed by the HRM
    while (hrm.getRawValues(&rawIRValue, &rawRedValue)) {
        float irACValue = irDCRemover.step(rawIRValue);
        float redACValue = redDCRemover.step(rawRedValue);

        // The signal fed to the beat detector is mirrored since the cleanest monotonic spike is below zero
        float filteredPulseValue = lpf.step(-irACValue);
        bool beatDetected = beatDetector.addSample(filteredPulseValue);

        if (beatDetector.getRate() > 0) {
            state = PULSEOXIMETER_STATE_DETECTING;
            spO2calculator.update(irACValue, redACValue, beatDetected);
        } else if (state == PULSEOXIMETER_STATE_DETECTING) {
            state = PULSEOXIMETER_STATE_IDLE;
            spO2calculator.reset();
        }

        switch (debuggingMode) {
            case PULSEOXIMETER_DEBUGGINGMODE_RAW_VALUES:
                Serial.print("R:");
                Serial.print(rawIRValue);
                Serial.print(",");
                Serial.println(rawRedValue);
                break;

            case PULSEOXIMETER_DEBUGGINGMODE_AC_VALUES:
                Serial.print("R:");
                Serial.print(irACValue);
                Serial.print(",");
                Serial.println(redACValue);
                break;

            case PULSEOXIMETER_DEBUGGINGMODE_PULSEDETECT:
                Serial.print("R:");
                Serial.print(filteredPulseValue);
                Serial.print(",");
                Serial.println(beatDetector.getCurrentThreshold());
                break;

            default:
                break;
        }

        if (beatDetected && onBeatDetected) {
            onBeatDetected();
        }
    }
}

void PulseOximeter::checkCurrentBias()
{
    // Follower that adjusts the red led current in order to have comparable DC baselines between
    // red and IR leds. The numbers are really magic: the less possible to avoid oscillations
    if (millis() - tsLastBiasCheck > CURRENT_ADJUSTMENT_PERIOD_MS) {
        bool changed = false;
        if (irDCRemover.getDCW() - redDCRemover.getDCW() > 70000 && redLedCurrentIndex < MAX30100_LED_CURR_50MA) {
            ++redLedCurrentIndex;
            changed = true;
        } else if (redDCRemover.getDCW() - irDCRemover.getDCW() > 70000 && redLedCurrentIndex > 0) {
            --redLedCurrentIndex;
            changed = true;
        }

        if (changed) {
            hrm.setLedsCurrent(irLedCurrent, (LEDCurrent)redLedCurrentIndex);
            tsLastCurrentAdjustment = millis();

            if (debuggingMode != PULSEOXIMETER_DEBUGGINGMODE_NONE) {
                Serial.print("I:");
                Serial.println(redLedCurrentIndex);
            }
        }

        tsLastBiasCheck = millis();
    }
}

this .cpp library file I did not get any useful thing

#include<SPI.h>
#include <Wire.h>
#include "MAX30100_PulseOximeter.h"
#include <Adafruit_MLX90614.h>
#define BLYNK_PRINT Serial
#include <Blynk.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#define REPORTING_PERIOD_MS     100

char auth[] = "";    // You should get Auth Token in the Blynk App.
char ssid[] = "";                       // Your WiFi credentials.
char pass[] = "";

Adafruit_MLX90614 mlx = Adafruit_MLX90614();
PulseOximeter pox;

uint32_t tsLastReport = 0;
double temp_amb = 0;
double temp_obj = 0;
double calibration = 2.36;
int SpO2 = 0;

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

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

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

  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() {
  Blynk.run();
  pox.update();
  temp_obj = mlx.readObjectTempF();
  SpO2 = pox.getSpO2();

  if (millis() - tsLastReport > REPORTING_PERIOD_MS) {
    Serial.print("bpm / SpO2:");
    Serial.print(SpO2);
    Serial.println("%");
    Serial.print("Object temp = ");
    Serial.println(temp_obj);

    Blynk.virtualWrite(V3, temp_obj);
    Blynk.virtualWrite(V4, SpO2);

    tsLastReport = millis();
  }


}

now i tried this code but in this code only MAX30100 printing the values properly but not both sensor

To me this line looks like a boolean can be used to activate debugging. Conclusion is that address can't be used here.

You have 2 sensors used as pox and mlx. Drop that 0x57 in .begin.
What happens if You just run pox.begin() resp. lmx.begin()?

if run the code with both mlx and max sensor ,in mlx i can add the address its possible. when do that and run the code only max sensor running correctly not both the sensors

Make a test and drop trying to supply the address. Maybe that is handled within the library.

but i can add the address in mlx but whenever I connect both sensor max sensor takes the i2c line and even tried to switch between the but even that approach worked ..

It's not easy to read and understand Your reply. You type all words after each other. Split the text in sentensies.
At least the code compiles and dowloads.
Is there any way You could deactivate the sensor that makes trouble? Activate it, read the sensor and then deactivate it....