0

PyPortal hangs on temperature sensor read
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: PyPortal hangs on temperature sensor read

by adafruit_support_carter on Tue Feb 11, 2020 10:32 pm

That first register read is sort of odd, similar to what is was before. But at least it reset as expected. So it's sort of working.

Try reading a temperature again. Let's skip the resolution setting. Try just this:
Code: Select all | TOGGLE FULL SIZE
Adafruit CircuitPython 4.1.2 on 2019-12-18; Adafruit PyPortal with samd51j20
>>> import board
>>> import adafruit_adt7410
>>> tempSensor = adafruit_adt7410.ADT7410(board.I2C(), address=0x48)
>>> tempSensor._read_register(0x03)
bytearray(b'\x00')
>>> tempSensor._write_register(0x2f)
>>> tempSensor._read_register(0x03)
bytearray(b'\x00')
>>> tempSensor.temperature
31.25
>>>


The reading of 0x03 is done twice intentionally. Curious what yours reports as right after the sensor is created.

But since it seems to be resetting, maybe it can read a temperature at that point?

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

Re: PyPortal hangs on temperature sensor read

by bretthoward on Tue Feb 11, 2020 10:53 pm

Yep it made sense why you were reading it twice I just spelled it wrong and missed the capitalization but fixed it.... I totally get what you're trying to do.... But it seems no such joy. I had to hit CTRL+C to get it to bail out and come back...

Code: Select all | TOGGLE FULL SIZE
Adafruit CircuitPython 4.1.2 on 2019-12-18; Adafruit PyPortal with samd51j20
>>> import board
>>> import adafruit_adt7410
>>> tempSensor = adafruit_adt7410.ADT7410(board.I2C(), address=0x48)
>>> tempSensor._read_register(0x03)
bytearray(b'\x00')
>>> tempSensor._write_register(0x2f)
>>> tempSensor._read_register(0x03)
bytearray(b'\x00')
>>> tempSensor.temperature
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "adafruit_adt7410.py", line 91, in temperature
  File "adafruit_register/i2c_bit.py", line 58, in __get__
  File "adafruit_register/i2c_bit.py", line 58, in __get__
  File "adafruit_bus_device/i2c_device.py", line 163, in write_then_readinto
  File "adafruit_bus_device/i2c_device.py", line 116, in write
KeyboardInterrupt:
>>>

bretthoward
 
Posts: 37
Joined: Thu Dec 21, 2017 8:47 pm

Re: PyPortal hangs on temperature sensor read

by bretthoward on Tue Feb 11, 2020 10:57 pm

Also are you in a really hot location to be getting 31.25? Or does the thing really horribly self heat? If it self heats that badly I'm not sure I'm all that interested in still using it then. I do remember seeing people say to turn the backlight off for self heating issues.... And I would be fully cool with leaving the light off for temperature accuracy. But I'm starting to wonder if I have a bad unit....

~Brett

bretthoward
 
Posts: 37
Joined: Thu Dec 21, 2017 8:47 pm

Re: PyPortal hangs on temperature sensor read

by adafruit2 on Wed Feb 12, 2020 12:18 am

the backlight gets quite hot, 31 *C isnt unusual. I def think that something is amiss with the ADT library we have - maybe you'd be better off if we sent you a separate temperature sensor like the https://www.adafruit.com/product/4369 ?

adafruit2
Site Admin
 
Posts: 19043
Joined: Fri Mar 11, 2005 7:36 pm

Re: PyPortal hangs on temperature sensor read

by bretthoward on Wed Feb 12, 2020 4:30 pm

Hrm. If I'm honest I don't really "need" temperature. Its a nice to have and I was hoping that I could send regular updates of Temp to Adafruit.IO as a method of ensuring that things are still connected. Otherwise I'm trying to make a bilge monitor. So the plan is to use a clamp on current meter to sense when the pump removes water from the bottom of my boat. Basically if the pump runs too much I want to be notified as soon as possible... I was also going to install a float switch to detect high water in the event of a pump failure. Temp was only going to be another data point. The other thought I had was to find an I2C ADC and to then monitor voltages on the battery banks... Was also considering a relay running of 120V to detect and make sure the shore power connection was remaining alive. So all in all I guess I'll just continue on and assume that my ADT7410 is dead.

bretthoward
 
Posts: 37
Joined: Thu Dec 21, 2017 8:47 pm

Re: PyPortal hangs on temperature sensor read

by adafruit2 on Wed Feb 12, 2020 4:55 pm

ok if ya want we can replace the pyportal, but you'd probably be happier with an external i2c sensors that can be plugged in. let us know if ya want either :)

adafruit2
Site Admin
 
Posts: 19043
Joined: Fri Mar 11, 2005 7:36 pm

Re: PyPortal hangs on temperature sensor read

by bretthoward on Wed Feb 12, 2020 9:35 pm

How does that work. Do I mail this one back or? Also I find it odd that you question if there is an issue with the library but also believe that a replacement will solve the issue.... I would assume that the library works for most or it wouldn't have been published and have a pile of sample projects around it.... I'm assuming that that device has been ESD damaged or something.

bretthoward
 
Posts: 37
Joined: Thu Dec 21, 2017 8:47 pm

Re: PyPortal hangs on temperature sensor read

by adafruit2 on Sat Feb 15, 2020 7:59 pm

its really hard to know - we dont want anything back. email support@adafruit for whatever you decide - either an external sensor or a new pyportal

adafruit2
Site Admin
 
Posts: 19043
Joined: Fri Mar 11, 2005 7:36 pm

Re: PyPortal hangs on temperature sensor read

by sparkdeveloper on Wed Feb 19, 2020 1:16 pm

same happens for me

sparkdeveloper
 
Posts: 3
Joined: Thu Jan 30, 2020 3:44 pm

Re: PyPortal hangs on temperature sensor read

by adafruit2 on Wed Feb 19, 2020 1:18 pm

spark, make a new thread please

adafruit2
Site Admin
 
Posts: 19043
Joined: Fri Mar 11, 2005 7:36 pm

Re: PyPortal hangs on temperature sensor read

by adafruit_support_carter on Mon Feb 24, 2020 11:29 am

@bretthoward If you get a chance, can you try upgrading everything to the latest 5.x firmware and libraries and see if that helps with the temperature read issue. There have been some other cases of this happening and in the case below, that seemed to help:
viewtopic.php?f=60&t=162388&start=30#p799682

This doesn't fix the issue of the reported temperature being altered by the heat from the display. But it might fix the temperature read issue where the PyPortal hangs.

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

Re: PyPortal hangs on temperature sensor read

by bretthoward on Mon Feb 24, 2020 10:34 pm

Ok so I avoided 5.x before because it was saying it was beta.... I did have the latest 4.x stuff on there though... I've now followed the instructions here (https://learn.adafruit.com/adafruit-pyp ... cuitpython) and in the top link found the UF2 for the 5.x but I'm now getting an error in the adafruit_adt7410.py file... I'm assuming that there is a "default files zip" for 5.x somewhere that I'm not turning up?

bretthoward
 
Posts: 37
Joined: Thu Dec 21, 2017 8:47 pm

Re: PyPortal hangs on temperature sensor read

by adafruit_support_carter on Tue Feb 25, 2020 11:46 am

In addition to updating the firmware (the actual CircuitPython part) also update the libraries (all the extra support and drivers). You can get a zip bundle from here:
https://circuitpython.org/libraries
Download the Bundle Version 5.x. You'll find a lib folder in the zip file. You can use that to replace your existing one.

And thanks for trying this out!

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

Re: PyPortal hangs on temperature sensor read

by bretthoward on Tue Feb 25, 2020 8:06 pm

Seems to work with these libraries in place. So far not seeming to be bit by any other betaness so I'll just continue on from here...

Thanks!

bretthoward
 
Posts: 37
Joined: Thu Dec 21, 2017 8:47 pm

Re: PyPortal hangs on temperature sensor read

by adafruit_support_carter on Tue Feb 25, 2020 8:45 pm

Cool. Thanks for testing it and letting us know.

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

Please be positive and constructive with your questions and comments.