I'm trying to read data from sparkfun's HIH6130 Breakout for measuring humidity and temp data. Following this instructable (though without the i2c shield for the pi), the provided python code just gets the maximum values possible for the device. Looking at the I2C lines on a scope, it looks like the smbus2 library is sending a write bit when it should send a read. After googling, it looks like the HIH6130 is not compatible with SMBus, as it does not have registers to request from, and the code from the instructable used read_i2c_block_data(), which needs to specify a register.

Is there a python library that can actually do I2C (not SMBus) communication? Or is there some way to use smbus2 to just send a read bit? I've looked at write_quick() but I need that for reading. The code below does seem to send a read bit, but the data values do not change as expected when temp and humidity change.

The wiring is definitely fine as the pi detects the device at the correct address. Also, the sensor sends correct values when interfacing with Arduino and the Wire library, which I understand to be actually I2C and not SMBus.

Any suggestions for what I can do? I just need to specify a read bit and then read four bytes from the HIH6130.


from smbus2 import SMBus, i2c_msg
import time

bus = SMBus(1)
msg = i2c_msg.read(0x27, 4)

while 1:

        # Access the data in the msg object
        data = list(msg)

1 Answer 1


The pigpio Python module will issue raw I2C commands.

I2C read

I2C write

The lg local and lg remote Python modules can do the same.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.