Due to high demand, expect some shipping delays at this time - orders may not ship for up to 2-3 business days.
0

Using External SHT31-D with CLUE (Stemma QT)
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Using External SHT31-D with CLUE (Stemma QT)

by clpie on Tue Nov 02, 2021 4:57 pm

Hi there,

I'm not sure how to use the external temperature/humidity sensor (via Stemma QT connector next to power socket)....

When I run this code:

Code: Select all | TOGGLE FULL SIZE
import board
import busio

REGISTERS = (0, 256)  # Range of registers to read, from the first up to (but
                      # not including!) the second value.

REGISTER_SIZE = 2     # Number of bytes to read from each register.

# Initialize and lock the I2C bus.
i2c = busio.I2C(board.SCL, board.SDA)
while not i2c.try_lock():
    pass

# Find the first I2C device available.
devices = i2c.scan()
while len(devices) < 1:
    devices = i2c.scan()

print([hex(x) for x in devices])


I get this output:

Code: Select all | TOGGLE FULL SIZE
code.py output:
['0x1c', '0x39', '0x44', '0x6a', '0x77']


The output is the same with and without the sensor being connected. Does this mean it's not being detected? Or is it because it's using the same address as the onboard sensor? ...

I noticed the CLUE Circuit Python example for temperature and humidity doesn't work when I have the sensor connected. It says "RuntimeError: CRC mismatch".

Does anyone know the how to use an external SHT31-D sensor with CLUE?

Thank you ;)

clpie
 
Posts: 21
Joined: Fri Jul 02, 2021 5:38 am

Re: Using External SHT31-D with CLUE (Stemma QT)

by clpie on Tue Nov 02, 2021 5:05 pm

If I run this code:

Code: Select all | TOGGLE FULL SIZE
import board
import busio
import adafruit_sht31d
i2c = busio.I2C(board.SCL, board.SDA)
sensor = adafruit_sht31d.SHT31D(i2c)

print('Humidity: {0}%'.format(sensor.relative_humidity))
print('Temperature: {0}C'.format(sensor.temperature))


I get this error message:

Code: Select all | TOGGLE FULL SIZE
code.py output:
Traceback (most recent call last):
  File "code.py", line 7, in <module>
  File "adafruit_sht31d.py", line 376, in relative_humidity
  File "adafruit_sht31d.py", line 259, in _read
  File "adafruit_sht31d.py", line 240, in _data
  File "adafruit_sht31d.py", line 140, in _unpack
RuntimeError: CRC mismatch

clpie
 
Posts: 21
Joined: Fri Jul 02, 2021 5:38 am

Re: Using External SHT31-D with CLUE (Stemma QT)

by clpie on Tue Nov 02, 2021 5:09 pm

Perhaps it's using the same address as the onboard sensor and it's somehow conflicting?

Is it possible to disable the onboard sensor or change the address of the external sensor?

clpie
 
Posts: 21
Joined: Fri Jul 02, 2021 5:38 am

Re: Using External SHT31-D with CLUE (Stemma QT)

by clpie on Tue Nov 02, 2021 5:35 pm

OK I wired the ADDR to VIN on the sensor to change the address to 0x45 and it worked, with this code:

Code: Select all | TOGGLE FULL SIZE
import board
import busio
import adafruit_sht31d
i2c = busio.I2C(board.SCL, board.SDA)
sensor = adafruit_sht31d.SHT31D(i2c, 0x45 )

print('Humidity: {0}%'.format(sensor.relative_humidity))
print('Temperature: {0}C'.format(sensor.temperature - 3))


But I am still wondering, is it possible to disable the onboard sensor so I can use the default address?

clpie
 
Posts: 21
Joined: Fri Jul 02, 2021 5:38 am

Re: Using External SHT31-D with CLUE (Stemma QT)

by adafruit_support_carter on Tue Nov 02, 2021 5:58 pm

But I am still wondering, is it possible to disable the onboard sensor so I can use the default address?

No. They are directly wired to the I2C bus and have the addresses shown in the scan. Any external device will need to have a non-conflicting address.

adafruit_support_carter
 
Posts: 23520
Joined: Tue Nov 29, 2016 2:45 pm

Re: Using External SHT31-D with CLUE (Stemma QT)

by clpie on Tue Nov 02, 2021 6:11 pm

Is it possible to disable the onboard sensor? Thanks

clpie
 
Posts: 21
Joined: Fri Jul 02, 2021 5:38 am

Re: Using External SHT31-D with CLUE (Stemma QT)

by adafruit_support_carter on Tue Nov 02, 2021 6:13 pm

No. They are directly wired to the I2C bus and have the addresses shown in the scan. Any external device will need to have a non-conflicting address.

adafruit_support_carter
 
Posts: 23520
Joined: Tue Nov 29, 2016 2:45 pm

Please be positive and constructive with your questions and comments.