Quantcast
Viewing all articles
Browse latest Browse all 3780

Troubleshooting • SHT31 sensor - changing I2C address on the Pi 3B (0x45 to 0x44)

Hello

I'm trying to connect the SHT31 temperature and humidity sensor to a Raspberry Pi 3B. I'm using the Adafruit sht31d library, so Blinka is installed, and this is my code:

Code:

import timeimport boardimport adafruit_sht31d as sht31dsensor = sht31d.SHT31D(i2c)while True:    print("\nTemperature: %0.1f C" % sensor.temperature)    print("Humidity: %0.1f %%" % sensor.relative_humidity)    time.sleep(2)
Which results in "ValueError: No I2C device at address: 0x44". That's not surprising because scanning the bus shows the SHT31 at 0x45.

This sensor can use 0x44 or 0x45, depending on the pin it's connected to. The Arduino documentation says this depends on whether the address pin is connected to Vcc or GND, but connecting up the Raspberry Pi isn't mentioned. It's currently connected to pins:

1 (VDC)
3 (SDA1 / I2C)
5 (SCL1 / I2C)
9 (ground)

Any ideas on what to change (wiring or code) to move to 0x44 - or to read 0x45 instead - would be much appreciated. I'm new to this, so not sure if there's an obvious solution or not, though a web search hasn't turned up a solution.

Statistics: Posted by Centuri — Fri Oct 11, 2024 8:37 pm



Viewing all articles
Browse latest Browse all 3780

Trending Articles