1| Supported Targets | ESP32-S2 | ESP32-C3 |
2| ----------------- | -------- | -------- |
3
4# Temperature Sensor Example
5
6The ESP32-S2 and ESP32-C3 has a built-in temperature sensor. The temperature sensor module contains an 8-bit Sigma-Delta ADC and a temperature offset DAC.
7
8The conversion relationship is the first two columns of the table below. Among them, `offset = 0`(default) is the main measurement option, and other values are extended measurement options.
9
10| DAC level | offset | measure range(℃) | measure error(℃) |
11| :-------: | :----: | :--------------: | :--------------: |
12|     0     |   -2   |     50 ~ 125     |       < 3        |
13|     1     |   -1   |     20 ~ 100     |       < 2        |
14|     2     |   0    |     -10 ~ 80     |       < 1        |
15|     3     |   1    |     -30 ~ 50     |       < 2        |
16|     4     |   2    |     -40 ~ 20     |       < 3        |
17
18## How to use example
19
20Before project configuration and build, be sure to set the correct chip target using `idf.py set-target <chip_name>`.
21
22### Hardware Required
23
24* A development board with ESP32-S2 or ESP32-C3 SoC (e.g., ESP32-S2-Saola-1, ESP32-S2-DevKitM-1, ESP32-C3-DevKitM-1, etc.)
25* A USB cable for power supply and programming
26
27### Build and Flash
28
29Build the project and flash it to the board, then run monitor tool to view serial output:
30
31Run `idf.py -p PORT flash monitor` to build, flash and monitor the project.
32
33(To exit the serial monitor, type ``Ctrl-]``.)
34
35See the [Getting Started Guide](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/get-started/index.html) for full steps to configure and use ESP-IDF to build projects.
36
37## Example Output
38
39```
40I (243) TempSensor: Initializing Temperature sensor
41I (243) TempSensor: default dac 2, clk_div 6
42I (243) TempSensor: Config temperature range [-10°C ~ 80°C], error < 1°C
43I (253) TempSensor: Temperature sensor started
44I (1253) TempSensor: Temperature out celsius 27.287399°C
45I (2253) TempSensor: Temperature out celsius 26.848801°C
46I (3253) TempSensor: Temperature out celsius 26.848801°C
47I (4253) TempSensor: Temperature out celsius 27.287399°C
48I (5253) TempSensor: Temperature out celsius 27.287399°C
49```
50
51## Troubleshooting
52
53For any technical queries, please open an [issue](https://github.com/espressif/esp-idf/issues) on GitHub. We will get back to you soon.
54