I just can't read my GY-271 HMC5883L module. I always get "OSerror: [Errno 121] Remote I/O error" as an error. Can someone help me here?
Traceback (most recent call last):
File "test.py", line 3, in <module>
hmc5883l = i2c_hmc5883l.i2c_hmc5883l(1)
File "/home/pi/Desktop/software/i2clibraries/i2c_hmc5883l.py", line 29, in __init__
self.setScale(gauss)
File "/home/pi/Desktop/software/i2clibraries/i2c_hmc5883l.py", line 76, in setScale
self.setOption(self.ConfigurationRegisterB, self.scale_reg)
File "/home/pi/Desktop/software/i2clibraries/i2c_hmc5883l.py", line 87, in setOption
self.bus.write_byte(register, options)
File "/home/pi/Desktop/software/i2clibraries/i2c.py", line 14, in write_byte
writing_bytes(self.addr, *bytes))
File "/usr/local/lib/python3.7/dist-packages/quick2wire_api-0.0.0.2-py3.7.egg/quick2wire/i2c.py", line 78, in transaction
OSError: [Errno 121] Remote I/O error
Code:
from i2clibraries import i2c_hmc5883l
hmc5883l = i2c_hmc5883l.i2c_hmc5883l(1)
hmc5883l.setContinuousMode()
hmc5883l.setDeclination(4, 22)
print(hmc5883l)
i2cdetect -y 1:
i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- 0d -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
The OSError: [Errno 121] Remote I/O Error
indicates that an I2C device isn't connected to the bus. Make sure that the sensors are securely connected to the I2C bus.