grove.py
grove.py copied to clipboard
I2C error (Please check if the I2C device insert in I2C of Base Hat)
I'm getting this I2C error which I can't seem to figure out why:
raceback (most recent call last):
File "/home/pi/.local/lib/python3.9/site-packages/seeed_si114x.py", line 296, in _ReadByte
read_data = self.bus.read_byte_data(self.addr,Reg)
File "/usr/local/lib/python3.9/dist-packages/smbus2/smbus2.py", line 433, in read_byte_data
ioctl(self.fd, I2C_SMBUS, msg)
OSError: [Errno 121] Remote I/O error
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/pi/logic/./tests/sunlight_test.py", line 16, in <module>
main()
File "/home/pi/logic/./tests/sunlight_test.py", line 7, in main
SI1145 = seeed_si114x.grove_si114x()
File "/home/pi/.local/lib/python3.9/site-packages/seeed_si114x.py", line 184, in __init__
assert self.Begin() , "Please check if the I2C device insert in I2C of Base Hat"
File "/home/pi/.local/lib/python3.9/site-packages/seeed_si114x.py", line 194, in Begin
if self._ReadByte(SI114X_PART_ID) != 0X45:
File "/home/pi/.local/lib/python3.9/site-packages/seeed_si114x.py", line 298, in _ReadByte
raise OSError("Please check if the I2C device insert in I2C of Base Hat")
OSError: Please check if the I2C device insert in I2C of Base Hat
Exception ignored in: <function grove_si114x.__del__ at 0xb659cad8>
Traceback (most recent call last):
File "/home/pi/.local/lib/python3.9/site-packages/seeed_si114x.py", line 186, in __del__
self._WriteByte(SI114X_COMMAND, SI114X_RESET)
File "/home/pi/.local/lib/python3.9/site-packages/seeed_si114x.py", line 306, in _WriteByte
raise OSError("Please check if the I2C device insert in I2C of Base Hat")
OSError: Please check if the I2C device insert in I2C of Base Hat
The code I'm running is from: https://github.com/Seeed-Studio/Seeed_Python_SI114X/blob/master/examples/BasicRead.py but the error message indicates that it's within this library? (please correct me if I'm wrong)
- I found some sources claiming that the "OSError: Please check if the I2C device insert in I2C of Base Hat" is due to incorrect wiring but I don't see how this would be the case when using the Pi hat..
- I've checked with "i2cdetect -y 1" to make sure the device is recognised (it is)
- The above error ("OSError: [Errno 121] Remote I/O error") goes away when I type in the I2C device address manually (in my case 0x53), but the bottom error ("OSError: Please check if the I2C device insert in I2C of Base Hat") remains..
- I'm using this module from grove: https://wiki.seeedstudio.com/Grove-Sunlight_Sensor/
- I've tried clean-installing from scratch and only downloading the required libs for the hat+sensor
- I've also tried installing from source (this repo) instead of fetching directly from pip
- I've tried using a different Pi (same specs) just to be sure it's not an issue with my pi
Unfortunately I don't have any other I2C devices I can try.
i2cdetect -y 1 output:
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: 08 -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- 53 -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
I'm running raspbian 11 (bullseye) on a raspberry pi 4