libyggdrasil  v1.0.0
humidity_sensor.h File Reference

Driver to use the SHT40-AD1B-R2 humidity sensor. More...

Include dependency graph for humidity_sensor.h:

Go to the source code of this file.

Enumerations

enum  HumiditySensorHeat {
  HumiditySensorHeat_200mWFor1s = 0x39, HumiditySensorHeat_200mWFor0p1s = 0x32, HumiditySensorHeat_110mWFor1s = 0x2F, HumiditySensorHeat_110mWFor0p1s = 0x24,
  HumiditySensorHeat_20mWFor1s = 0x1E, HumiditySensorHeat_20mWFor0p1s = 0x15
}
 Heater commands for the SHT40-AD1B-R2 sensor. More...
 
enum  HumiditySensorPrecision { HumiditySensorPrecision_High = 0xFD, HumiditySensorPrecision_Medium = 0xF6, HumiditySensorPrecision_Low = 0xE0 }
 Measurement precision settings for the SHT40-AD1B-R2 sensor. More...
 

Functions

C_LINKAGE void yggdrasil_HumiditySensor_Init (void)
 Initialization of the SHT40-AD1B-R2 relative humidity and temperature sensor. More...
 
C_LINKAGE float yggdrasil_HumiditySensor_GetTemperature (enum HumiditySensorPrecision precision)
 Get the temperature without using the heater. More...
 
C_LINKAGE float yggdrasil_HumiditySensor_GetHumidity (enum HumiditySensorPrecision precision)
 Get the temperature without using the heater. More...
 
C_LINKAGE void yggdrasil_HumiditySensor_EnableHeater (enum HumiditySensorHeat level)
 Enable the heater module on the sensor. More...
 

Detailed Description

Driver to use the SHT40-AD1B-R2 humidity sensor.

Author
Fabian Weber, Nikolaij Saegesser

Enumeration Type Documentation

◆ HumiditySensorHeat

Heater commands for the SHT40-AD1B-R2 sensor.

Warning
Do not use heater for extended periods of time. The heater is designed for a maximal duty cycle of less than 5% when it is periodically heated
Enumerator
HumiditySensorHeat_200mWFor1s 

200mW @ 3.3V for 1s

HumiditySensorHeat_200mWFor0p1s 

200mW @ 3.3V for 0.1s

HumiditySensorHeat_110mWFor1s 

110mW @ 3.3V for 1s

HumiditySensorHeat_110mWFor0p1s 

110mW @ 3.3V for 0.1s

HumiditySensorHeat_20mWFor1s 

20mW @ 3.3V for 1s

HumiditySensorHeat_20mWFor0p1s 

20mW @ 3.3V for 0.1s

◆ HumiditySensorPrecision

Measurement precision settings for the SHT40-AD1B-R2 sensor.

Enumerator
HumiditySensorPrecision_High 

measure T & RH with High precision (High repeatability)

HumiditySensorPrecision_Medium 

measure T & RH with medium precision (medium repeatability)

HumiditySensorPrecision_Low 

measure T & RH with lowest precision (low repeatability)

Function Documentation

◆ yggdrasil_HumiditySensor_EnableHeater()

C_LINKAGE void yggdrasil_HumiditySensor_EnableHeater ( enum HumiditySensorHeat  level)

Enable the heater module on the sensor.

Warning
The heater is designed for a maximal duty cycle of less than 5% when it is periodically heated
Parameters
levelPower and duration command

◆ yggdrasil_HumiditySensor_GetHumidity()

C_LINKAGE float yggdrasil_HumiditySensor_GetHumidity ( enum HumiditySensorPrecision  precision)

Get the temperature without using the heater.

Note
The measurement takes about 10ms
Parameters
precisionPrecision for the conversion
Returns
Temperature sensor temperature

◆ yggdrasil_HumiditySensor_GetTemperature()

C_LINKAGE float yggdrasil_HumiditySensor_GetTemperature ( enum HumiditySensorPrecision  precision)

Get the temperature without using the heater.

Note
The measurement takes about 10ms
Parameters
precisionPrecision for the conversion
Returns
Temperature sensor temperature

◆ yggdrasil_HumiditySensor_Init()

C_LINKAGE void yggdrasil_HumiditySensor_Init ( void  )

Initialization of the SHT40-AD1B-R2 relative humidity and temperature sensor.

Note
The sensor does not need a special initialization, this function just does a soft reset
Returns
Success