max30102 notes

When I run source code the sensor Max30100, I get an error remote i/o error
Ask Question
Asked 3 days ago
Active 3 days ago
Viewed 43 times


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.


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():
mx30 = max30100.MAX30100()
# mx30.reset()
# time.sleep(1)
# mx30.startup()
# time.sleep(1)

i = 0
while i < 30:
# # 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()
# time.sleep(1)
# 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))

i = i + 1
# mx30.shutdown()

except Exception as e:
print(“Max30100 got exception {}”.format(e))

if __name__ == “__main__”:

connection PINS GPIO and sensor max30100

(3.3V -VIN)
(I2C SDA1 – SDA)
(I2C SCL1 – SCL)
(PIN7 – INT )
Can anyone help me to fix this issue?

python i2c sensor
edited May 1 at 4:10

41.5k1919 gold badges6868 silver badges143143 bronze badges
asked May 1 at 2:46

saeed sadati
1111 bronze badge
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 May 1 at 3:03
One more trick to reduce overloading I2C bus: REMOVE ALL PULLUPs on the modules (Rpi I2C pins also have 1k8 strong pullup). – tlfong01 May 1 at 3:05
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 May 1 at 3:15
(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 May 1 at 3:16
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 May 1 at 3:39
And there is the noise problem, that might also cause data transmission IO error, thought not the frequent. On troubleshooting trick is to use battery power. For noise sensitive sensors, I usually use 18650 Lipo Power Bank and step down to 5V or 3V, to make sure no line 50/60Hz interfering the heart pulse signal. You might like to read the answer about ECG heart pulse meter to see how I use Lipo power bank to reduce noise: raspberrypi.stackexchange.com/questions/98416/…. – tlfong01 May 1 at 4:20

Invariably poor wiring. You need to add a clear photo or photos showing the I2C connections if you want practical help. – joan May 1 at 8:06

@tlfong01 Hi ,thanks for your response , I changed the wire. No change. – saeed sadati 2 days ago
Hi @saeed sadati, yest one more troubleshooting suggestion: Use another I2C device to check that I2C hardware/software are basically OK. – tlfong01 2 days ago

@tlfong01 Hi ,I hope that the good state.Error remote i/o error was resolved. I think it was a connection.When I run the code, the sensor starts flashing, but even though I put my finger on the sensor, it still shows zero(0). – saeed sadati 8 hours ago
Hi @saeed sadati, How nice to hear that you solved the I2C I/O Error #121 problem. Perhaps I can follow the tutorial you are following and see if I can suggest anything, and then come back to you. – tlfong01 8 hours ago

@tlfong01, thanks a lot – saeed sadati 8 hours ago
Question: Are you using the following or similar cheap toy: (1) “GY-MAX30100 Heart Rate Oxygen Concentration Sensor – FYD Open Source Hardware, US$7”:: fr.aliexpress.com/item/32749194911.html. – tlfong01 7 hours ago

answer:I use the same as below: amazon.com/Lysignal-MAX30100-Oximeter-Assistant-Monitoring/dp/… – saeed sadati 7 hours ago
I skimmed the python driver/library you are using and found it good. Now let me see. If (1) “i2cdetect – y 1” can detect the device, and (2) no more #122 IO errors, then means general setup is OK. Now (3) You read zero output. Now please confirm if you are using the program “test_max30100.py” and show us the output message and see if we can help. I found the python class and test in python are well documented. Perhaps you can insert debug print statements to narrow down the trouble making area. / to continue, … – tlfong01 7 hours ago
(1) “Amazon MAX30100 Pulse Oximeter Heart Rate Sensor Module – Lysignal”: amazon.com/dp/B073W999X2 (2) “MAX30100 Pulse Oximeter and Heart-Rate Sensor IC for Wearable Health Datasheet – Maxim”: datasheets.maximintegrated.com/en/ds/MAX30100.pdf (3) “whilemind/MAX30100u max30100 heart rate and oxygen sensor driver in python – whilemind/MAX30100u”: github.com/whilemind/MAX30100u (4) “whilemind/MAX30100u max30100.py (Class)”: github.com/whilemind/MAX30100u/blob/master/max30100.py, / to continue, … – tlfong01 7 hours ago
(5) “whilemind/MAX30100u MAX30100u/test_max30100.py (Test)”: github.com/whilemind/MAX30100u/blob/master/test_max30100.py (6) “whilemind/MAX30100u C Source for Arduino”: github.com/whilemind/MAX30100u/tree/master/csource. Good luck and cheers. – tlfong01 7 hours ago
BTW, the python library actually includes an Arduino C++ Library (Ref #6 above) . If by any chance you have have an Arduino in hand, you can test it (just to make sure your sensor is working OK) using Arduno. But don’t let your bad Anono friends know about it, or they will LOL:) – tlfong01 6 hours ago

I will test with Ardino. output now :i.stack.imgur.com/miYRF.png – saeed sadati 6 hours ago
Ha, I am glad to see that you are using Thonny to test the “test_max30100.py” program. I used to think that Rpi IDLE IDE is good to play with python. Now I think Thonny is even better. Anyway, I shall wait to hear the good news from your stupid Arduino. In the mean time I will check out the test_max30100.py and perhaps suggest a troubleshooting plan later. Ah, locking up lunch time now! Good luck and cheers. – tlfong01 4 hours ago
So eating my lunch, at the same time googling around. I found this interesting: (7) “Pulse Oximeter MAX30100/MAX30102 – how to fix wrong board – Valeriy Yatsenkov 2018apr22”: reedpaper.wordpress.com/2018/08/22/…. The funny guy Yatsenkov tells us two things: (8) max30100 is old model and discontinued, and now replaced by max30102. (9) The bad guys up North of my city had made a huge mistake (no, not the virus thing :)) and are trying to cover it up by redesigning something. Anyway, let me finish my noodle and come back later. – tlfong01 4 hours ago
So if you read Yatsenkov’s post and finally make your max30100 sensor module working for Arduino, you might come back to Rpi and try your luck again. Just now I skimmed the max30100 library’s class and test program and found them quite straightforward as usual the basic step: (1) create a max30100 sensor object, (2) reset sensor object, – tlfong01 2 hours ago
(3) read sensor object. I know your sensor returns zero. I found that the class has other methods like “read temperature”. So perhaps you might like to see if you can read temperature, and if OK, then move on to read sensor. You might also like to use the class’s read registers to see if you can properly read the register. As I said the library is quite short, only about 250 python statements. The test program is even shorter, so you can mess around with the max30100 class’s methods. Let me me know if you got stuck. Good luck and cheers. – tlfong01 2 hours ago
I am writing a penzu reading log: penzu.com/p/86a772c1. You might like to refer to the included list of reference and listings of programs for future discussions. – tlfong01 1 hour ago
Now I am reading the datasheet to see what is inside the MAX30102 chip, and try to read the registers: penzu.com/p/abd5ffe9. I am thinking of first reading the Part ID Register at address 0xFF. I usually read this register as a first step in testing and troubleshooting. Ah, almost supper time. See you late this evening, or tomorrow.Cheers. – tlfong01 1 hour ago Delete

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.