rsc1975 / micropython-sht30

SHT30 sensor driver in pure python based on I2C bus
Apache License 2.0
46 stars 27 forks source link

SHT30Error: Bus error with Raspberry Pi Pico and Adafruit SHT-30 Mesh-protected Weatherproof temp/hum sensor #3

Open Katoen58 opened 1 year ago

Katoen58 commented 1 year ago

Hi Roberto and Matthew

I don't know if I'm correct making an issue on Github for this when running into the above problem. Otherwise tell me where to put it correctly.

I tried to get the Adafruit SHT-30 Mesh-protected Weather-proof Temperature/Humidity Sensor on a Raspberry Pi Pico (other platform than where you made this driver for, I'm aware of that fact) with micropython: MicroPython v1.19.1-746-gf2de289ef on 2022-12-13; Raspberry Pi Pico W with RP2040.

In order to get the sensor recognised I had to make changes to the /lib/sht30/ht30.py file: Line 9: DEFAULT_I2C_ADDRESS = 0x44 (instead of 45) Lines 40 and 46: scl_pin=17, sda_pin=16 (instead of 4 and 5; SHT-30 connected to corresponding Pico hardware pins) Line 41: self.i2c = I2C(0, scl=Pin(scl_pin), sda=Pin(sda_pin)) (I had to add '0, ' otherwise I got 'TypeError: 'id' argument required')

When I run your example-scripts:

How to get the temperature and relative humidity (as did the Read and Reset examples):

%Run -c $EDITOR_CONTENT Traceback (most recent call last): File "", line 5, in File "/lib/sht30/sht30.py", line 137, in measure File "/lib/sht30/sht30.py", line 102, in send_cmd SHT30Error: Bus error

Check if shield is connected:

%Run -c $EDITOR_CONTENT Is connected: True

An I2C-scan:

%Run -c $EDITOR_CONTENT i2c devices found: 1 At address: 0x44

I even got these error-messages when putting 2.2 or 4.7 kOhm resistors between sda/scl and VCC. Also the Adafruit LTC4311 I2C active terminator didn't change a thing... Running the SHT-30 on a Raspberry Pi 4 with yhe Adafruit CircuitPython makes it work fine.

I hope you can help.

Best regards,

Bart Elffers.

vilisseranen commented 1 year ago

Hello @Katoen58, in case you are still looking to run the SHT30 on a raspberry pi pico, I was successful using https://github.com/n1kdo/temperature-sht30/blob/master/src/temperature/sht30.py.

Katoen58 commented 1 year ago

Hi Clement,Thanks for your tip! I ran int other projects and cycling holidays, but I will certainly look at this driver/script. Bart.Verstuurd vanaf mijn Raspberry Pi!Op 2 sep. 2023 om 02:41 heeft Clément Contini @.***> het volgende geschreven: Hello @Katoen58, in case you are still looking to run the SHT30 on a raspberry pi pico, I was successful using https://github.com/n1kdo/temperature-sht30/blob/master/src/temperature/sht30.py.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>