Hi i want to try out the MAX30105 Breakout Bord with Breakout Garden. I used the heartbeat example and got the following error message:
Traceback (most recent call last):
File “/home/pi/breakout-garden-master/examples/heartbeat/heartbeat.py”, line 41, in
max30105.setup(leds_enable=2)
File “/usr/local/lib/python3.7/dist-packages/max30105-0.0.2-py3.7.egg/max30105/init.py”, line 319, in setup
self.soft_reset(timeout=timeout)
File “/usr/local/lib/python3.7/dist-packages/max30105-0.0.2-py3.7.egg/max30105/init.py”, line 353, in soft_reset
while self._max30105.get(‘MODE_CONFIG’).reset and time.time() - t_start < timeout:
File “/usr/local/lib/python3.7/dist-packages/i2cdevice-0.0.6-py3.7.egg/i2cdevice/init.py”, line 232, in get
result[field] = self.get_field(register, field)
File “/usr/local/lib/python3.7/dist-packages/i2cdevice-0.0.6-py3.7.egg/i2cdevice/init.py”, line 247, in get_field
value = field.adapter._decode(value)
File “/usr/local/lib/python3.7/dist-packages/i2cdevice-0.0.6-py3.7.egg/i2cdevice/adapter.py”, line 26, in _decode
raise ValueError("{} not in lookup table".format(value))
ValueError: 0 not in lookup table
I2c is working, because othe examples are working!
I have the same problem/error.
I installed a clean copy of Raspbian Buster (July 2019 version) and the latest version of the library from github (https://github.com/pimoroni/max30105-python.git)
I’m trying on a Raspberry Pi 4 with 4 GB RAM
What I tried:
Switching between python 2 and 3
Cloning the latest version of the library after installing with pip
Using a fresh installed and updated version of Raspbian Buster
Error:
pi@raspberrypi:~/max30105-python/examples $ python read-heartbeat.py
Traceback (most recent call last):
File “read-heartbeat.py”, line 10, in
max30105.setup(leds_enable=2)
File “/usr/local/lib/python2.7/dist-packages/max30105/init.py”, line 319, in setup
self.soft_reset(timeout=timeout)
File “/usr/local/lib/python2.7/dist-packages/max30105/init.py”, line 353, in soft_reset
while self._max30105.get(‘MODE_CONFIG’).reset and time.time() - t_start < timeout:
File “/usr/local/lib/python2.7/dist-packages/i2cdevice/init.py”, line 232, in get
result[field] = self.get_field(register, field)
File “/usr/local/lib/python2.7/dist-packages/i2cdevice/init.py”, line 247, in get_field
value = field.adapter._decode(value)
File “/usr/local/lib/python2.7/dist-packages/i2cdevice/adapter.py”, line 26, in _decode
raise ValueError("{} not in lookup table".format(value))
ValueError: 0 not in lookup table
I don’t have the right widgets with me to attempt a fix right now, but this obtuse error is actually i2cdevice trying to convert a value read from the sensor into something meaningful. There has been a pull request recently for i2cdevice that - iirc - makes this error more legible.
Looking at the stack trace though it appears to be a read from the “MODE_CONFIG” register that’s returning a zero in some bitfield that it doesn’t expect.
The MAX30105 library will need modifying to allow a 0 value in this case.
I also tried the possible short term fix but the error is still the same. Can you link the pull request so we can follow the status? Is there anything we can do, commenting on the pull request with more information for example?