Si70xx - RHT Sensor

Description

Silicon Labs Si7006/13/20/21 Relative Humidity and Temperature Sensor I2C driver.


Si70xx example code

Basic example for relative humidity and temperature measurement using an Si7021 sensor:

#include "sl_i2cspm_instances.h"
#include "sl_si70xx.h"

int main( void )
{

  ...

  int32_t temp_data;
  uint32_t rh_data;

  sl_si70xx_init(sl_i2cspm_sensor, SI7021_ADDR);
  sl_si70xx_measure_rh_and_temp(sl_i2cspm_sensor, SI7021_ADDR, &rh_data, &temp_data);

  ...

} 

Functions

sl_status_t sl_si70xx_init (sl_i2cspm_t *i2cspm, uint8_t addr)
Initialize the Si70xx sensor.
bool sl_si70xx_present (sl_i2cspm_t *i2cspm, uint8_t addr, uint8_t *device_id)
Check whether an Si7006/13/20/21 is present on the I2C bus or not.
sl_status_t sl_si70xx_measure_rh_and_temp (sl_i2cspm_t *i2cspm, uint8_t addr, uint32_t *rhData, int32_t *tData)
Measure relative humidity and temperature from an Si7006/13/20/21 sensor.
sl_status_t sl_si70xx_get_firmware_revision (sl_i2cspm_t *i2cspm, uint8_t addr, uint8_t *fwRev)
Read Firmware Revision from an Si7006/13/20/21 sensor.
sl_status_t sl_si70xx_read_rh_and_temp (sl_i2cspm_t *i2cspm, uint8_t addr, uint32_t *rhData, int32_t *tData)
Read relative humidity and temperature from an Si7006/13/20/21 sensor.
sl_status_t sl_si70xx_start_no_hold_measure_rh_and_temp (sl_i2cspm_t *i2cspm, uint8_t addr)
Start a no hold measurement of relative humidity and temperature from an Si7006/13/20/21 sensor.
sl_status_t sl_si7013_measure_analog_voltage (sl_i2cspm_t *i2cspm, uint8_t addr, int32_t *vData)
Measure the analog voltage or thermistor temperature from the Si7013 sensor.

Sensor Defines

#define SI7006_ADDR 0X40
I2C device address for Si7006.
#define SI7013_ADDR 0x41
I2C device address for Si7013.
#define SI7020_ADDR 0X40
I2C device address for Si7020.
#define SI7021_ADDR 0x40
I2C device address for Si7021.
#define SI7006_DEVICE_ID 0x06
Device ID value for Si7006.
#define SI7013_DEVICE_ID 0x0D
Device ID value for Si7013.
#define SI7020_DEVICE_ID 0x14
Device ID value for Si7020.
#define SI7021_DEVICE_ID 0x15
Device ID value for Si7021.

Function Documentation

sl_si70xx_init()

sl_status_t sl_si70xx_init ( sl_i2cspm_t * i2cspm,
uint8_t addr
)

Initialize the Si70xx sensor.

Parameters
[in] i2cspm The I2C peripheral to use.
[in] addr The I2C address to probe.
Return values
SL_STATUS_OK An Si70xx device is present on the I2C bus
SL_STATUS_INITIALIZATION No Si70xx device present

sl_si70xx_present()

bool sl_si70xx_present ( sl_i2cspm_t * i2cspm,
uint8_t addr,
uint8_t * device_id
)

Check whether an Si7006/13/20/21 is present on the I2C bus or not.

Parameters
[in] i2cspm The I2C peripheral to use.
[in] addr The I2C address to probe.
[out] device_id Write device ID from SNB_3 if device responds. Pass in NULL to discard. Should be 0x0D for Si7013, 0x14 for Si7020 or 0x15 for Si7021
Return values
true An Si70xx device is present on the I2C bus
false No Si70xx device present

sl_si70xx_measure_rh_and_temp()

sl_status_t sl_si70xx_measure_rh_and_temp ( sl_i2cspm_t * i2cspm,
uint8_t addr,
uint32_t * rhData,
int32_t * tData
)

Measure relative humidity and temperature from an Si7006/13/20/21 sensor.

Parameters
[in] i2cspm The I2C peripheral to use.
[in] addr The I2C address of the sensor.
[out] rhData The relative humidity in percent (multiplied by 1000).
[out] tData The temperature in milliCelsius.
Return values
SL_STATUS_OK Success
SL_STATUS_TRANSMIT I2C transmission error

sl_si70xx_get_firmware_revision()

sl_status_t sl_si70xx_get_firmware_revision ( sl_i2cspm_t * i2cspm,
uint8_t addr,
uint8_t * fwRev
)

Read Firmware Revision from an Si7006/13/20/21 sensor.

Parameters
[in] i2cspm The I2C peripheral to use.
[in] addr The I2C address of the sensor.
[out] fwRev The internal firmware revision. 0xFF === 1.0
Return values
SL_STATUS_OK Success
SL_STATUS_TRANSMIT I2C transmission error

sl_si70xx_read_rh_and_temp()

sl_status_t sl_si70xx_read_rh_and_temp ( sl_i2cspm_t * i2cspm,
uint8_t addr,
uint32_t * rhData,
int32_t * tData
)

Read relative humidity and temperature from an Si7006/13/20/21 sensor.

Parameters
[in] i2cspm The I2C peripheral to use.
[in] addr The I2C address of the sensor.
[out] rhData The relative humidity in percent (multiplied by 1000).
[out] tData The temperature in milliCelsius.
Return values
SL_STATUS_OK Success
SL_STATUS_TRANSMIT I2C transmission error

sl_si70xx_start_no_hold_measure_rh_and_temp()

sl_status_t sl_si70xx_start_no_hold_measure_rh_and_temp ( sl_i2cspm_t * i2cspm,
uint8_t addr
)

Start a no hold measurement of relative humidity and temperature from an Si7006/13/20/21 sensor.

Parameters
[in] i2cspm The I2C peripheral to use.
[in] addr The I2C address of the sensor.
Return values
SL_STATUS_OK Success
SL_STATUS_TRANSMIT I2C transmission error

sl_si7013_measure_analog_voltage()

sl_status_t sl_si7013_measure_analog_voltage ( sl_i2cspm_t * i2cspm,
uint8_t addr,
int32_t * vData
)

Measure the analog voltage or thermistor temperature from the Si7013 sensor.

Note
Analog voltage measurement only supported by Si7013
Parameters
[in] i2cspm The I2C peripheral to use.
[in] addr The I2C address of the sensor.
[out] vData The data read from the sensor.
Return values
SL_STATUS_OK Success
SL_STATUS_TRANSMIT I2C transmission error
SL_STATUS_FAIL Failure due to incorrect device ID

Macro Definition Documentation

SI7006_ADDR

#define SI7006_ADDR   0X40

I2C device address for Si7006.

SI7013_ADDR

#define SI7013_ADDR   0x41

I2C device address for Si7013.

SI7020_ADDR

#define SI7020_ADDR   0X40

I2C device address for Si7020.

SI7021_ADDR

#define SI7021_ADDR   0x40

I2C device address for Si7021.

SI7006_DEVICE_ID

#define SI7006_DEVICE_ID   0x06

Device ID value for Si7006.

SI7013_DEVICE_ID

#define SI7013_DEVICE_ID   0x0D

Device ID value for Si7013.

SI7020_DEVICE_ID

#define SI7020_DEVICE_ID   0x14

Device ID value for Si7020.

SI7021_DEVICE_ID

#define SI7021_DEVICE_ID   0x15

Device ID value for Si7021.