doug-burrell / max30102

MAX30102 Pulse Oximetry Sensor code for Raspberry Pi
35 stars 21 forks source link

Error when running the script #2

Open ixforcesxi opened 3 years ago

ixforcesxi commented 3 years ago

Hi, I have this error when running the script, what is caused by ?

the sensor turned on, however no output

asdf

https://imgur.com/a/xSIN3Y1

doug-burrell commented 3 years ago

The error is occurring during an I2C write, have you got I2C enabled on your Rasberry Pi? And secondly have you got the Raspberry Pi Python libraries installed for I2C?

ixforcesxi commented 3 years ago

Hi, i fix my problem however, i have another problem: I will explain:

I'm using adafruit.io to display information from this sensor, I have modified your code such that in the self.print_result: is the following. if self.print_result: print("BPM: {0}, SpO2: {1}".format(self.bpm, spo2)) heartratefeed= aio.feeds('heart-rate') spo2feed=aio.feeds('spo2') aio.send_data(heartratefeed.key, self.bpm) aio.send_data(spo2feed.key, spo2)

However, adding this code for the aio makes the program run once, and then stop. (It will take one reading, then turn off the sensor.) Do you have knowledge why this behaviour is happening? How I can fix it? is there a way to extract the information from the main.py program?

Sorry to bother you .

abenko commented 3 years ago

The error is occurring during an I2C write, have you got I2C enabled on your Rasberry Pi? And secondly have you got the Raspberry Pi Python libraries installed for I2C?

Hey Doug!

Thank you for the code!

I also receive the same error.

I have enabled I2C and I have also installed all libraries.

I also think that my wiring is okay: VIN -> pin 4 SDA -> pin 3 SCL -> pin 5 GND -> pin 6

What do you think the problem could be?

doug-burrell commented 3 years ago

The error is occurring during an I2C write, have you got I2C enabled on your Rasberry Pi? And secondly have you got the Raspberry Pi Python libraries installed for I2C?

Hey Doug!

Thank you for the code!

I also receive the same error.

I have enabled I2C and I have also installed all libraries.

I also think that my wiring is okay: VIN -> pin 4 SDA -> pin 3 SCL -> pin 5 GND -> pin 6

What do you think the problem could be?

Hi, have you rebooted your Pi since you enabled I2C? That is a necessary step when enabling I2C on a Pi. Also if that doesn't solve it then I'd suggest installing i2ctools, it's a Linux tool for debugging I2C communications. There is an option to scan all slaves on the bus, I would suggest trying that to see if it sees your heartrate monitor.

Srivathsa-Bharadwaj commented 3 years ago

Hi, i fix my problem however, i have another problem: I will explain:

I'm using adafruit.io to display information from this sensor, I have modified your code such that in the self.print_result: is the following. if self.print_result: print("BPM: {0}, SpO2: {1}".format(self.bpm, spo2)) heartratefeed= aio.feeds('heart-rate') spo2feed=aio.feeds('spo2') aio.send_data(heartratefeed.key, self.bpm) aio.send_data(spo2feed.key, spo2)

However, adding this code for the aio makes the program run once, and then stop. (It will take one reading, then turn off the sensor.) Do you have knowledge why this behaviour is happening? How I can fix it? is there a way to extract the information from the main.py program?

Sorry to bother you .

Hi,

Can you please elaborate on how you solved OSerror 121 because even I am getting the same error, but I am unable to solve the issue.

Thank you

logiferguson124 commented 11 months ago

Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner self.run() File "/usr/lib/python3.9/threading.py", line 892, in run self._target(*self._args, **self._kwargs) File "/home/raspberrypi/Documents/max30102/heartrate_monitor.py", line 50, in run_sensor red, ir = sensor.read_fifo() File "/home/raspberrypi/Documents/max30102/max30102.py", line 128, in read_fifo reg_INTR1 = self.bus.read_i2c_block_data(self.address, REG_INTR_STATUS_1, 1) OSError: [Errno 121] Remote I/O error

when i use your code