0
I want to connect the sensor max30100 to the Raspberry Pi board.I think everything is accurate.When I run the code, the red light flashes.I activated I2C.max30100 device address 0x57 is detected. When I put my hand on the sensor, I get the following error.
Error:
max30100 got exception [errno 121] remote i/o error
I use the source code below.
import os
import sys
import time
import max30100
def main():
try:
mx30 = max30100.MAX30100()
mx30.set_mode(max30100.MODE_SPO2)
# mx30.reset()
# time.sleep(1)
# mx30.startup()
# time.sleep(1)
i = 0
while i < 30:
mx30.set_mode(max30100.MODE_HR)
mx30.read_sensor()
# # The latest values are now available via .ir and .red
# print("HeartRate sensor .ir: {} and .red: {}".format(mx30.ir, mx30.red))
# time.sleep(2)
mx30 = max30100.MAX30100()
mx30.reinit()
mx30.set_mode(max30100.MODE_SPO2)
# time.sleep(1)
mx30.read_sensor()
# The latest values are now available via .ir and .red
print("HRate sensor .ir: {} and SpO2 .red: {}".format(mx30.ir, mx30.red))
# temp = mx30.get_temperature()
# print("Temperature {}\n".format(temp))
mx30.reset()
time.sleep(1)
i = i + 1
mx30.reset()
# mx30.shutdown()
except Exception as e:
print("Max30100 got exception {}".format(e))
if __name__ == "__main__":
main()
https://github.com/whilemind/MAX30100u
connection PINS GPIO and sensor max30100
(3.3V -VIN)
(I2C SDA1 - SDA)
(I2C SCL1 - SCL)
(PIN7 - INT )
(GND - GND)
Can anyone help me to fix this issue?
New contributor
-
(1) [errno 121] remote i/o error usually means the following: (a) data transmission error, because wires too long, speed too high, impedance overloaded (too many i2c devices on the same bus exceeding 400pF limit) (2) workarounds include (i) remove other devices to other I2C buses (for R4, you have many buses to use), (ii) lower speed to 50k or even 10k, to see if problem disappeared. (3) i2cdetect -y 1 only pings (read something, no guarantee can read-after-write), refactoring wiring, say star to daisy chain topology, to reduce capacitance, (4) Avoid interrupt in prelimin test. Cheers. – tlfong01 37 mins ago
-
One more trick to reduce overloading I2C bus: REMOVE ALL PULLUPs on the modules (Rpi I2C pins also have 1k8 strong pullup). – tlfong01 35 mins ago
-
PS – I am using the following references: (1) “MAX30100 Pulse Oximeter and Heart-Rate Sensor IC for Wearable Health datasheet- Maxim”: datasheets.maximintegrated.com/en/ds/MAX30100.pdf, (2) “AliExpress MAX30102 heart rate sensor / blood oxygen sensor MAX30100 heart rate sensor pulse oximeter – US$1.65”: fr.aliexpress.com/item/…, – tlfong01 25 mins ago
-
(3) “AliExpress OxyMeter Catalog”: aliexpress.com/popular/pulse-oximeter-sensor.html. (4) I am assuming you are using the Ref 2 cheap toy which is coronaVirus friendly. Please let me know otherwise:) – tlfong01 24 mins ago
-
If your are using whilemind/MAX30100u’s test_max30100.py, you can add debug print statement. Or you can try to read-after-write the ConfigReg at address 0x06. You can also try your luck on other python max30100 python/C libraries: (1) “mfitzp/max30100 – A Python lib for MAX30100 HR/Oximetry sensor”: github.com/mfitzp/max30100, (2) “kontakt/MAX30100 – Lib Maxim MAX30100 pulse oximetry chip”: github.com/kontakt/MAX30100, (3) “whilemind/MAX30100u – max30100 heart rate and oxygen sensor driver in python”: github.com/whilemind/MAX30100u. Good luck cheers. – tlfong01 1 min ago Edit
.END
Categories: Uncategorized