The attached example is an adaptation of the standard 'SOC - Thermometer' example which instead of accessing the Si7021 Temperature and Relative Humidity sensor through I2C uses the EFR32's own internal temperature sensor. This sensor is measured during production test and the temperature readout from the ADC at production temperature as well as the Celsius value are given in the device information page. Using these and the millivolts per degrees slope found in the sensor datasheet the current temperature can be calculated according to formula:
(For more information, see ADC section of the reference manual of your chosen hardware, e.g. EFR32xG13)
Setting up the project
Start by creating an SoC - Empty sample app for your chosen hardware.
In the project menu select new | Silicon Labs appBuilder project.
Select Bluetooth SDK and click next
Select the latest Bluetooth SDK and click next
Select SOC – Empty and click next
Enter a name for the project and click next
Replace existing app.c with the app.c attached to this article
Copy em_adc.c and em_adc.h from the SDK to the project folder if they aren't already in the platform->emlib->inc/src folders.
Import the attached gatt.xml file in the GATT Configurator sidebar (.isc file, "Import GATT from .bgproj file"). This will add the Health Thermometer service and Temperature Measurement characteristic and change Device Name to "IntTemp".
Press Save and Generate
Build and flash
Using the Blue Gecko app you can now read the temperature sampled from the internal temperature sensor.
Implementation
There are a couple of changes to the basic SoC-Thermometer example:
init_adc function to initialize ADC with correct voltage reference and prescaler etc. This is called after boot event.
read_adc function to get single sample readout from ADC. This has a bit of a busy-wait-loop for simplicity.
convert_to_millicelsius function takes the sample and uses the calibration values in the above formula to get the result as degrees Celsius. Returned value is given as millicelsius.
measure_temperature function is nearly identical to the one in the Thermometer example except for this line that uses the above functions:
[Deprecated] KBA_BT_1006: Thermometer example with EFR32 internal temperature sensor
Note: This KBA has been marked as deprecated. A more updated KBA can be found here: Thermometer Example with EFR32 Internal Temperature Sensor
Introduction
The attached example is an adaptation of the standard 'SOC - Thermometer' example which instead of accessing the Si7021 Temperature and Relative Humidity sensor through I2C uses the EFR32's own internal temperature sensor. This sensor is measured during production test and the temperature readout from the ADC at production temperature as well as the Celsius value are given in the device information page. Using these and the millivolts per degrees slope found in the sensor datasheet the current temperature can be calculated according to formula:
(For more information, see ADC section of the reference manual of your chosen hardware, e.g. EFR32xG13)
Setting up the project
Start by creating an SoC - Empty sample app for your chosen hardware.
Using the Blue Gecko app you can now read the temperature sampled from the internal temperature sensor.
Implementation
There are a couple of changes to the basic SoC-Thermometer example: