This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Heart rate sensor used on nrf52 DK

I am currently working on a project using the MAX30102 Heart rate module. This sensor has red & ir led's. I connected the the max30102 sensor to the nrf52 DK as follows

VDD -> VDD
GND -> GND
SDA -> P0.26
SCL -> P0.27
INT  -> P0.17

I have also connected the GND DETECT of the IO/Expander -> GND

Im using the twi_sensor example from the sdk. the code initializing the twi and sensor looks as follows:

void twi_init (void)

{

    ret_code_t err_code;

    const nrf_drv_twi_config_t twi_lm75b_config = {

       .scl                = 27,

       .sda                = 26,

       .frequency          = NRF_DRV_TWI_FREQ_100K,

       .interrupt_priority = APP_IRQ_PRIORITY_HIGH,

       .clear_bus_init     = false

    };

    err_code = nrf_drv_twi_init(&m_twi, &twi_lm75b_config, twi_handler, NULL);

    APP_ERROR_CHECK(err_code);

    nrf_drv_twi_enable(&m_twi);

}

void MAX30102_setup (void)

{

write_register(INT_ENABLE_1, 0xC0);

write_register(INT_ENABLE_2, 0x00);

write_register(FIFO_WR_PTR, 0x00); // Reset FIFO Write pointer

write_register(OVERFLOW_CTR, 0x00); // Reset OVERFLOW_CTR pointer

write_register(FIFO_RD_PTR, 0x00); // Reset FIFO READ pointer

write_register(FIFO_CONF, 0x4F); //average sampling  = 4

write_register(MODE_CONF, 0x03); // ADC range = 4096nA | Sampling Rate = 100 Hz | LED pulseWidth = 411uS

write_register(SPO2_CONF, 0x27); // 400 samples per second

write_register(LED1_PA, 0x3F); // LED1 current = 19 mA

write_register(LED2_PA, 0x3F); // LED2 current = 19 mA

write_register(PILOT_PA, 0x7F); // Pilot LED ~ 25mA

}


With this being said, the red led seems to be very faint and not bright enough. Im not sure if theres a problem with my connections or if i have to configure anything else. Any help would be appreciated. Attached pinout and description can be found.

  • Hi,

    Do the LED light up regardless of whether the setup commands are sent on the TWI bus or not? Have you checked the bus with a logic analyzer to see if all the expected commands are sent? What happens inside write_register()?

    If the commands are sent correctly, the issue is most likely with other parts of the sensor connections, or with the commands. In this case you need to check the datasheet of the device if everything is correct.

    Best regards,
    Jørgen

Related