-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected behavior #2
Comments
Note that this seems like you might need to ping In my case, the example for what I used had this
|
About the i2cdetect value. The datasheet on Sensirion's website says in chapter 5.1 that the I2C address is 0x70, so this looks to be OK. |
Hi @RemBrandNL, It seems that you are using an SHTC3, which is simply not supported yet by this driver. @rnestler do you maybe know if there are intentions to add support for the SHTC3 as well? |
Ouch, amazed and surprised. I was so focussed on the errors I got I didn't realize I ordered the wrong ones, my apologies. I did a search for SHT3, but apparently somewhere down the lines fuzzy search kicked in. |
We have drivers for several platforms for the SHTC3 (or the SHTC1 which also works with the SHTC3):
At least not in the short term. But since it is still an active sensor it would make sense to add a Python driver as well for it. |
Awesome! But again, very new to programming and all and just trying to get a reliable sensors box in the backyard. My limited knowledge covers a bit of python and advanced googling. Code for Arduino and C unfortunately doesn't apply to me. Link 3 sent me in the right direction, got it to work and learned a few things as a bonus! Should someone end up here in the future. https://blog.dbrgn.ch/2018/8/20/read-shtc3-sensor-from-linux-raspberry-pi/ got me started, but the device would be gone after each reboot. Googled some more and this solved it for me (try at your own risk and all, might be cleaner ways):
After reboot this now works and you can easily test it by running
I then installed PySensors (
Not the easiest route, but I at least have a way to get the readings from the SHTC3 sensors I ordered. I'll keep my eyes open for any easier solutions, but for now this should suffice. Thanks again for all your help! PS: this specific test was done on Linux 5.10.11+ #1399 armv6l GNU/Linux, running on an old Raspberry Pi Model B Plus Rev 1.2. |
Good to hear you were able to read out the sensor! 👍 For your information, I just realized that there is actually one more way to read out the sensor. Maybe you are interested in this variant as well 🙂 With the from struct import unpack
from sensirion_i2c_driver import LinuxI2cTransceiver, I2cConnection, \
I2cDevice, SensirionI2cCommand, CrcCalculator
from sensirion_i2c_sht.sht3x import Sht3xTemperature, Sht3xHumidity
class Shtc3I2cCmdMeasure(SensirionI2cCommand):
def __init__(self):
super(Shtc3I2cCmdMeasure, self).__init__(
command=0x7866,
tx_data=[],
rx_length=6,
read_delay=0.02,
timeout=0,
crc=CrcCalculator(8, 0x31, 0xFF),
)
def interpret_response(self, data):
checked_data = SensirionI2cCommand.interpret_response(self, data)
temperature_ticks, humidity_ticks = unpack(">2H", checked_data)
return Sht3xTemperature(temperature_ticks), Sht3xHumidity(humidity_ticks)
with LinuxI2cTransceiver('/dev/i2c-1') as transceiver:
device = I2cDevice(I2cConnection(transceiver), 0x70)
temperature, humidity = device.execute(Shtc3I2cCmdMeasure())
print("Temperature: {}, Humidity: {}".format(temperature, humidity)) |
@ubruhin Let's just say I hope to arrive at a level where I can figure this out myself. I make a deep bow in respect, since it's spot on, no tweaking needed!! It looks safe enough to run it blindly (keep best practice in mind and all ;-) ) and it hit me with a 1 reboot later and added a 1 second loop:
This should be indeed a cleaner approach since you keep it all within python without other dependencies (OK, installing some modules). I'll test it on a clean install to see if I missed anything, but thanks again for all your help and support. Let's hope google indexes all this so it helps others as well. Cheers and have a great weekend! |
Awesome! 😃 I created an internal ticket to officially add support for the SHTC3 sensor some day. Let's close this issue now since the reason for the initial error is clear. |
Firstly, new to programming, github and all of this, so please correct me if this is not the right channel for this.
Ordered in some SHTC3 sensors to replace my BME280 of which I don't trust the RH data. Using this on old spare Raspberry PIPI and
i2cdetect -y 1
returns an address which gives me the impression it's recognized. Running the script @kratsg shared here however gives me: I2C transceive failed: [Errno 121] Remote I/O errorIs there some magic flag I missed, or just ordered from a wrong seller on the big bad internet?
Kind regards,
Remco
The text was updated successfully, but these errors were encountered: