Your ESP32 has a thermometer. It's lying to you.
The ESP32-S3 has a built-in temperature sensor, and in Arduino it takes one line to read it: temperatureRead(). But it measures the silicon, not the air. How far the reading is from the room depends on what the chip is doing.
In short
- Room at 21 °C (70 °F). The chip, idle at 240 MHz: 25.6 °C. Both cores busy: about 35 °C. Wi-Fi scanning nonstop, no connection: 40.6 °C, 15 °C above idle.
- After 15 minutes of deep sleep the sensor read 17.6–18.6 °C, below the room. A powered chip cannot be colder than the air around it, so here the reading is at least about 3 °C too low.
- Idle at 80 MHz is about 3 °C cooler than idle at 240 MHz. Every mode took 5–7 minutes to settle. Readings come in whole-degree steps.
- The first
temperatureRead()call installs the ESP-IDF driver (about 2.4 ms); after that a reading takes about 8.5 µs. - Espressif says the sensor reflects changes well but cannot give a precise value, and does not recommend it for ambient temperature. Use it to watch the chip; for the room, use a separate sensor.
One line: temperatureRead()
On the ESP32-S3, reading the sensor in Arduino takes one function call. It returns degrees Celsius; the core's header describes it as //returns chip temperature in Celsius.
void setup() {
Serial.begin(115200);
}
void loop() {
Serial.println(temperatureRead()); // °C
delay(1000);
}
On our board the Serial Monitor shows something like this:
25.60
25.60
26.60
The values look plausible. The question is what they are the temperature of.
What the call does
In arduino-esp32 3.3.12, temperatureRead() on the S3 is implemented in cores/esp32/esp32-hal-misc.c. On the first call it installs and enables the ESP-IDF temperature_sensor driver, configured for the 10–50 °C range. Every later call only reads the value:
// arduino-esp32 3.3.12, esp32-hal-misc.c (what happens, simplified)
// first call only:
// TEMPERATURE_SENSOR_CONFIG_DEFAULT(10, 50)
// temperature_sensor_install(...)
// temperature_sensor_enable(...)
// every call:
// temperature_sensor_get_celsius(...)
The cost is visible when the two calls are timed with the CPU cycle counter (XTHAL_GET_CCOUNT()) at 240 MHz:
| Call | Cycles (3 runs) | Time at 240 MHz |
|---|---|---|
| first call (driver install) | 577,295 – 577,700 | ~2.4 ms |
| second call | 2,030 – 2,042 | ~8.5 µs |
The numbers were the same in all three runs. If the first call happens in a timing-sensitive place, it is worth calling temperatureRead() once in setup().
Which chips have it
In ESP-IDF v5.5.6 the temperature sensor is supported (SOC_TEMP_SENSOR_SUPPORTED) on the ESP32-S2, S3, C2, C3, C5, C6, C61, H2 and P4.
The original ESP32 is different. Espressif removed the sensor from the ESP32 datasheet and Technical Reference Manual in 2018 (the revision history says “Removed content about temperature sensor”), and the ESP-IDF Temperature Sensor page does not exist for the ESP32. arduino-esp32 still provides temperatureRead() there, through the undocumented function temprature_sens_read(), marked in the source with the comment Undocumented!!!. Everything on this page was measured on an ESP32-S3 only.
What it actually measures
Not the air. The sensor sits inside the chip, on the silicon. ESP-IDF calls it a “built-in sensor used to measure the chip's internal temperature”, and the Technical Reference Manual says it is there “to monitor temperature changes inside the chip in real time”. The ESP32-S3 datasheet is explicit about what that means for the reading:
“The temperature value depends on factors such as microcontroller clock frequency or I/O load. Generally, the chip's internal temperature is higher than the ambient temperature.”
So the real question is: how much warmer, and how much does it depend on what the sketch does?
The test
The board lies open on a desk, no case and no heatsink, powered over USB. The room was at 21 °C (70 °F). One sketch runs the whole sequence:
- After a reset the sketch goes straight into deep sleep for 15 minutes, so the chip cools down.
- A timer wakes it, and it runs through the modes below one after another, without a reboot.
- A separate task logs one
temperatureRead()value every second, plus 16 readings in a row (mean, min, max).
| Mode | Duration | What it does |
|---|---|---|
| idle 240 MHz | 12 min | loop() waits in delay() |
| both cores busy | 10 min | one task per core runs a tight floating-point loop (madd.s) |
| idle 240 MHz again | 10 min | delay() |
| Wi-Fi scanning | 10 min | WiFi.mode(WIFI_STA), then WiFi.scanNetworks() back to back, no connection |
| Wi-Fi off | 10 min | WiFi.mode(WIFI_OFF), idle at 240 MHz |
| idle 160 MHz | 10 min | setCpuFrequencyMhz(160), idle |
| idle 80 MHz | 10 min | setCpuFrequencyMhz(80), idle |
The whole sequence ran three times in a row, about 87 minutes each. All three runs matched within 1 °C in every mode. Within each second, the 16 consecutive readings also differed by no more than 1 °C.
Colder than the room
Right after waking from 15 minutes of deep sleep, the sensor read 17.6 °C (about 64 °F) in two runs and 18.6 °C in the third. The room was at 21 °C.
A powered chip on a board cannot be colder than the air around it. So at this point the absolute reading is off by at least about 3 °C, downwards.
This matches what ESP-IDF says about the sensor: it shows changes well, not exact values. What the error is at other temperatures is not known from this test; there was no second thermometer on the chip.
One detail of the method: during deep sleep the board stays powered (the USB bridge and the regulator keep running), so this is not a full cold start, only the chip itself cooling down.
From there, just sitting idle at 240 MHz, the reading climbs for about six minutes before it settles.
Both cores, Wi-Fi and clock speed
Steady values for each mode (median of the last 3 minutes of the mode, the room line for reference):
- Idle at 240 MHz the chip settles at 25.6 °C (78 °F), about 4–5 °C above the room. Given that the sensor read low after sleep, the real difference is probably larger.
- Both cores running flat out add 9–10 °C: about 35 °C (95 °F).
- Wi-Fi scanning, with no connection at all, reaches 40.6 °C (105 °F). That is 15 °C above idle, more than both cores at full load. Each scan took about 2.6 s and saw 5–14 networks. This is a measurement on our board; Espressif's documents do not state how much Wi-Fi heats the chip.
- Dropping the clock to 80 MHz takes about 3 °C off: 23.6 °C against 26.6 °C at 240 MHz idle just before it.
The full table, all three runs:
| Mode | Run 1 | Run 2 | Run 3 | Result | vs idle 240 MHz |
|---|---|---|---|---|---|
| right after 15 min sleep | 17.6 | 18.6 | 17.6 | ~18 | — |
| idle 240 MHz | 25.6 | 25.6 | 25.6 | 25.6 | 0 |
| both cores busy | 35.6 | 34.6 | 34.6 | ~35 | +9…10 |
| idle 240 MHz again | 26.6 | 26.6 | 26.6 | 26.6 | +1 |
| Wi-Fi scanning | 40.6 | 40.6 | 40.6 | 40.6 | +15 |
| Wi-Fi off | 26.6 | 26.6 | 26.6 | 26.6 | +1 |
| idle 160 MHz | 25.6 | 25.6 | 24.6 | ~25 | −1…−2 vs 26.6 |
| idle 80 MHz | 23.6 | 23.6 | 23.6 | 23.6 | −3 vs 26.6 |
Note that the second idle at 240 MHz (and the idle after Wi-Fi) settled at 26.6 °C, one step above the first idle. The clock-speed comparisons are made against that value, the idle that came right before them.
How fast it settles
The reading does not jump to its new value when the mode changes. Median of three runs, one value per minute from the start of each mode:
| Mode | 0 min | 1 | 2 | 3 | 4 | Steady (from) |
|---|---|---|---|---|---|---|
| idle 240 MHz | 18.6 | 21.6 | 22.6 | 23.6 | 24.6 | 25.6 (6 min) |
| both cores busy | 26.6 | 30.6 | 32.6 | 32.6 | 33.6 | 34.6 (5 min) |
| idle 240 MHz again | 33.6 | 30.6 | 29.6 | 28.6 | 27.6 | 26.6 (6 min) |
| Wi-Fi scanning | 29.6 | 34.6 | 36.6 | 38.6 | 39.6 | 40.6 (6 min) |
| Wi-Fi off | 38.6 | 33.6 | 30.6 | 29.6 | 28.6 | 26.6 (7 min) |
| idle 160 MHz | 26.6 | 25.6 | 25.6 | 25.6 | 25.6 | 25.6 (1 min) |
| idle 80 MHz | 24.6 | 24.6 | 24.6 | 23.6 | 23.6 | 23.6 (3 min) |
For the large changes it took 5–7 minutes to reach a steady value. Two practical consequences:
- A reading taken right after boot or right after a change of workload says little about where the chip will end up.
- The reading reflects the last few minutes of activity, not just the current moment. The same idle sketch read 33.6 °C one minute after the cores stopped and 26.6 °C six minutes later.
Whole-degree steps
Every value in all three runs ends in .60: 17.60, 23.60, 40.60. The reason is in ESP-IDF v5.5.6: the low-level read (temp_sensor_get_raw_value) returns whole degrees as an int, and the driver then subtracts a constant per-chip calibration offset stored in eFuse:
// ESP-IDF v5.5.6, esp_driver_tsens/src/temperature_sensor.c
result = tsens_raw - s_deltaT / 10.0;
On this chip the offset produces the .6; the step is still 1 °C. So differences smaller than 1 °C are invisible to this sensor, and all numbers on this page are only as fine as that step. The 16 readings taken within each second differed by at most one step.
How accurate is it?
Espressif's own documentation answers this directly:
“…designed primarily to measure the temperature inside the silicon… The sensor can reflect the temperature changes very well but it can't give a precise measurement value. So it's not recommended to use it for ambient temperature measurement.”
The datasheet gives the overall range of the sensor as −40 °C to 125 °C. Within that range the hardware has several measurement ranges, and the error differs between them. The current documentation only says: “different measure ranges have different measurement errors… we have an internal mechanism to choose the minimum error”.
Older versions of the docs (ESP-IDF v5.5 and v5.5.1) went further and listed an error for each range, from under 1 °C to under 3 °C. That table was removed in ESP-IDF commit 96283dd044 (2025-07-04) with the message “remove inaccurate part”. The numbers now remain only in the driver source (components/soc/esp32s3/temperature_sensor_periph.c), and the Technical Reference Manual lists the ranges without any errors. Since Espressif itself withdrew the table as inaccurate, it should not be read as a specification.
For reference, temperatureRead() in Arduino always installs the driver with the 10–50 °C range.
What it's good for
Good for
- is the chip running hot?
- how hard is the radio working?
- changes, not exact values
Not for
- room temperature
- a weather station
The sensor is not broken; it measures something else. It is useful for watching the chip itself, for example to notice overheating or to back off the workload when the chip gets too hot. For context, the ESP32-S3 datasheet gives the allowed ambient temperature for parts with 8 MB of Octal PSRAM, like the ESP32-S3R8 on this board and the N16R8 modules, as −40 to 65 °C (up to 85 °C with PSRAM ECC enabled); parts without PSRAM go up to 85 or 105 °C.
For a weather station or a room thermometer, use a separate sensor, such as a DS18B20 or a BME280.
Caveats and open questions
- A fast step when Wi-Fi turns on and off. In the first second after
WiFi.mode(WIFI_STA)the reading rose by 3 °C (26.6 → 29.6 °C in all three runs); afterWIFI_OFFit fell by 2–3 °C within 1–2 seconds. After that it changed slowly, over minutes. Loading the cores gave a similar fast step, but smaller (about +1 °C). This may be the silicon heating quickly and then the package and board slowly, but without a current measurement that is not proven: the radio could also be affecting the measurement itself. It stays an open question. - Absolute error at different temperatures was not measured; that needs a reference thermometer on the chip package.
- Current draw in each mode was not measured, so the heating is not compared with power.
- Only scanning was tested. Connecting to an access point and transferring data were not.
- One board. Another board of the same type, a board in a case, or other chips (ESP32, C3 and so on) may give different numbers.
Test setup and code
| Board | ESP32-S3, chip ESP32-S3R8 (QFN56, rev v0.2, embedded 8 MB PSRAM), 16 MB external flash, 40 MHz crystal; open on a desk, no case or heatsink, powered over USB |
| Core | arduino-esp32 3.3.12, board esp32:esp32:esp32s3, all board settings at their defaults |
| Toolchain | arduino-cli from Arduino IDE 2.3.8 |
| Room | 21 °C (70 °F) |
| Method | 15 min deep sleep, then seven modes of 10–12 min each; one temperatureRead() value per second from a logger task (priority 5), plus 16 consecutive readings; steady value = median of the last 3 minutes of a mode |
| Load | two priority-1 tasks pinned to cores 0 and 1, a 10,000-iteration madd.s loop (checked in the disassembly that it was not optimized away); every 100 ms each yields one tick so the task watchdog stays fed (about 1% idle) |
| Runs | 3 full runs in a row, about 87 minutes each; the host logs the serial output with timestamps |
#include <WiFi.h>
#include "esp_sleep.h"
#include "xtensa/core-macros.h"
#define COOL_MIN 15
struct Phase { const char *name; uint32_t minutes; };
static const Phase PHASES[] = {
{"idle240", 12}, {"load2", 10}, {"idle240b", 10},
{"wifiscan", 10}, {"wifioff", 10},
{"idle160", 10}, {"idle80", 10},
};
// Logger task: one reading per second, plus 16 in a row (mean, min, max).
static void logger(void *) {
TickType_t last = xTaskGetTickCount();
for (;;) {
float t1 = temperatureRead();
float sum = 0; float mn = 1e9, mx = -1e9;
for (int i = 0; i < 16; i++) { float v = temperatureRead(); sum += v; if (v < mn) mn = v; if (v > mx) mx = v; }
Serial.printf("T,%lu,%s,%u,%.2f,%.2f,%.2f,%.2f\n", (unsigned long)millis(), (const char *)g_phase,
(unsigned)getCpuFrequencyMhz(), t1, sum / 16, mn, mx);
vTaskDelayUntil(&last, pdMS_TO_TICKS(1000));
}
}
void setup() {
Serial.begin(115200);
delay(200);
// First boot: sleep so the chip cools down, then wake up by timer.
if (esp_sleep_get_wakeup_cause() != ESP_SLEEP_WAKEUP_TIMER) {
esp_sleep_enable_timer_wakeup((uint64_t)COOL_MIN * 60ULL * 1000000ULL);
esp_deep_sleep_start();
}
// Cost of the first call (driver install) and of the next one, in CPU cycles.
uint32_t c0 = XTHAL_GET_CCOUNT(); float a = temperatureRead(); uint32_t c1 = XTHAL_GET_CCOUNT();
float b = temperatureRead(); uint32_t c2 = XTHAL_GET_CCOUNT();
// ... print c1 - c0 and c2 - c1, start spinner tasks on both cores and the logger
}
void loop() {
for (const Phase &p : PHASES) {
// ... per phase: setCpuFrequencyMhz(), g_spin = true, WiFi.mode(WIFI_STA / WIFI_OFF)
while ((int32_t)(millis() - end) < 0) {
if (!strcmp(p.name, "wifiscan")) WiFi.scanNetworks(); // back to back, no connection
else delay(200);
}
}
}
Sources
- ESP-IDF v5.5.6: Temperature Sensor (ESP32-S3) “built-in sensor used to measure the chip's internal temperature” · “designed primarily to measure the temperature inside the silicon… can reflect the temperature changes very well but it can't give a precise measurement value. So it's not recommended to use it for ambient temperature measurement.” · “different measure ranges have different measurement errors”
- ESP-IDF v5.5: Temperature Sensor (ESP32-S3), older version still has the table of errors per range (under 1 °C to under 3 °C), removed later in commit 96283dd044, “remove inaccurate part”
- ESP32-S3 Datasheet v2.2, §4.2.2.2 and Table 1-1 “The temperature value depends on factors such as microcontroller clock frequency or I/O load. Generally, the chip's internal temperature is higher than the ambient temperature.” · “The temperature sensor has a range of –40 °C to 125 °C.”
- ESP32-S3 Technical Reference Manual v1.8, §39.4.1 and Table 39.4-1 “to monitor temperature changes inside the chip in real time”; measurement ranges without errors
- ESP32-S3-WROOM-1/1U Datasheet v1.8, §1.2 “R8 and R16V series modules operate at –40 ~ 65 °C ambient temperature… if the PSRAM ECC function is enabled, the maximum ambient temperature can be improved to 85 °C”
- arduino-esp32 3.3.12: cores/esp32/esp32-hal-misc.c and esp32-hal.h
TEMPERATURE_SENSOR_CONFIG_DEFAULT(10, 50), install and enable once, thentemperature_sensor_get_celsius· “//returns chip temperature in Celsius” · on the ESP32:temprature_sens_read(), “Undocumented!!!” - ESP-IDF v5.5.6 source:
soc_caps.h,esp_hw_support/sar_periph_ctrl_common.c,esp_driver_tsens/src/temperature_sensor.cSOC_TEMP_SENSOR_SUPPORTEDon S2, S3, C2, C3, C5, C6, C61, H2, P4 · raw value in whole degrees (int) ·result = tsens_raw - s_deltaT / 10.0 - ESP32 Datasheet and Technical Reference Manual, revision history (2018) “Removed content about temperature sensor”
Video
A short video on the same topic is on the ESPSSS YouTube channel (3:10, 2026-11-22). This page goes into more detail.
Also as a YouTube Short.