drohm / pi-sht1x

Python library for the Sensirion SHT1x series of temperature and humidity sensors to work on the Raspberry Pi. This includes the SHT10, SHT11, and SHT15 sensors.
MIT License
38 stars 16 forks source link

SHT1X failed to properly receive command [['WriteStatusRegister'] - 00000110] #17

Closed stevec-sm closed 2 years ago

stevec-sm commented 3 years ago

I tried to run the example.py, it worked well at the beginning, but suddenly facing the error SHT1X failed to properly receive command [['WriteStatusRegister'] - 00000110], and stopped working. the log file shows

Data Pin: 18
Clock Pin: 23
GPIO mode: GPIO.BCM
Vdd: 3.5
Resolution: High
Heater: False
OTP no reload: False
CRC check: True
[2021-05-28 12:21:50,507]        sht1x:    _get_ack:393  INFO      Command ['Temperature'] [00000011] acknowledged: 3
[2021-05-28 12:21:50,508]        sht1x:_send_command:258  INFO      SHT1x is taking measurement.
[2021-05-28 12:21:50,509]        sht1x:_send_command:261  ERROR     SHT1x is not in the proper measurement state: DATA line is LOW.
[2021-05-28 12:21:50,509]        sht1x:    __exit__:91   INFO      GPIO channel function status:
Data pin [18]: GPIO.IN
Clock pin [23]: GPIO.OUT
[2021-05-28 12:21:50,510]        sht1x:    __exit__:94   ERROR     Exception in with block: <class 'pi_sht1x.sht1x.SHT1xError'>
SHT1x is not in the proper measurement state: DATA line is LOW.
<traceback object at 0x75ab71e8>
[2021-05-28 12:24:18,809]        sht1x:initialize_sensor:156  INFO      Initializing sensor using bit mask: 00000000
[2021-05-28 12:24:18,811]        sht1x:    _get_ack:393  INFO      Command ['WriteStatusRegister'] [00000110] acknowledged: 6
[2021-05-28 12:24:18,812]        sht1x:    _get_ack:396  ERROR     SHT1x failed to properly receive command [['WriteStatusRegister'] - 00000110]
[2021-05-28 12:24:24,530]        sht1x:initialize_sensor:156  INFO      Initializing sensor using bit mask: 00000000
[2021-05-28 12:24:24,532]        sht1x:    _get_ack:393  INFO      Command ['WriteStatusRegister'] [00000110] acknowledged: 6
[2021-05-28 12:24:24,533]        sht1x:    _get_ack:396  ERROR     SHT1x failed to properly receive command [['WriteStatusRegister'] - 00000110]
[2021-05-28 12:27:37,874]        sht1x:initialize_sensor:156  INFO      Initializing sensor using bit mask: 00000000
[2021-05-28 12:27:37,877]        sht1x:    _get_ack:393  INFO      Command ['WriteStatusRegister'] [00000110] acknowledged: 6
[2021-05-28 12:27:37,878]        sht1x:    _get_ack:396  ERROR     SHT1x failed to properly receive command [['WriteStatusRegister'] - 00000110]
[2021-05-28 12:28:29,742]        sht1x:initialize_sensor:156  INFO      Initializing sensor using bit mask: 00000000
[2021-05-28 12:28:29,744]        sht1x:    _get_ack:393  INFO      Command ['WriteStatusRegister'] [00000110] acknowledged: 6
[2021-05-28 12:28:29,745]        sht1x:    _get_ack:396  ERROR     SHT1x failed to properly receive command [['WriteStatusRegister'] - 00000110]
[2021-05-28 12:37:16,251]        sht1x:initialize_sensor:156  INFO      Initializing sensor using bit mask: 00000000
[2021-05-28 12:37:16,258]        sht1x:    _get_ack:393  INFO      Command ['WriteStatusRegister'] [00000110] acknowledged: 6
[2021-05-28 12:37:16,259]        sht1x:    _get_ack:396  ERROR     SHT1x failed to properly receive command [['WriteStatusRegister'] - 00000110]
[2021-05-28 12:37:56,645]        sht1x:initialize_sensor:156  INFO      Initializing sensor using bit mask: 00000000
[2021-05-28 12:37:56,648]        sht1x:    _get_ack:393  INFO      Command ['WriteStatusRegister'] [00000110] acknowledged: 6
[2021-05-28 12:37:56,649]        sht1x:    _get_ack:396  ERROR     SHT1x failed to properly receive command [['WriteStatusRegister'] - 00000110]

I'd like to know how to fix this issue.

pinpang commented 3 years ago

IMPORTANT: [2021-05-28 12:21:50,509] sht1x:_send_command:261 ERROR SHT1x is not in the proper measurement state: DATA line is LOW. It seems that your data pin lacks fixed pull-up.

I updated the code to use internal pull-up, you can find it at this FORK.

drohm commented 3 years ago

Thanks @pinpang for this. I merged this into master and will have a new build out shortly.

drohm commented 3 years ago

@stevec-sm @pinpang New release has been published. Please let me know if @pinpang's fix corrects this issue.