Maker Pro
Maker Pro

Reading max30102 via i2c

CringeKid

May 13, 2021
4
Joined
May 13, 2021
Messages
4
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
 

Attachments

  • MAX30102.pdf
    895.8 KB · Views: 5

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,719
Joined
Nov 17, 2011
Messages
13,719
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?
 

CringeKid

May 13, 2021
4
Joined
May 13, 2021
Messages
4
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?
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,719
Joined
Nov 17, 2011
Messages
13,719
wire.read gets the data from an i2c device.
Which other functions would you want to use?
 

CringeKid

May 13, 2021
4
Joined
May 13, 2021
Messages
4
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?
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,719
Joined
Nov 17, 2011
Messages
13,719
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.
 
Top