HDC1000 Humidity and Temperature Sensor

Driver for the TI HDC1000 Humidity and Temperature Sensor. More...

Detailed Description

The driver will initialize the sensor for best resolution (14 bit). Currently the driver doesn't use the heater. Temperature and humidity are acquired in sequence. The sensor is always in sleep mode.

The temperature and humidity values can either be acquired using the simplified hdc1000_read() function, or the conversion can be triggered manually using the hdc1000_trigger_conversion() and hdc1000_get_results() functions sequentially. If using the second method, on must wait at least HDC1000_CONVERSION_TIME between triggering the conversion and reading the results.

Note
The driver does currently not support using the devices heating unit.

Files

file  hdc1000_regs.h
 Register definitions for HDC1000 devices.
 
file  hdc1000.h
 Interface definition for the HDC1000 sensor driver.
 

Data Structures

struct  hdc1000_params_t
 Parameters needed for device initialization. More...
 
struct  hdc1000_t
 Device descriptor for HDC1000 sensors. More...
 

Macros

#define HDC1000_I2C_ADDRESS   (0x43)
 Default I2C bus address of HDC1000 devices.
 
#define HDC1000_CONVERSION_TIME   (26000)
 Typical conversion time needed to acquire new values [in us]. More...
 

Enumerations

enum  { HDC1000_OK = 0, HDC1000_NODEV = -1, HDC1000_NOBUS = -2, HDC1000_BUSERR = -3 }
 HDC1000 specific return values. More...
 
enum  hdc1000_res_t { HDC1000_11BIT = (HDC1000_TRES11 | HDC1000_HRES11), HDC1000_14BIT = (HDC1000_TRES14 | HDC1000_HRES14) }
 Possible resolution values. More...
 

Functions

int hdc1000_init (hdc1000_t *dev, const hdc1000_params_t *params)
 Initialize the given HDC1000 device. More...
 
int hdc1000_trigger_conversion (hdc1000_t *dev)
 Trigger a new conversion. More...
 
int hdc1000_get_results (hdc1000_t *dev, int16_t *temp, int16_t *hum)
 Read conversion results for temperature and humidity. More...
 
int hdc1000_read (hdc1000_t *dev, int16_t *temp, int16_t *hum)
 Convenience function for reading temperature and humidity. More...
 

Macro Definition Documentation

#define HDC1000_CONVERSION_TIME   (26000)
Note
This time value is chosen twice as large as needed for two 14-bit conversions (worst case) to allow for timer imprecision: (convert temp + convert hum) * 2 -> (6.5ms + 6.5ms) * 2 := 26ms.

Definition at line 66 of file hdc1000.h.

Enumeration Type Documentation

anonymous enum
Enumerator
HDC1000_OK 

everything went as expected

HDC1000_NODEV 

no HDC1000 device found on the bus

HDC1000_NOBUS 

errors while initializing the I2C bus

HDC1000_BUSERR 

error during I2C communication

Definition at line 72 of file hdc1000.h.

Enumerator
HDC1000_11BIT 

11-bit conversion

HDC1000_14BIT 

14-bit conversion

Definition at line 82 of file hdc1000.h.

Function Documentation

int hdc1000_get_results ( hdc1000_t dev,
int16_t *  temp,
int16_t *  hum 
)
Parameters
[in]devdevice descriptor of sensor
[out]temptemperature [in 100 * degree centigrade]
[out]humhumidity [in 100 * percent relative]
Returns
HDC1000_OK on success
HDC1000_BUSERR on I2C communication failures
int hdc1000_init ( hdc1000_t dev,
const hdc1000_params_t params 
)
Parameters
[out]devdevice descriptor of sensor to initialize
[in]paramsconfiguration parameters
Returns
HDC1000_OK on success
HDC1000_NOBUS if initialization of I2C bus fails
HDC1000_NODEV if no HDC1000 device found on bus
int hdc1000_read ( hdc1000_t dev,
int16_t *  temp,
int16_t *  hum 
)

This function will trigger a new conversion, wait for the conversion to be finished and the get the results from the device.

Parameters
[in]devdevice descriptor of sensor
[out]temptemperature [in 100 * degree centigrade]
[out]humhumidity [in 100 * percent relative]
Returns
HDC1000_OK on success
HDC1000_BUSERR on I2C communication failures
int hdc1000_trigger_conversion ( hdc1000_t dev)

After the conversion is triggered, one has to wait HDC1000_CONVERSION_TIME us until the results can be read using hdc1000_get_results().

Parameters
[in]devdevice descriptor of sensor
Returns
HDC1000_OK on success
HDC1000_BUSERR on I2C communication failures