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

FeaterS2 & LTR390 not working
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

FeaterS2 & LTR390 not working

by kurthofman on Mon Apr 26, 2021 9:35 am

When I try to run the test-code for the LTR390 module on a Feater S2 I get an error.
Module seems to connect in Arduino but I get no UV index.

Board : Feater S2
Module : ADAFRUIT LTR390 UV LIGHT SENSOR - STEMMA QT / QWIIC (4831)

Code :
Code: Select all | TOGGLE FULL SIZE
import time
import board
import adafruit_ltr390

i2c = board.I2C()
ltr = adafruit_ltr390.LTR390(i2c)

while True:
print("UV:", ltr.uvs, "\t\tAmbient Light:", ltr.light)
print("UVI:", ltr.uvi, "\t\tLux:", ltr.lux)
time.sleep(1.0)

Error :
code.py output:
Traceback (most recent call last):
File "code.py", line 6, in
File "adafruit_ltr390.py", line 254, in init
File "adafruit_ltr390.py", line 260, in initialize
File "adafruit_ltr390.py", line 283, in _reset
File "adafruit_register/i2c_bit.py", line 43, in get
File "adafruit_register/i2c_bit.py", line 43, in get
OSError: [Errno 5] Input/output error

Code done running.
Last edited by adafruit_support_carter on Wed Apr 28, 2021 9:46 am, edited 1 time in total.
Reason: added [code] tags

kurthofman
 
Posts: 6
Joined: Mon Apr 26, 2021 9:30 am

Re: FeaterS2 & LTR390 not working

by kurthofman on Mon Apr 26, 2021 11:31 am

Module works in Arduino with Huzzah esp32.

kurthofman
 
Posts: 6
Joined: Mon Apr 26, 2021 9:30 am

Re: FeaterS2 & LTR390 not working

by adafruit_support_carter on Mon Apr 26, 2021 11:49 am

How are you connecting the LTR390 to the Feather S2?

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

Re: FeaterS2 & LTR390 not working

by kurthofman on Tue Apr 27, 2021 2:58 am

The LTR390 is connected to the Feather S2 over STEMMA, same as if I connect it to the Huzzah32 for the Arduino-test.

kurthofman
 
Posts: 6
Joined: Mon Apr 26, 2021 9:30 am

Re: FeaterS2 & LTR390 not working

by adafruit_support_carter on Tue Apr 27, 2021 10:44 am

Hmm. That should be fine. Seems like a connection issue though. Can you post a photo of your setup showing how everything is connected.

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

Re: FeaterS2 & LTR390 not working

by kurthofman on Wed Apr 28, 2021 6:12 am

This is my setup, I used the same Stemma-cable to connect to the Huzzah32
Attachments
IMG_0340 (Aangepast).JPG
IMG_0340 (Aangepast).JPG (148.57 KiB) Viewed 44 times

kurthofman
 
Posts: 6
Joined: Mon Apr 26, 2021 9:30 am

Re: FeaterS2 & LTR390 not working

by kurthofman on Wed Apr 28, 2021 7:15 am

Test on the Feather S2 :
Code: Select all | TOGGLE FULL SIZE
import board
import busio

i2c = busio.I2C(board.SCL, board.SDA)
while not i2c.try_lock():
    pass
devices = i2c.scan()
while len(devices) < 1:
    devices = i2c.scan()
device = devices[0]
print('Found device with address: {}'.format(hex(device)))
result = bytearray(2)
i2c.writeto(device, bytes(6))
i2c.readfrom_into(device, result)
print('Address {0}: {1}'.format(hex(6), ' '.join([hex(x) for x in result])))
i2c.unlock()

This gives me, what I think is OK :

code.py output:
Found device with address: 0x53
Address 0x6: 0x1 0xb2
Last edited by adafruit_support_carter on Wed Apr 28, 2021 9:44 am, edited 1 time in total.
Reason: added [code] tags

kurthofman
 
Posts: 6
Joined: Mon Apr 26, 2021 9:30 am

Re: FeaterS2 & LTR390 not working

by kurthofman on Wed Apr 28, 2021 7:35 am

If I make the following change in adafruit_ltr390 (disable _reset") it seems to work.

class LTR390:

def _reset(self):
"""
try:
self._reset_bit = True
except OSError:
# The write to the reset bit will fail because it seems to not ACK before it resets
pass

sleep(0.1)
# check that reset is complete w/ the bit unset
if self._reset_bit:
raise RuntimeError("Unable to reset sensor")
"""

kurthofman
 
Posts: 6
Joined: Mon Apr 26, 2021 9:30 am

Re: FeaterS2 & LTR390 not working

by adafruit_support_carter on Wed Apr 28, 2021 10:12 am

Thanks. I've recreated the original problem and opened an issue for this here:
https://github.com/adafruit/Adafruit_Ci ... 0/issues/6

Seems like something specific to the ESP32-S2.

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

Please be positive and constructive with your questions and comments.