BJT Temperature Sensor#
Introduction#
Bipolar Junction Transistor (BJT) can be utilized as a temperature sensor and its temperature-dependent characteristics. The BJT temperature sensor peripheral converts a digital output into a temperature in degrees Celsius. The process involves:
Reading the Band-gap Reference: The sensor first measures the band-gap voltage.
Reading the BJT Output: After successful calibration, the BJT output is read.
Computing the Temperature: The temperature is calculated by taking the difference between the BJT output and the band-gap reference value.
Additionally, by switching the current temperature mode, you can also obtain the temperature value in Kelvin and Fahrenheit.
Configuration#
The configurable parameters by using structured macros are:
Temperature Units: By altering the macros in the mode, you can change the temperature from Celsius to Kelvin and from Celsius to Fahrenheit: sl_bjt_temperature_sensor_enum_t
Sensor State: Structured macros are used to enable and disable the BJT temperature sensor: sl_bjt_temperature_sensor_state_t
Usage#
The BJT temperature sensor will first call the callback event after initializing and configuring the channel settings and operating mode. It will enable, configure, and read the BJT temperature value in the read data along with configuring and reading the band-gap value. Once the values are successfully read, the temperature in Celsius will be computed.
Initialize the BJT temperature sensor:sl_si91x_bjt_temperature_sensor_init
Read data from the BJT temperature sensor:sl_si91x_bjt_temperature_sensor_read_data
Enable or disable the BJT temperature sensor:sl_si91x_bjt_temperature_sensor_state
Configure the channel of BJT:sl_si91x_bjt_temperature_sensor_set_channel_configuration
Configure band gap channel for BJT temperature sensor:sl_si91x_bjt_temperature_sensor_bg_set_channel_configuration
Additionally, APIs to modify the temperature mode and deinitialize the callback event using the conversion and deinit APIs:
De-initialize the BJT temperature sensor:sl_si91x_bjt_temperature_sensor_deinit
Convert the sensor reading to temperature in Celsius/Fahrenheit/Kelvin:sl_si91x_get_bjt_temperature_sensor_conversion
Enumerations#
Enumeration for BJT temperature sensor types.
Enumeration for BJT temperature sensor state.
Functions#
To initialize the BJT temperature sensor by configuring ADC channels and settings.
To read data from the BJT temperature sensor and convert it to temperature.
To enable or disable the BJT temperature sensor.
To configure the BJT temperature sensor with the specified channel.
To configure the band gap for the BJT temperature sensor.
To convert the sensor reading to temperature in Celsius, Fahrenheit, or Kelvin.
To de-initialize the BJT temperature sensor and release resources.
Enumeration Documentation#
sl_bjt_temperature_sensor_enum_t#
sl_bjt_temperature_sensor_enum_t
Enumeration for BJT temperature sensor types.
Enumerator | |
---|---|
SL_BJT_DEGREE_CELSIUS | Temperature in degree Celsius. |
SL_BJT_FAHRENHEIT | Temperature in Fahrenheit. |
SL_BJT_KELVIN | Temperature in Kelvin. |
58
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_bjt_temperature_sensor.h
sl_bjt_temperature_sensor_state_t#
sl_bjt_temperature_sensor_state_t
Enumeration for BJT temperature sensor state.
Enumerator | |
---|---|
SL_BJT_TEMPERATURE_SENSOR_DISABLE | Temperature sensor state is disabled. |
SL_BJT_TEMPERATURE_SENSOR_ENABLE | Temperature sensor state is enabled. |
SL_BJT_TEMPERATURE_SENSOR_LAST | Last member of enum is used to validate the sensor state. |
67
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_bjt_temperature_sensor.h
Function Documentation#
sl_si91x_bjt_temperature_sensor_init#
sl_status_t sl_si91x_bjt_temperature_sensor_init (adc_ch_config_t sl_bjt_temperature_sensor_channel_config, adc_config_t sl_bjt_temperature_sensor_config)
To initialize the BJT temperature sensor by configuring ADC channels and settings.
[in] | sl_bjt_temperature_sensor_channel_config | BJT channels configuration structure containing channel number, sampling rate, and sample length. |
[in] | sl_bjt_temperature_sensor_config | BJT configuration structure containing the operation mode and number of channels. |
This API performs ADC initialization and configuration, sets the register callback, and starts the ADC.
Pre-conditions:
Ensure that the ADC peripheral clock is enabled.
Ensure that the necessary GPIOs for the ADC channels are configured.
Returns
sl_status_t Status code indicating the result:
SL_STATUS_OK - Success.
SL_STATUS_FAIL - Fail.
SL_STATUS_INVALID_PARAMETER - Invalid parameter.
SL_STATUS_INVALID_RANGE - Invalid range.
SL_STATUS_INVALID_COUNT - Invalid count.
For more information on the status documentation, see SL STATUS DOCUMENTATION.
98
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_bjt_temperature_sensor.h
sl_si91x_bjt_temperature_sensor_read_data#
sl_status_t sl_si91x_bjt_temperature_sensor_read_data (double * temp_data)
To read data from the BJT temperature sensor and convert it to temperature.
[out] | temp_data | Pointer to the variable where the converted temperature data will be stored. |
The API is used to read raw data from the BJT temperature sensor and convert it to a temperature value.
Pre-conditions:
Returns
sl_status_t Status code indicating the result:
SL_STATUS_OK - Success.
SL_STATUS_FAIL - Fail.
SL_STATUS_NULL_POINTER - The parameter is a null pointer.
SL_STATUS_INVALID_PARAMETER - Parameters are invalid.
SL_STATUS_INVALID_RANGE - Mismatch Range.
For more information on the status documentation, see SL STATUS DOCUMENTATION.
121
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_bjt_temperature_sensor.h
sl_si91x_bjt_temperature_sensor_state#
sl_status_t sl_si91x_bjt_temperature_sensor_state (sl_bjt_temperature_sensor_state_t state)
To enable or disable the BJT temperature sensor.
[in] | state | Value indicating whether to enable or disable the BJT temperature sensor:
|
The API is used to enable or disable the BJT temperature sensor.
Pre-conditions:
Returns
sl_status_t Status code indicating the result:
SL_STATUS_OK - Success.
SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.
For more information on the status documentation, see SL STATUS DOCUMENTATION.
143
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_bjt_temperature_sensor.h
sl_si91x_bjt_temperature_sensor_set_channel_configuration#
sl_status_t sl_si91x_bjt_temperature_sensor_set_channel_configuration (adc_ch_config_t sl_bjt_temperature_sensor_channel_config)
To configure the BJT temperature sensor with the specified channel.
[in] | sl_bjt_temperature_sensor_channel_config | BJT channel configuration structure containing the positive input to BJT value. |
The API is used to configure the BJT temperature sensor with the specified channel.
Pre-conditions:
Returns
sl_status_t Status code indicating the result:
SL_STATUS_OK - Success.
SL_STATUS_NULL_POINTER - The parameter is a null pointer.
SL_STATUS_INVALID_PARAMETER - Parameters are invalid.
SL_STATUS_INVALID_RANGE - Mismatch range.
For more information on the status documentation, see SL STATUS DOCUMENTATION.
164
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_bjt_temperature_sensor.h
sl_si91x_bjt_temperature_sensor_bg_set_channel_configuration#
sl_status_t sl_si91x_bjt_temperature_sensor_bg_set_channel_configuration (adc_ch_config_t sl_bjt_temperature_sensor_channel_config)
To configure the band gap for the BJT temperature sensor.
[in] | sl_bjt_temperature_sensor_channel_config | Band gap channel configuration structure containing the positive input to OPAMP value. |
The API is used to configure the band gap for the BJT temperature sensor.
Pre-conditions:
Returns
sl_status_t Status code indicating the result:
SL_STATUS_OK - Success.
SL_STATUS_NULL_POINTER - The parameter is a null pointer.
SL_STATUS_INVALID_PARAMETER - Parameters are invalid.
SL_STATUS_INVALID_RANGE - Mismatch range.
For more information on the status documentation, see SL STATUS DOCUMENTATION.
186
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_bjt_temperature_sensor.h
sl_si91x_get_bjt_temperature_sensor_conversion#
sl_status_t sl_si91x_get_bjt_temperature_sensor_conversion (double * temp_data, sl_bjt_temperature_sensor_enum_t current_temperature_mode)
To convert the sensor reading to temperature in Celsius, Fahrenheit, or Kelvin.
[out] | temp_data | Pointer to the variable where the converted temperature data will be stored. |
[in] | current_temperature_mode | Current temperature mode sl_bjt_temperature_sensor_enum_t |
This API converts the sensor reading to temperature in Celsius, Fahrenheit, or Kelvin.
Pre-conditions:
sl_si91x_bjt_temperature_sensor_init() must be called before using this API.
sl_si91x_bjt_temperature_sensor_read_data() must be called to get the sensor reading.
Returns
sl_status_t Status code indicating the result:
SL_STATUS_OK - Success.
SL_STATUS_FAIL - Fail.
SL_STATUS_NULL_POINTER - The parameter is a null pointer.
SL_STATUS_INVALID_PARAMETER - Parameters are invalid.
For more information on the status documentation, see SL STATUS DOCUMENTATION.
210
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_bjt_temperature_sensor.h
sl_si91x_bjt_temperature_sensor_deinit#
sl_status_t sl_si91x_bjt_temperature_sensor_deinit (adc_config_t sl_bjt_temperature_sensor_config)
To de-initialize the BJT temperature sensor and release resources.
[in] | sl_bjt_temperature_sensor_config | Configuration structure used for de-initializing the BJT temperature sensor. |
The API is used to de-initialize the BJT temperature sensor and release any allocated resources.
Pre-conditions:
Returns
sl_status_t Status code indicating the result:
SL_STATUS_OK - Success.
SL_STATUS_FAIL - Fail.
For more information on the status documentation, see SL STATUS DOCUMENTATION.
230
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_bjt_temperature_sensor.h