I'd like to get two I2C sensors connected to one Arduino UNO to work, namely the MAX30100 pulsoximeter and the Bosch BME280 sensor. I have purchased the components here:
Both sensors work flawlessly with the provided test sketches. However, when I merge the sketches, the Max30100 only displays 0 bpm and 0 spo2. I can kind of solve this problem by resetting the I2C connection after measuring with the MAX30100 but then I only manage to get one reasonable reading of the MAX30100 sensor.
The output of the I2C scanner reports following register addresses for the sensors:
I2C device found at address 0x57 ! (MAX30100)
I2C device found at address 0x76 ! (BME280)
My guess is that the heart rate sensor library depends on the 400kHz I2C frequency to work correctly but the BME280 library resets it to 100kHz.
Have you tried initializing the BME before the MAX30100?
Dear pylon,
Thank you a lot for your help. I've tried to initialize the BME280 first, please see the full sketch below. The Serial.print of the Max30100 sensor is still 0 for heart rate and 0 for SpO2