Hello,
Hopefully someone here can help me out, I have a SHT31 temperature and humidity senor connected to my Omega2+ through the ADC dock.
Using i2cdetect I can see the device:
root@Omega-36E5:~# i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: UU -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- 44 -- -- -- -- 49 -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
(the device is 0x44)
The problem is when I try to read the sensor data from the device using a piece of example code I get a CRC error
package main
import (
"log"
i2c "github.com/d2r2/go-i2c"
sht3x "github.com/d2r2/go-sht3x"
)
func main() {
// Create new connection to I2C bus on 2 line with address 0x27
i2c, err := i2c.NewI2C(0x44, 0)
if err != nil {
log.Fatal(err)
}
// Free I2C connection on exit
defer i2c.Close()
sensor := sht3x.NewSHT3X()
temp, rh, err := sensor.ReadTemperatureAndRelativeHumidity(i2c, sht3x.RepeatabilityLow)
if err != nil {
log.Fatal(err)
}
log.Printf("Temperature and relative humidity = %v*C, %v%%", temp, rh)
}
The error in question is CRCs doesn't match: CRC from sensor (0xFF) != calculated CRC (0xE1)
I don't know how to check if I have a bad SHT31 or if the issue is with the library I'm using. I have not been able to work out how to manually read the sensor data using i2cget
to test that way (mostly due to my unfamiliarity with it).
root@Omega-36E5:~# i2cget -y 0 0x44
0x80
root@Omega-36E5:~# i2cget -y 0 0x44 0x80
0x80
Any good way to rule out bad hardware?