Connect with us

Reading max30102 via i2c

Discussion in 'Microcontrollers, Programming and IoT' started by CringeKid, May 13, 2021.

Scroll to continue with content
  1. CringeKid

    CringeKid

    4
    0
    May 13, 2021
    This sensor reads heart rate and spo2 but idk how to get these values from it. Can someone help me out?
    I have attached the datasheet
     

    Attached Files:

  2. Harald Kapp

    Harald Kapp Moderator Moderator

    11,413
    2,619
    Nov 17, 2011
    Which processor do you use to control the i²c bus? Which programming environment (assembler, C, Python, ...)?
    Have you tried to locate a library for your processor/programming environment and the MAX30102?
     
  3. CringeKid

    CringeKid

    4
    0
    May 13, 2021
    I'm using nodemcu and will be coding with Arduino IDE. Yes, i do have the libraries needed for it. I just don't know how to code it. Along with this sensor, i have the max30205 as well. Once i get the unique address of the device, i can use wire.requestfrom() to communicate with it right?
    So i do have the code for reading data from each individual sensor cuz i have the libraries for it. So do i just hit requestfrom() and initiate communication with that device, use the code from that particular library and then request from the other sensor and do the same?
     
  4. Harald Kapp

    Harald Kapp Moderator Moderator

    11,413
    2,619
    Nov 17, 2011
  5. CringeKid

    CringeKid

    4
    0
    May 13, 2021
    Yes I've seen it but my question is, once i use wire.requestfrom() to request data, is the data only retrievable with wire.read() or can the functions from these libraries be used to do retrieve them?
     
  6. Harald Kapp

    Harald Kapp Moderator Moderator

    11,413
    2,619
    Nov 17, 2011
    wire.read gets the data from an i2c device.
    Which other functions would you want to use?
     
  7. CringeKid

    CringeKid

    4
    0
    May 13, 2021
    The libraries that I'm using have certain functions like gettemp() or getheartrate(). These functions would work if im using a single sensor. But would they work if im using i2c?
     
  8. Harald Kapp

    Harald Kapp Moderator Moderator

    11,413
    2,619
    Nov 17, 2011
    If the libraries are designed for i2c: yes.
    If not: no.

    What a library can do or not you'll have to find in the README for the library or by studying the code of the library and the examples. You'll find useful hints in the comments of the examples (usually).
    It is common for such libraries to offer different layers of abstraction. You may find sensor_read() functions that deliver raw sensor data, but also higher level functions like gettemp() that convert the raw data into a user friendly format.
    What exactly -> see the library's documentation.
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-