What Does a Temperature Sensor Do in Embedded Thermal Loops?

At its core, a temperature sensor transduces thermal gradients into readable electrical signals—voltage, resistance, or digital data packets—so your microcontroller can execute thermal protection logic. But asking "what does a temperature sensor do" in the context of embedded power design requires looking past the basic physics. In an ESP32 or Raspberry Pi build, the sensor acts as the critical feedback node in a closed-loop thermal management system.

Without it, your power stage is flying blind. With it, you can implement PWM fan control, dynamic clock scaling, or load-shedding before silicon reaches destructive limits. We divide these into two categories:

  • Internal Sensors: The ESP32-S3 features an internal temperature sensor calibrated to monitor the core die. It is excellent for triggering CPU throttling but suffers from thermal lag when trying to measure external components like voltage regulators or motor drivers.
  • External Sensors: Discrete components like the DS18B20 (1-Wire digital), TMP36 (analog voltage), or 10k NTC thermistors. These are physically strapped to the metal tabs of power components to measure case temperature ($T_C$) directly.
Bench Tip: Never rely solely on the ESP32's internal sensor to protect external power stages. The FR4 fiberglass of your PCB is a thermal insulator; a MOSFET can hit 120°C while the ESP32 die sitting an inch away reads a comfortable 45°C.

The Math: Junction-to-Ambient Thermal Paths and Derating

To use a temperature sensor effectively, you must understand what it is actually measuring relative to the silicon junction. Heat flows from the silicon junction to the ambient air through a series of thermal resistances, measured in °C/W. The governing equation for junction temperature ($T_J$) is:

T_J = T_A + P_D × (R_θJC + R_θCS + R_θSA)

VariableDefinitionTypical TO-220 Value
T_AAmbient Temperature (inside your enclosure)40°C
P_DPower Dissipation (Watts)Calculated via I²R
R_θJCJunction-to-Case thermal resistance~1.5 °C/W
R_θCSCase-to-Sink (thermal paste/pad interface)~0.5 °C/W
R_θSASink-to-Ambient (the heatsink itself)Varies by part

When you read a power MOSFET datasheet, the headline "100W Max Dissipation" is only valid at a 25°C case temperature. This is where derating curve interpretation becomes mandatory. The derating curve typically slopes downward at roughly 0.5W/°C. By the time your sensor reads a case temperature of 100°C, that 100W limit has derated to roughly 62.5W. If you ignore this curve and design your heatsink for the 25°C headline number, your silicon will cook. For a deeper dive on calculating these interfaces, CUI Devices' guide on thermal resistance provides excellent visual breakdowns of the R-theta stack.

How Hot is Too Hot? Failure Signatures and Limits

Silicon limits are absolute, but system limits usually fail long before the silicon melts. Standard commercial-grade ICs are rated for 0°C to 70°C, while industrial grades handle -40°C to 85°C. The ESP32-S3 internal sensor is calibrated up to 125°C, but the board's supporting cast will fail first.

Flash Memory Bottleneck: According to Espressif's hardware design guidelines, while the ESP32 silicon might survive 125°C, the external SPI flash memory (often a Winbond W25Q series) typically maxes out at 85°C. If your board ambient hits 90°C, the flash will drop out, causing boot loops or corrupted file systems, even if the CPU core is technically within spec.

When you push components past their thermal limits, you will see specific failure signatures before catastrophic death:

  • Brownouts and Reset Loops: As silicon temperature rises, leakage current spikes exponentially. This causes the internal voltage regulator's Vcore to droop, triggering the ESP32's brownout detector (BOD) and causing endless reboot loops.
  • I2C Lockups and Clock Stretching: Timing margins shrink at high temperatures. Pull-up resistors and parasitic capacitances shift, leading to stuck SDA/SCL lines and frozen I2C buses.
  • Thermal Runaway: In power MOSFETs, the on-resistance ($R_{DS(on)}$) has a positive temperature coefficient. As the part gets hot, resistance increases, which causes more $I^2R$ heating, which increases resistance further. Without a temperature sensor to cut the gate drive, this positive feedback loop ends in a melted package.

Heatsink Selection and Airflow: A Worked Example

Let's apply the math to a real scenario. You are using an ESP32 to drive a 12V, 10A LED array via an IRLZ44N logic-level MOSFET in a TO-220 package.

First, calculate the wattage basis. The $R_{DS(on)}$ is 22mΩ at 25°C, but at 100°C it roughly doubles to 44mΩ.
Power Dissipation ($P_D$) = $I^2 × R_{DS(on)}$ = $100A^2 × 0.044Ω$ = 4.4W.

We want to keep the junction temperature ($T_J$) under 100°C for longevity. The ambient temperature ($T_A$) inside our plastic enclosure is 40°C.
Maximum allowed total thermal resistance = $(100°C - 40°C) / 4.4W$ = 13.6 °C/W.

A bare TO-220 tab has a junction-to-ambient resistance of ~62 °C/W, so a heatsink is mandatory. Using our R-theta stack formula:
Required $R_{θSA}$ = 13.6 (Total) - 1.5 ($R_{θJC}$) - 0.5 ($R_{θCS}$ with Arctic MX-4 paste) = 11.6 °C/W.

The Concrete Pick: The Aavid Thermalloy 577202B00000G is an extruded aluminum heatsink rated at roughly 11.5 °C/W under natural convection. It costs about $1.50 and slides right onto the TO-220 tab.

What Airflow and Enclosure Changes Buy You: Natural convection relies on hot air rising. If you seal the ABS enclosure, $T_A$ will climb from 40°C to 60°C, ruining the math. Cutting 10mm ventilation louvers at the bottom and top of the enclosure creates a chimney effect, locking $T_A$ at 40°C. If you need to shrink the heatsink footprint, adding a Sunon MF40100V2 40mm fan blowing at 1.5 m/s cuts the effective $R_{θSA}$ of that same Aavid heatsink by roughly 50% (down to ~5.7 °C/W), dropping your junction temperature to a highly reliable 69°C.

Decision Tree: Picking Your Sensor and Thermal Strategy

Do not guess your thermal management strategy. Use this decision path to select the right sensor and action based on your specific hardware topology.

Condition / TopologySensor PickMounting MethodMicrocontroller Action
Monitoring ESP32 CPU load only (no external high-power stages) Internal ESP32 Temp Sensor N/A (On-die) Throttle CPU clock to 80MHz if reading > 80°C.
Monitoring external TO-220 MOSFETs or buck converters (e.g., LM2596) DS18B20 (Waterproof probe variant) Kapton tape + thermal epoxy directly to the metal tab Engage PWM fan at 60°C; cut GPIO gate drive at 95°C.
Monitoring Raspberry Pi 5 SoC under heavy compute loads Pi 5 Internal Sensor N/A Install official Pi 5 Active Cooler; let firmware handle the PWM curve.
High-density SMD power stages (no exposed metal tabs) 10k 3950 NTC Thermistor Solder to an exposed thermal via array on the PCB copper pour Read via ADC voltage divider; shed load if ADC drops below 1.2V.

The Default Recommendation: If you are building a custom embedded system with external power switching, terminate your decision here: Buy a DS18B20 waterproof probe. Strip the stainless steel cap if necessary, epoxy it directly to the metal tab of your hottest component using thermally conductive epoxy (like MG Chemicals 832TC), and read it via the Arduino OneWire library. It provides calibrated digital data immune to analog noise from your switching power supplies, and it gives you the exact case temperature needed to feed the R-theta math above. Never leave your power stage unmonitored.