Si70XX Sensor#


Introduction.#

The Si70xx sensor driver provides a set of functions to interact with the Si70xx sensor series over the I2C bus. It allows for easy integration of the sensor, providing access to features such as temperature and humidity measurements, firmware revision retrieval, and device presence detection. All Si70xx functions are called through the generic driver.


Introduction.#

Once I2C peripheral is initialised and configured, Si70xx sensor will be ready to be use. The common functions include the following:

sl_si91x_si70xx_init initialises the Si70xx sensor. This function is called before using the other functions.

sl_si91x_si70xx_is_present can be implemented by the application if required. This function will check if an Si70xx sensor is present on the I2C bus. sl_si91x_si70xx_measure_rh_and_temp will measure relative humidity and temperature from the sensor. sl_si91x_si70xx_get_firmware_revision will read the firmware revision from the sensor. sl_si91x_si70xx_reset will initiate a software reset of the sensor.

Kindly refer to the Function Documentation to see the usage of all the APIs in detail.

Enumerations#

enum
SL_HUMIDITY_HM = 0xE5
SL_HUMIDITY_NHM = 0xF5
SL_TEMPERATURE_HM = 0xE3
SL_TEMPERATURE_NHM = 0xF3
SL_TEMPERATURE_AH = 0xE0
SL_SI70XX_RESET = 0xFE
SL_W_RHT_U_REG = 0xE6
SL_R_RHT_U_REG = 0xE7
SL_W_HEATER_C_REG = 0x51
SL_R_HEATER_C_REG = 0x11
SL_EID_BYTEL1 = 0xFA
SL_EID_BYTEL2 = 0x0F
SL_EID_BYTE21 = 0xFC
SL_EID_BYTE22 = 0xC9
SL_FIRMWARE_REV1 = 0x84
SL_FIRMWARE_REV2 = 0xB8
}

Enum for Si70xx commands.

enum
SL_HUMIDITY
SL_TEMPERATURE
SL_LAST_MEASUREMENT
}

Enum for Temperature, Humidity measurement.

enum
SL_EID_FIRST_BYTE
SL_EID_SECOND_BYTE
SL_LAST_EID
}

Enum for electronic ID.

enum
SL_RH_T_USER_REG
SL_HEATER_CONTROL_REG
SL_LAST_CONTROL_REG
}

Enum for User, Heater control registers.

Typedefs#

typedef enum sl_si70xx_commands

Enum for Si70xx commands.

Enum for Temperature, Humidity measurement.

typedef enum sl_si70xx_eid_type

Enum for electronic ID.

typedef enum sl_si70xx_registers

Enum for User, Heater control registers.

Functions#

sl_status_t
sl_si91x_si70xx_init(sl_i2c_instance_t i2c_instance, uint8_t addr, sl_si70xx_eid_type_t eid)

Initialize the Si70xx sensor.

sl_status_t
sl_si91x_si70xx_is_present(sl_i2c_instance_t i2c_instance, uint8_t addr, sl_si70xx_eid_type_t eid)

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

sl_status_t
sl_si91x_si70xx_measure_rh_and_temp(sl_i2c_instance_t i2c_instance, uint8_t addr, uint32_t *humid_data, int32_t *temp_data)

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

sl_status_t
sl_si91x_si70xx_get_firmware_revision(sl_i2c_instance_t i2c_instance, uint8_t addr, uint8_t *firmware_revision)

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

sl_status_t
sl_si91x_si70xx_read_temp_from_rh(sl_i2c_instance_t i2c_instance, uint8_t addr, uint32_t *humid_data, int32_t *temp_data)

Reads temperature value from previous relative humidity measurement from Si7006/13/20/21 sensor.

sl_status_t
sl_si91x_si70xx_start_no_hold_measure_rh_or_temp(sl_i2c_instance_t i2c_instance, uint8_t addr, sl_si70xx_measurement_type_t type, uint32_t *data)

Start a no hold measurement of relative humidity (or) temperature from Si7006/13/20/21 sensor.

sl_status_t
sl_si91x_si70xx_measure_humidity(sl_i2c_instance_t i2c_instance, uint8_t addr, uint32_t *humid_data)

Measure relative humidity from Si7006/13/20/21 sensor.

sl_status_t
sl_si91x_si70xx_measure_temperature(sl_i2c_instance_t i2c_instance, uint8_t addr, int32_t *temp_data)

Measure temperature from Si7006/13/20/21 sensor.

sl_status_t
sl_si91x_si70xx_reset(sl_i2c_instance_t i2c_instance, uint8_t addr)

Initiates a si70xx software reset by the appropriate command.

sl_status_t
sl_si91x_si70xx_read_control_register(sl_i2c_instance_t i2c_instance, uint8_t addr, sl_si70xx_registers_t reg, uint8_t *data)

Reads the user register 1 and heater control register data.

sl_status_t
sl_si91x_si70xx_write_control_register(sl_i2c_instance_t i2c_instance, uint8_t addr, sl_si70xx_registers_t reg, uint8_t value)

Writes data to user register 1 and heater control register.

Macros#

#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
I2C_BASE I2C2

I2C2 base.

Enumeration Documentation#

sl_si70xx_commands#

sl_si70xx_commands

Enum for Si70xx commands.

Enumerator
SL_HUMIDITY_HM

Measure Relative Humidity, Hold Master Mode.

SL_HUMIDITY_NHM

Measure Relative Humidity, No Hold Master Mode.

SL_TEMPERATURE_HM

Measure Temperature, Hold Master Mode.

SL_TEMPERATURE_NHM

Measure Temperature, No Hold Master Mode.

SL_TEMPERATURE_AH

Read Temperature Value from Previous RH Measurement.

SL_SI70XX_RESET

Si70XX Reset.

SL_W_RHT_U_REG

Write RH/T User Register 1.

SL_R_RHT_U_REG

Read RH/T User Register 1.

SL_W_HEATER_C_REG

Write Heater Control Register.

SL_R_HEATER_C_REG

Read Heater Control Register.

SL_EID_BYTEL1

Read Electronic ID 1st Byte, first part.

SL_EID_BYTEL2

Read Electronic ID 1st Byte, second part.

SL_EID_BYTE21

Read Electronic ID 2nd Byte, first part.

SL_EID_BYTE22

Read Electronic ID 2nd Byte, second part.

SL_FIRMWARE_REV1

Read Firmware Revision, first part.

SL_FIRMWARE_REV2

Read Firmware Revision, second part.


sl_si70xx_measurement_type#

sl_si70xx_measurement_type

Enum for Temperature, Humidity measurement.

Enumerator
SL_HUMIDITY

Enumerator for humidity selection.

SL_TEMPERATURE

Enumerator for temperature selection.

SL_LAST_MEASUREMENT

Last enum for validation.


sl_si70xx_eid_type#

sl_si70xx_eid_type

Enum for electronic ID.

Enumerator
SL_EID_FIRST_BYTE

Enumerator for sending electronic ID first byte.

SL_EID_SECOND_BYTE

Enumerator for sending electronic ID second byte.

SL_LAST_EID

Last enum for validation.


sl_si70xx_registers#

sl_si70xx_registers

Enum for User, Heater control registers.

Enumerator
SL_RH_T_USER_REG

Enumerator for write RH/T user register selection.

SL_HEATER_CONTROL_REG

Enumerator for heater control register selection.

SL_LAST_CONTROL_REG

Last enum for validation.


Typedef Documentation#

sl_si70xx_commands_t#

typedef enum sl_si70xx_commands sl_si70xx_commands_t

Enum for Si70xx commands.


sl_si70xx_measurement_type_t#

typedef enum sl_si70xx_measurement_type sl_si70xx_measurement_type_t

Enum for Temperature, Humidity measurement.


sl_si70xx_eid_type_t#

typedef enum sl_si70xx_eid_type sl_si70xx_eid_type_t

Enum for electronic ID.


sl_si70xx_registers_t#

typedef enum sl_si70xx_registers sl_si70xx_registers_t

Enum for User, Heater control registers.


Function Documentation#

sl_si91x_si70xx_init#

sl_status_t sl_si91x_si70xx_init (sl_i2c_instance_t i2c_instance, uint8_t addr, sl_si70xx_eid_type_t eid)

Initialize the Si70xx sensor.

Parameters
TypeDirectionArgument NameDescription
sl_i2c_instance_t[in]i2c_instance

: I2C peripheral to use.

uint8_t[in]addr

: I2C address to probe.

sl_si70xx_eid_type_t[in]eid

: electronic ID of type sl_si70xx_eid_type_t.

Returns

  • The following values are returned:

    • SL_STATUS_OK on success

    • SL_STATUS_INITIALIZATION (0x0010) - no Si70xx device present

    • SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is invalid argument


sl_si91x_si70xx_is_present#

sl_status_t sl_si91x_si70xx_is_present (sl_i2c_instance_t i2c_instance, uint8_t addr, sl_si70xx_eid_type_t eid)

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

Parameters
TypeDirectionArgument NameDescription
sl_i2c_instance_t[in]i2c_instance

: I2C peripheral to use.

uint8_t[in]addr

: I2C address to probe.

sl_si70xx_eid_type_t[in]eid

: electronic ID of type sl_si70xx_eid_type_t. If SL_EID_FIRST_BYTE is selected, then EID 1st byte is considered. If SL_EID_SECOND_BYTE is selected, then EID 2nd byte is considered. For EID 1st byte, EID 2nd byte commands please look into datasheet. 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

Returns

  • The following values are returned:

    • SL_STATUS_OK on success

    • SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is invalid argument


sl_si91x_si70xx_measure_rh_and_temp#

sl_status_t sl_si91x_si70xx_measure_rh_and_temp (sl_i2c_instance_t i2c_instance, uint8_t addr, uint32_t * humid_data, int32_t * temp_data)

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

Parameters
TypeDirectionArgument NameDescription
sl_i2c_instance_t[in]i2c_instance

: I2C peripheral to use.

uint8_t[in]addr

: I2C address to probe.

uint32_t *[out]humid_data

: The relative humidity in percentage obtained after doing conversion as per formula mentioned in datasheet.

int32_t *[out]temp_data

: The temperature in milliCelsius.

Returns

  • The following values are returned:

    • SL_STATUS_OK on success

    • SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is invalid argument

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is null pointer


sl_si91x_si70xx_get_firmware_revision#

sl_status_t sl_si91x_si70xx_get_firmware_revision (sl_i2c_instance_t i2c_instance, uint8_t addr, uint8_t * firmware_revision)

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

Parameters
TypeDirectionArgument NameDescription
sl_i2c_instance_t[in]i2c_instance

: I2C peripheral to use.

uint8_t[in]addr

: I2C address to probe.

uint8_t *[out]firmware_revision

: Internal firmware revision.

Returns

  • The following values are returned:

    • SL_STATUS_OK on success

    • SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is invalid argument

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is null pointer


sl_si91x_si70xx_read_temp_from_rh#

sl_status_t sl_si91x_si70xx_read_temp_from_rh (sl_i2c_instance_t i2c_instance, uint8_t addr, uint32_t * humid_data, int32_t * temp_data)

Reads temperature value from previous relative humidity measurement from Si7006/13/20/21 sensor.

Parameters
TypeDirectionArgument NameDescription
sl_i2c_instance_t[in]i2c_instance

: I2C peripheral to use.

uint8_t[in]addr

: I2C address to probe.

uint32_t *[out]humid_data

: The relative humidity in percent (multiplied by 1000).

int32_t *[out]temp_data

: The temperature in milliCelsius.

Returns

  • The following values are returned:

    • SL_STATUS_OK on success

    • SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is invalid argument

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is null pointer


sl_si91x_si70xx_start_no_hold_measure_rh_or_temp#

sl_status_t sl_si91x_si70xx_start_no_hold_measure_rh_or_temp (sl_i2c_instance_t i2c_instance, uint8_t addr, sl_si70xx_measurement_type_t type, uint32_t * data)

Start a no hold measurement of relative humidity (or) temperature from Si7006/13/20/21 sensor.

Parameters
TypeDirectionArgument NameDescription
sl_i2c_instance_t[in]i2c_instance

: I2C peripheral to use.

uint8_t[in]addr

: I2C address to probe.

sl_si70xx_measurement_type_t[in]type

: measurement value of type sl_si70xx_measurement_type_t.

uint32_t *[out]data

: The data read from the sensor.

Returns

  • The following values are returned:

    • SL_STATUS_OK on success

    • SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is invalid argument


sl_si91x_si70xx_measure_humidity#

sl_status_t sl_si91x_si70xx_measure_humidity (sl_i2c_instance_t i2c_instance, uint8_t addr, uint32_t * humid_data)

Measure relative humidity from Si7006/13/20/21 sensor.

Parameters
TypeDirectionArgument NameDescription
sl_i2c_instance_t[in]i2c_instance

: I2C peripheral to use.

uint8_t[in]addr

: I2C address to probe.

uint32_t *[out]humid_data

: The relative humidity measurement.

Returns

  • The following values are returned:

    • SL_STATUS_OK on success

    • SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is invalid argument

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is null pointer


sl_si91x_si70xx_measure_temperature#

sl_status_t sl_si91x_si70xx_measure_temperature (sl_i2c_instance_t i2c_instance, uint8_t addr, int32_t * temp_data)

Measure temperature from Si7006/13/20/21 sensor.

Parameters
TypeDirectionArgument NameDescription
sl_i2c_instance_t[in]i2c_instance

: I2C peripheral to use.

uint8_t[in]addr

: I2C address to probe.

int32_t *[out]temp_data

: The temperature measurement.

Returns

  • The following values are returned:

    • SL_STATUS_OK on success

    • SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is invalid argument

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is null pointer


sl_si91x_si70xx_reset#

sl_status_t sl_si91x_si70xx_reset (sl_i2c_instance_t i2c_instance, uint8_t addr)

Initiates a si70xx software reset by the appropriate command.

Parameters
TypeDirectionArgument NameDescription
sl_i2c_instance_t[in]i2c_instance

: I2C peripheral to use.

uint8_t[in]addr

: I2C address to probe.

Returns

  • The following values are returned:

    • SL_STATUS_OK on success

    • SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is invalid argument


sl_si91x_si70xx_read_control_register#

sl_status_t sl_si91x_si70xx_read_control_register (sl_i2c_instance_t i2c_instance, uint8_t addr, sl_si70xx_registers_t reg, uint8_t * data)

Reads the user register 1 and heater control register data.

Parameters
TypeDirectionArgument NameDescription
sl_i2c_instance_t[in]i2c_instance

: I2C peripheral to use.

uint8_t[in]addr

: I2C address to probe.

sl_si70xx_registers_t[in]reg

: Register of type sl_si70xx_registers_t.

uint8_t *[out]data

: The data read from the sensor.

Returns

  • The following values are returned:

    • SL_STATUS_OK on success

    • SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is invalid argument

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is null pointer


sl_si91x_si70xx_write_control_register#

sl_status_t sl_si91x_si70xx_write_control_register (sl_i2c_instance_t i2c_instance, uint8_t addr, sl_si70xx_registers_t reg, uint8_t value)

Writes data to user register 1 and heater control register.

Parameters
TypeDirectionArgument NameDescription
sl_i2c_instance_t[in]i2c_instance

: I2C peripheral to use.

uint8_t[in]addr

: I2C address to probe.

sl_si70xx_registers_t[in]reg

: Register of type sl_si70xx_registers_t.

uint8_t[out]value

: The value written into the register.

Returns

  • The following values are returned:

    • SL_STATUS_OK on success

    • SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is invalid argument