I have a Raspberry Pi 3 Model B+. My I2C device which is this (exact breakout board) isn't getting detected through PIGPIO Library. The sensor works very well with the example codes which uses SMBUS library. Upon doing a i2cdetect -y 1, my device is beint detected and I receive the following :
pi@raspberrypi:~/Desktop $ i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- 0c -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
Initially, as I converted the SMBUS code to PIPGIO, I just got the i2c write failed errors and such and was very confused as no such errors were addressed anywhere on the net. Now, I found this code by the library's creator to check if the device is detected through the PIGPIO Library. This is the code :
#!/usr/bin/env python
# 2015-06-30
# i2c_detect.py
# Public Domain
import pigpio
pi = pigpio.pi() # connect to local Pi
for device in range(128):
h = pi.i2c_open(1, device)
try:
pi.i2c_read_byte(h)
print(hex(device))
except: # exception if i2c_read_byte fails
pass
pi.i2c_close(h)
pi.stop # disconnect from Pi
I used this and it just passes. To confirm my suspicion, I added a "print("Failed")" before the pass which returned this.
pi@raspberrypi:~/Desktop $ python i2chml.py
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
Failed
pi@raspberrypi:~/Desktop $
So that's the problem. I know my wiring and everything else is okay because I'm getting the intended output from the example code which uses SMBUS in the "Sparfun Hookup Guide" which I've thoroughly followed to set this up as well.
Over to you guys, I guess.