esp-open-rtos/examples/sht3x/README.md

39 lines
1.6 KiB
Markdown
Raw Permalink Normal View History

Driver for Sensirion SHT3x temperature and humidity sensor readded (#453) * Driver for Sensirion SHT3x sensor added This is a driver for Sensirion SHT3x temperature and humidity sensors connected via I2C. This commit is a rebasing and contains some interface changes based on the review from @ourairquality. * SHT3x driver changes Additional include to satisfy the Travis CI test build * SHT3x driver - small changes README.md has been shortened * SHT3x driver - small changes * SHT3x driver - small changes - crc8 lookup table is now static to be held in flash memory - special handling for the timer overflow in sht3x_is_measuring removed - initialization reduced to availability check * SHT3x driver - some small changes - crc8 lookup table is now static to be held in flash memory - special handling for the timer overflow in sht3x_is_measuring removed - some whitespace removed - initialization reduced to availability check * SHT3x driver - some minor changes - lookup tables made const to be held in flash - crc8 computation changed to a non table lookup version - measurement duration is now given in ticks and can be used directly for vTaskDelay (documentation and examples changed accordingly) * SHT3x driver - documentation changed * SHT3x driver - minor correction - number of ticks for measurement duration takes now into account portTICK_PERIOD_MS * SHT3x driver - minor correction - number of ticks for measurement duration takes now into account portTICK_PERIOD_MS * SHT3x driver - minor correction - number of ticks for measurement duration takes now into account portTICK_PERIOD_MS * SHT3x driver - minor correction - number of ticks for measurement duration takes now into account portTICK_PERIOD_MS * SHT3x driver - minor corrections * SHT3x driver - minor corrections * Driver for Sensirion SHT3x sensor added This is a driver for Sensirion SHT3x temperature and humidity sensors connected via I2C. This commit is a rebasing and contains some interface changes based on the review from @ourairquality. SHT3x driver changes - additional include to satisfy the Travis CI test build - README.md has been shortened - special handling for the timer overflow in sht3x_is_measuring removed - some whitespaces removed - crc8 computation changed to a non table lookup version - measurement duration is now given in ticks and can be used directly for vTaskDelay (documentation and examples changed accordingly) - number of ticks for measurement duration takes now into account portTICK_PERIOD_MS - clock stretching disabled on sensor to avoid blocking when data are not ready to read - calculation of maesurement duration adds now one and a half ticks to be sure that measurement duration is not too short - function sht3x_is_measuring is now private and only for internal use, user task has always to use function vTaskDelay to wait for measurement results - function sht3x_is_measuring was simplified and returns now just a boolean value - private function sht3x_reset added which is used to reset the sensor during initialization - active flag in sensor data structure not needed anymore - function sht3_get_raw_data simplified - function sht3x_start_measurement returns now only a boolean - function sht3x_start_measurement does not check anymore whether there is already a measurment running - new function sht3x_get_measurement_duration which returns the measurement duration in ticks for configured repeatability * SHT3x driver minor changes - type sht3x_values_t replaced by separate float values - additional repeatability parameter defined for function sht3x_start_measurement - parameter of function sht3x_get_measurement_duration changed from sht3x_sensort_t to sht3_repeat_t - sensor modes and repeatability levels extended by prefix sht3x_ * SHT3x driver minor changes - new high level function sht3x_measure added, it comprises all three steps to perform one measurement in only one function - example with two sensors removed * SHT3x driver small correction
2017-10-23 21:39:48 +00:00
# SHT3x Driver Examples
These examples demonstrate the usage of the SHT3x driver with only one and multiple SHT3x sensors.
## Hardware setup
There are examples for only one sensor and examples for two sensors.
To run examples with **one sensor**, just use GPIO14 (SCL) and GPIO13 (SDA) to connect to the SHT3x sensor's I2C interface.
Driver for Sensirion SHT3x temperature and humidity sensor readded (#453) * Driver for Sensirion SHT3x sensor added This is a driver for Sensirion SHT3x temperature and humidity sensors connected via I2C. This commit is a rebasing and contains some interface changes based on the review from @ourairquality. * SHT3x driver changes Additional include to satisfy the Travis CI test build * SHT3x driver - small changes README.md has been shortened * SHT3x driver - small changes * SHT3x driver - small changes - crc8 lookup table is now static to be held in flash memory - special handling for the timer overflow in sht3x_is_measuring removed - initialization reduced to availability check * SHT3x driver - some small changes - crc8 lookup table is now static to be held in flash memory - special handling for the timer overflow in sht3x_is_measuring removed - some whitespace removed - initialization reduced to availability check * SHT3x driver - some minor changes - lookup tables made const to be held in flash - crc8 computation changed to a non table lookup version - measurement duration is now given in ticks and can be used directly for vTaskDelay (documentation and examples changed accordingly) * SHT3x driver - documentation changed * SHT3x driver - minor correction - number of ticks for measurement duration takes now into account portTICK_PERIOD_MS * SHT3x driver - minor correction - number of ticks for measurement duration takes now into account portTICK_PERIOD_MS * SHT3x driver - minor correction - number of ticks for measurement duration takes now into account portTICK_PERIOD_MS * SHT3x driver - minor correction - number of ticks for measurement duration takes now into account portTICK_PERIOD_MS * SHT3x driver - minor corrections * SHT3x driver - minor corrections * Driver for Sensirion SHT3x sensor added This is a driver for Sensirion SHT3x temperature and humidity sensors connected via I2C. This commit is a rebasing and contains some interface changes based on the review from @ourairquality. SHT3x driver changes - additional include to satisfy the Travis CI test build - README.md has been shortened - special handling for the timer overflow in sht3x_is_measuring removed - some whitespaces removed - crc8 computation changed to a non table lookup version - measurement duration is now given in ticks and can be used directly for vTaskDelay (documentation and examples changed accordingly) - number of ticks for measurement duration takes now into account portTICK_PERIOD_MS - clock stretching disabled on sensor to avoid blocking when data are not ready to read - calculation of maesurement duration adds now one and a half ticks to be sure that measurement duration is not too short - function sht3x_is_measuring is now private and only for internal use, user task has always to use function vTaskDelay to wait for measurement results - function sht3x_is_measuring was simplified and returns now just a boolean value - private function sht3x_reset added which is used to reset the sensor during initialization - active flag in sensor data structure not needed anymore - function sht3_get_raw_data simplified - function sht3x_start_measurement returns now only a boolean - function sht3x_start_measurement does not check anymore whether there is already a measurment running - new function sht3x_get_measurement_duration which returns the measurement duration in ticks for configured repeatability * SHT3x driver minor changes - type sht3x_values_t replaced by separate float values - additional repeatability parameter defined for function sht3x_start_measurement - parameter of function sht3x_get_measurement_duration changed from sht3x_sensort_t to sht3_repeat_t - sensor modes and repeatability levels extended by prefix sht3x_ * SHT3x driver minor changes - new high level function sht3x_measure added, it comprises all three steps to perform one measurement in only one function - example with two sensors removed * SHT3x driver small correction
2017-10-23 21:39:48 +00:00
```
+-----------------+ +----------+
| ESP8266 / ESP32 | | SHT3x |
| | | |
| GPIO 14 (SCL) ------> SCL |
| GPIO 13 (SDA) <-----> SDA |
+-----------------+ +----------+
Driver for Sensirion SHT3x temperature and humidity sensor readded (#453) * Driver for Sensirion SHT3x sensor added This is a driver for Sensirion SHT3x temperature and humidity sensors connected via I2C. This commit is a rebasing and contains some interface changes based on the review from @ourairquality. * SHT3x driver changes Additional include to satisfy the Travis CI test build * SHT3x driver - small changes README.md has been shortened * SHT3x driver - small changes * SHT3x driver - small changes - crc8 lookup table is now static to be held in flash memory - special handling for the timer overflow in sht3x_is_measuring removed - initialization reduced to availability check * SHT3x driver - some small changes - crc8 lookup table is now static to be held in flash memory - special handling for the timer overflow in sht3x_is_measuring removed - some whitespace removed - initialization reduced to availability check * SHT3x driver - some minor changes - lookup tables made const to be held in flash - crc8 computation changed to a non table lookup version - measurement duration is now given in ticks and can be used directly for vTaskDelay (documentation and examples changed accordingly) * SHT3x driver - documentation changed * SHT3x driver - minor correction - number of ticks for measurement duration takes now into account portTICK_PERIOD_MS * SHT3x driver - minor correction - number of ticks for measurement duration takes now into account portTICK_PERIOD_MS * SHT3x driver - minor correction - number of ticks for measurement duration takes now into account portTICK_PERIOD_MS * SHT3x driver - minor correction - number of ticks for measurement duration takes now into account portTICK_PERIOD_MS * SHT3x driver - minor corrections * SHT3x driver - minor corrections * Driver for Sensirion SHT3x sensor added This is a driver for Sensirion SHT3x temperature and humidity sensors connected via I2C. This commit is a rebasing and contains some interface changes based on the review from @ourairquality. SHT3x driver changes - additional include to satisfy the Travis CI test build - README.md has been shortened - special handling for the timer overflow in sht3x_is_measuring removed - some whitespaces removed - crc8 computation changed to a non table lookup version - measurement duration is now given in ticks and can be used directly for vTaskDelay (documentation and examples changed accordingly) - number of ticks for measurement duration takes now into account portTICK_PERIOD_MS - clock stretching disabled on sensor to avoid blocking when data are not ready to read - calculation of maesurement duration adds now one and a half ticks to be sure that measurement duration is not too short - function sht3x_is_measuring is now private and only for internal use, user task has always to use function vTaskDelay to wait for measurement results - function sht3x_is_measuring was simplified and returns now just a boolean value - private function sht3x_reset added which is used to reset the sensor during initialization - active flag in sensor data structure not needed anymore - function sht3_get_raw_data simplified - function sht3x_start_measurement returns now only a boolean - function sht3x_start_measurement does not check anymore whether there is already a measurment running - new function sht3x_get_measurement_duration which returns the measurement duration in ticks for configured repeatability * SHT3x driver minor changes - type sht3x_values_t replaced by separate float values - additional repeatability parameter defined for function sht3x_start_measurement - parameter of function sht3x_get_measurement_duration changed from sht3x_sensort_t to sht3_repeat_t - sensor modes and repeatability levels extended by prefix sht3x_ * SHT3x driver minor changes - new high level function sht3x_measure added, it comprises all three steps to perform one measurement in only one function - example with two sensors removed * SHT3x driver small correction
2017-10-23 21:39:48 +00:00
```
If you want to run examples with **two sensors**, you could do this with only one bus and different I2C addresses or with two buses and the same or different I2C addresses. In later case, use GPIO5 (SCL) and GPIO4 (SDA) for the second bus to connect to the second SHT3x sensor's I2C interface.
Driver for Sensirion SHT3x temperature and humidity sensor readded (#453) * Driver for Sensirion SHT3x sensor added This is a driver for Sensirion SHT3x temperature and humidity sensors connected via I2C. This commit is a rebasing and contains some interface changes based on the review from @ourairquality. * SHT3x driver changes Additional include to satisfy the Travis CI test build * SHT3x driver - small changes README.md has been shortened * SHT3x driver - small changes * SHT3x driver - small changes - crc8 lookup table is now static to be held in flash memory - special handling for the timer overflow in sht3x_is_measuring removed - initialization reduced to availability check * SHT3x driver - some small changes - crc8 lookup table is now static to be held in flash memory - special handling for the timer overflow in sht3x_is_measuring removed - some whitespace removed - initialization reduced to availability check * SHT3x driver - some minor changes - lookup tables made const to be held in flash - crc8 computation changed to a non table lookup version - measurement duration is now given in ticks and can be used directly for vTaskDelay (documentation and examples changed accordingly) * SHT3x driver - documentation changed * SHT3x driver - minor correction - number of ticks for measurement duration takes now into account portTICK_PERIOD_MS * SHT3x driver - minor correction - number of ticks for measurement duration takes now into account portTICK_PERIOD_MS * SHT3x driver - minor correction - number of ticks for measurement duration takes now into account portTICK_PERIOD_MS * SHT3x driver - minor correction - number of ticks for measurement duration takes now into account portTICK_PERIOD_MS * SHT3x driver - minor corrections * SHT3x driver - minor corrections * Driver for Sensirion SHT3x sensor added This is a driver for Sensirion SHT3x temperature and humidity sensors connected via I2C. This commit is a rebasing and contains some interface changes based on the review from @ourairquality. SHT3x driver changes - additional include to satisfy the Travis CI test build - README.md has been shortened - special handling for the timer overflow in sht3x_is_measuring removed - some whitespaces removed - crc8 computation changed to a non table lookup version - measurement duration is now given in ticks and can be used directly for vTaskDelay (documentation and examples changed accordingly) - number of ticks for measurement duration takes now into account portTICK_PERIOD_MS - clock stretching disabled on sensor to avoid blocking when data are not ready to read - calculation of maesurement duration adds now one and a half ticks to be sure that measurement duration is not too short - function sht3x_is_measuring is now private and only for internal use, user task has always to use function vTaskDelay to wait for measurement results - function sht3x_is_measuring was simplified and returns now just a boolean value - private function sht3x_reset added which is used to reset the sensor during initialization - active flag in sensor data structure not needed anymore - function sht3_get_raw_data simplified - function sht3x_start_measurement returns now only a boolean - function sht3x_start_measurement does not check anymore whether there is already a measurment running - new function sht3x_get_measurement_duration which returns the measurement duration in ticks for configured repeatability * SHT3x driver minor changes - type sht3x_values_t replaced by separate float values - additional repeatability parameter defined for function sht3x_start_measurement - parameter of function sht3x_get_measurement_duration changed from sht3x_sensort_t to sht3_repeat_t - sensor modes and repeatability levels extended by prefix sht3x_ * SHT3x driver minor changes - new high level function sht3x_measure added, it comprises all three steps to perform one measurement in only one function - example with two sensors removed * SHT3x driver small correction
2017-10-23 21:39:48 +00:00
```
+-----------------+ +----------+
| ESP8266 / ESP32 | | SHT3x_1 |
| | | |
| GPIO 14 (SCL) ------> SCL |
| GPIO 13 (SDA) <-----> SDA |
| | +----------+
| | | SHT3x_2 |
| | | |
| GPIO 5 (SCL) ------> SCL |
| GPIO 4 (SDA) <-----> SDA |
+-----------------+ +----------+
Driver for Sensirion SHT3x temperature and humidity sensor readded (#453) * Driver for Sensirion SHT3x sensor added This is a driver for Sensirion SHT3x temperature and humidity sensors connected via I2C. This commit is a rebasing and contains some interface changes based on the review from @ourairquality. * SHT3x driver changes Additional include to satisfy the Travis CI test build * SHT3x driver - small changes README.md has been shortened * SHT3x driver - small changes * SHT3x driver - small changes - crc8 lookup table is now static to be held in flash memory - special handling for the timer overflow in sht3x_is_measuring removed - initialization reduced to availability check * SHT3x driver - some small changes - crc8 lookup table is now static to be held in flash memory - special handling for the timer overflow in sht3x_is_measuring removed - some whitespace removed - initialization reduced to availability check * SHT3x driver - some minor changes - lookup tables made const to be held in flash - crc8 computation changed to a non table lookup version - measurement duration is now given in ticks and can be used directly for vTaskDelay (documentation and examples changed accordingly) * SHT3x driver - documentation changed * SHT3x driver - minor correction - number of ticks for measurement duration takes now into account portTICK_PERIOD_MS * SHT3x driver - minor correction - number of ticks for measurement duration takes now into account portTICK_PERIOD_MS * SHT3x driver - minor correction - number of ticks for measurement duration takes now into account portTICK_PERIOD_MS * SHT3x driver - minor correction - number of ticks for measurement duration takes now into account portTICK_PERIOD_MS * SHT3x driver - minor corrections * SHT3x driver - minor corrections * Driver for Sensirion SHT3x sensor added This is a driver for Sensirion SHT3x temperature and humidity sensors connected via I2C. This commit is a rebasing and contains some interface changes based on the review from @ourairquality. SHT3x driver changes - additional include to satisfy the Travis CI test build - README.md has been shortened - special handling for the timer overflow in sht3x_is_measuring removed - some whitespaces removed - crc8 computation changed to a non table lookup version - measurement duration is now given in ticks and can be used directly for vTaskDelay (documentation and examples changed accordingly) - number of ticks for measurement duration takes now into account portTICK_PERIOD_MS - clock stretching disabled on sensor to avoid blocking when data are not ready to read - calculation of maesurement duration adds now one and a half ticks to be sure that measurement duration is not too short - function sht3x_is_measuring is now private and only for internal use, user task has always to use function vTaskDelay to wait for measurement results - function sht3x_is_measuring was simplified and returns now just a boolean value - private function sht3x_reset added which is used to reset the sensor during initialization - active flag in sensor data structure not needed anymore - function sht3_get_raw_data simplified - function sht3x_start_measurement returns now only a boolean - function sht3x_start_measurement does not check anymore whether there is already a measurment running - new function sht3x_get_measurement_duration which returns the measurement duration in ticks for configured repeatability * SHT3x driver minor changes - type sht3x_values_t replaced by separate float values - additional repeatability parameter defined for function sht3x_start_measurement - parameter of function sht3x_get_measurement_duration changed from sht3x_sensort_t to sht3_repeat_t - sensor modes and repeatability levels extended by prefix sht3x_ * SHT3x driver minor changes - new high level function sht3x_measure added, it comprises all three steps to perform one measurement in only one function - example with two sensors removed * SHT3x driver small correction
2017-10-23 21:39:48 +00:00
```
## Example description
It shows different user task implementations in *single shot mode* and *periodic mode*. In *single shot* mode either low level or high level functions are used. Constants SINGLE_SHOT_LOW_LEVEL and SINGLE_SHOT_HIGH_LEVEL controls which task implementation is used.