adafruit / Adafruit_CircuitPython_SHT31D

CircuitPython driver for the SHT31-D temperature and humidity sensor
MIT License
20 stars 18 forks source link

Include support for periodic data acquisition mode. #11

Closed WoefulDerelict closed 5 years ago

WoefulDerelict commented 5 years ago

This expands the driver with support for periodic data acquisition mode and control of the sensor's measurement parameters. Support for periodic data acquisition mode is necessary to enable and explore the device's alert feature.

WoefulDerelict commented 5 years ago

In a recent response to a request for information Sensirion's field applications engineer has stated that the SHT3X-D data stream is a FIFO stack. I will attempt to verify this shortly and update if necessary.

WoefulDerelict commented 5 years ago

The field applications engineer I have been in contact with appears to be mistaken. Utilising a simple test programme that monitored the data output in periodic data acquisition mode while the device's internal heater switched on I was able to identify a clear FILO trend in the returned results and contacted the engineer with my findings.

WoefulDerelict commented 5 years ago

@tannewt I can definitely include some examples on how the extended API is used. Do you have any usage cases you'd specifically like documented? I can include a very basic example in the readme and more explorative items as things the users can execute in the examples folder.

I have not explored how much larger this makes the library. It not only adds support for periodic data acquisition mode it also includes support for configuring the sensor's behaviour in single shot data acquisition mode as a side effect.

This represents a half step in my own efforts to generate a CircuitPython compatible driver for the SHT3X-D family of sensors that is capable of manipulating the alert limits and allowing users to explore these features of the platform including the alert pin on the breakout board. The alert limits only trip when the sensor is in periodic data acquisition mode so properly exposing that feature set required building out this one. As this does represent a rather massive divergence from the original driver which only supported high repeatability single shot data acquisition mode without clock stretching specifically on the SHT31-D breakout there may be an argument for considering it a separate driver.

tannewt commented 5 years ago

Thank you for the second example!