M5Stack Heart Unit

I have MAX30100 oxygen/heartbeat sensor in M5Stack Heart Unit with which i communcicate via I2C.
Arduino example :scan for I2C is able to see the device and prints it's address but i am not able to communicate with it. Lib for MAX30100 just freezes on initialization.

How can i fix that? May there be problem in Max30100 library, or examples ino file??

Post a complete sketch that tries to communicate with the sensor. What address does the scanner report and what happens when you run the sketch ? Which Arduino board are you using ?

So I am using Arduino UNO board, scaner report address 0x57 (it agrees with unit datasheet, so it is correct i suppose). When i run it and monitor COM port it shows first message: "Initializing pulse oximeter..", and nothing else. No error, no success message.
Also I use minimal example from library:

#include <Wire.h>
#include "MAX30100_PulseOximeter.h"
#define REPORTING_PERIOD_MS     1000

PulseOximeter pox;
uint32_t tsLastReport = 0;

void setup()
{
    Serial.begin(115200);
    Serial.print("Initializing pulse oximeter..");
    Delay(1000);

    if (!pox.begin()) {
        Serial.println("FAILED");
        for(;;);
    } else {
        Serial.println("SUCCESS");
    }
    // Register a callback for the beat detection
    pox.setOnBeatDetectedCallback(onBeatDetected);
}

void loop()
{
    // Make sure to call update as fast as possible
    pox.update();

    // Asynchronously dump heart rate and oxidation levels to the serial
    // For both, a value of 0 means "invalid"
    if (millis() - tsLastReport > REPORTING_PERIOD_MS) {
        Serial.print("Heart rate:");
        Serial.print(pox.getHeartRate());
        Serial.print("bpm / SpO2:");
        Serial.print(pox.getSpO2());
        Serial.println("%");

        tsLastReport = millis();
    }
}

I also tried connecting via tester examle, but again no responser after initializing print.
It's part of tester code, to point where it is not working anyway:

#include <Wire.h>
#include "MAX30100.h"
MAX30100 sensor;
void setup()
{
    Serial.begin(115200);

    Serial.print("Initializing MAX30100..");

    if (!sensor.begin()) {
        Serial.print("FAILED: ");

        uint8_t partId = sensor.getPartId();
        if (partId == 0xff) {
            Serial.println("I2C error");
        } else {
            Serial.print("wrong part ID 0x");
            Serial.print(partId, HEX);
            Serial.print(" (expected: 0x");
            Serial.println(EXPECTED_PART_ID, HEX);
        }
        // Stop here
        for(;;);
    } else {
        Serial.println("Success");
    }

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