Embedded HandbookApps
All sections › VIII. Electronics around the microcontroller
STM32F103, STM32G431 · level intermediate · 16 min read
Open in the interactive handbook

49д. Heat: power, thermal resistance, die overheating, heatsink, thermal time constant

Everything spent in the previous sections of the series — current through a resistor, recharging a capacitance, the energy of a coil's field — ends up as heat. Here is where that heat goes and how hot the die gets on the way. The three heat paths with numbers for a board and a package, thermal resistance as "Ohm's law for heat", an STM32 die and a SOT-23 transistor from their datasheets, a heatsink and the pad under it, the thermal time constant — why a transistor survives a pulse of amperes but not the same current continuously — and what firmware can see of temperature.

Sources: thermal resistances, currents, on-resistances and gate charges come from datasheets on disk: STM32F103x8/B (DocID13587 Rev 17) and STM32G431 (DS12589 Rev 4) from the Keil packs, AO3400A (Alpha & Omega, Rev 3, Dec 2011) and IRLZ44N (International Rectifier, PD-94831); page numbers are given in the text. The Stefan–Boltzmann constant is CODATA 2022 from scipy.constants (scipy 1.18.1, numpy 2.3.3, image stm-ml:1). Thermal conductivities, heat capacities and air properties are accepted handbook values with no document on disk; where they overlap with section 130б the same values are used. All calculations are in calc49e.py; the transistor's thermal RC network is repeated in ngspice 39 (image stm-lab:1, file heat49e.cir). There are no hardware measurements.

What it is called in the documentation

Original Meaning
power dissipation (PD) dissipated power
thermal conductivity, conduction heat conduction
natural convection, still air natural convection, still air
radiation, emissivity radiation, emissivity
thermal resistance junction-to-ambient (RθJA, ΘJA) die-to-ambient thermal resistance
junction-to-case (RθJC), junction-to-lead (RθJL) die-to-case, die-to-lead
case-to-sink (RθCS), thermal interface material case-to-heatsink, thermal pad or paste
heatsink (sink-to-ambient, RθSA) heatsink (heatsink-to-air)
thermal capacitance, thermal time constant heat capacity, thermal time constant
transient thermal impedance (ZθJA) transient thermal resistance
single pulse, duty cycle single pulse, duty cycle
junction temperature (TJ), TJ max die temperature, its limit

49д.1 Three heat paths

Heat always flows from hot to cold, and it has three paths.

Conduction — inside a solid and in still air: the flow is proportional to the temperature difference, the area and the thermal conductivity k, and inversely proportional to the thickness. A layer's resistance R = t / (k·S) — like a resistor. Copper conducts heat 1300 times better than glass-epoxy and 14829 times better than air (with the k accepted below):

Layer Resistance
FR-4 1.6 mm through, under a 10 × 10 mm pad 53.3 K/W
copper 35 µm along, "per square" 73.3 K/W
trace 1 mm × 35 µm, 10 mm long 733 K/W
air 0.1 mm, area 10 × 10 mm 38.0 K/W
thermal pad 0.25 mm, 1.5 W/(m·K), 10 × 10 mm 1.67 K/W

Accepted k: copper 390, FR-4 through 0.30, air 0.0263 W/(m·K). The main point: a tenth of a millimetre of air under a heatsink is tens of K/W, which is why paste or a pad goes between package and heatsink. And a thin trace hardly conducts heat at all — it leaves through pours and layers (section 130б).

Convection — heated air rises and carries heat away. It is measured by the heat transfer coefficient h, W/(m²·K): P = h·S·ΔT. For still air h is not a constant: it grows with overheating and depends on how the surface is oriented. Calculation by laminar natural convection formulas (Nu = C·Ra^¼, air properties at 40 °C accepted) for a 50 × 50 mm plate:

Overheat Hot side up Down Vertical Radiation, ε = 0.9
10 K 7.3 3.7 5.7 5.7
30 K 9.6 4.8 7.4 6.3
60 K 11 5.6 8.7 7.3

The numbers are h in W/(m²·K). At 30 K the Rayleigh number is 4497, the flow is laminar.

Radiation — every surface radiates ε·σ·T⁴, σ = 5.670374·10⁻⁸ W/(m²·K⁴). For small overheats it is convenient to write it as the same h (last column). For a board with solder mask (ε about 0.9, accepted) radiation gives almost half the transfer: at 30 K — 47 % of 13 W/(m²·K) averaged over both sides. That is why section 130б took h = 10 W/(m²·K) per side for still air — it is an order of magnitude, not a precise number. Shiny metal radiates several times worse: an unpainted aluminium heatsink loses that half.

What follows for a board. A 50 × 50 mm board, if it were all at one temperature, would give heat to air from both sides no better than 14.8 K/W — the limit for any copper on it. And an LQFP48 package through its own 7 × 7 mm top is 1515 K/W: a few percent of the heat leaves through the top, the rest goes through the leads into the board. The package heats the board, the board heats the air.


49д.2 Thermal resistance — Ohm's law for heat

The analogy is direct: overheat is voltage, power is current, thermal resistance is an ordinary resistance:

Tj = Ta + P × RθJA

The unit is K/W (the same as °C/W). The links of the path add in series: die to case (RθJC) or die to lead (RθJL), case to board or heatsink, board or heatsink to air. Parallel paths are like parallel resistors. The inner links are set by the manufacturer, the outer ones by your board. How "board to air" comes out for a given copper and via set is computed in section 130б; this one-line formula was already used in sections 55.4 (regulator) and 204.4 (reliability).

Every body also has a heat capacity C, J/K: heating it by one degree takes C joules. In the electrical analogy it is a capacitor to "ground" — to the air temperature. The die, the package and the board are three capacitors of different size connected by thermal resistances:

Thermal equivalent circuit of the AO3400A transistor in a SOT-23 package on a 1 inch² board: power source P, die with heat capacity 0.410 mJ/K, 13.7 K/W to the package with lead frame 6.03 mJ/K, 49.3 K/W of the drain lead to the board 2.26 J/K and 37.0 K/W from the board to air; on the right the die overheat on a logarithmic time scale at 1.37 W — continuously it rises to 137 K (162 °C) and passes 150 °C after 123 s, as a 0.2 s pulse only to 49.0 K (74 °C) and cools quickly

The circuit resistances in the figure come from the AO3400A datasheet (p. 1): die to lead RθJL 63 K/W, die to air RθJA 100 K/W (typical, steady state); note D on the same page says exactly what is drawn: RθJA is the sum of RθJL and "lead to ambient", so the board gets 37.0 K/W. RθJL is split into two links by dimensions: the drain lead from the copper frame, 0.40 × 0.13 mm and 1 mm long, is 49.3 K/W, the remaining 13.7 is the die and its attachment. Heat capacities come from dimensions and handbook densities: a 1 × 1 × 0.25 mm silicon die, the plastic SOT-23 body, a 1 inch² board of 1.6 mm FR-4 with 70 µm copper (the board the manufacturer used for RθJA — note A on p. 2). The die and frame dimensions are assumed, not taken from a document.


49д.3 The STM32 die: how much and where from

An STM32 datasheet gives RθJA for each package on a JESD51-2 board in still air, and the same formula (F103 — p. 105, G431 — p. 190):

Package F103 G431
LQFP48 7 × 7 mm 55 °C/W 58.4 °C/W
UFQFPN48 7 × 7 mm, exposed pad 32 °C/W 28.6 °C/W

Why packages of the same size differ almost twofold and what remains of that on your own board is covered in 130б.1 and 130б.6.

The die power, per the same datasheet, has two parts: PD = PINT + PI/O. The first is supply current times supply voltage. The second is what the outputs dissipate: Σ(VOL·IOL) + Σ((VDD − VOH)·IOH). The second is forgotten, and it can be larger than the first.

F103 example: 72 MHz, all peripherals, current at most 50 mA (p. 42) — PINT = 0.165 W. Eight outputs sink LEDs at 20 mA each, with VOL up to 1.3 V on the pin (as in example 1 on p. 106) — PI/O = 0.208 W, 1.3 times more than the core. Together 0.373 W. At 85 °C ambient in LQFP48 the die is at 105.5 °C: beyond the 105 °C limit for the suffix 6 version (p. 39). In UFQFPN48 — 96.9 °C. At 85 °C ambient LQFP48 allows no more than 364 mW on the die at all.

G431 example: 170 MHz, all peripherals disabled, maximum at 85 °C — 33 mA (p. 76), 0.109 W; in LQFP48 an overheat of 6.4 °C. A fast microcontroller by itself heats little; what heats it is loaded outputs and neighbours on the board.


49д.4 Transistor and heatsink

SOT-23: AO3400A. The datasheet (p. 1) gives three numbers, and they contain all the physics of this section:

Parameter Typical Maximum
RθJA, pulse up to 10 s 70 °C/W 90 °C/W
RθJA, steady state 100 °C/W 125 °C/W
RθJL, die to lead 63 °C/W 80 °C/W

The manufacturer's board is 1 inch² of 2 oz copper (note A). In 10 seconds the board does not have time to warm up, so the short-term RθJA is lower; the rated 1.4 W at 25 °C is computed from exactly that (note B) — it does not apply to continuous operation. The die limit is 150 °C.

On-resistance rises with heating (section 171.5): per the datasheet row for 10 V on the gate — 26.5 mΩ at 25 °C and 38 mΩ at 125 °C, maximums (p. 2), that is 0.43 % per degree. So die temperature and power depend on each other and are found by iteration: power → temperature → resistance → power.

Example: a 2 A switch with PWM. Load 12 V, 2 A, PWM 20 kHz, 50 % duty, 40 °C ambient. Conduction loss is I²·D·Rds(Tj). Switching loss is ½·U·I·(ton + toff)·f, with the transition time roughly estimated as the charge Qgs + Qgd = 1.3 + 1.8 nC (p. 2) divided by the gate current. Two ways to drive the gate:

Gate Transition Conduction Switching Total Die, RθJA 100 at 125
straight from a pin, 8 mA, 3.3 V (Rds as at 2.5 V — 48 mΩ) 388 ns 115 mW 186 mW 301 mW 70.1 °C 78.0 °C
1 A driver, 10 V (Rds 26.5 mΩ) 3.10 ns 57.8 mW 1.49 mW 59.3 mW 45.9 °C 47.5 °C

From a pin, switching gives 62 % of the loss, and it grows with frequency: the same switch at 1 kHz is 51.6 °C, at 5 kHz 55.5 °C, at 50 kHz 99.2 °C. With a driver the transistor stays almost cold. Why a slow edge is expensive and how a driver works is section 52.3–52.4; here you see what it costs in degrees. Continuously (no PWM, 10 V driver) a SOT-23 on such a board carries about 4.7 A up to 125 °C on the die. A DPAK package conducts heat through its tab straight into board copper, but there is no DPAK transistor datasheet on disk, so no numbers for it here.

TO-220 and a heatsink: IRLZ44N. Datasheet (p. 1): die to case RθJC 1.4 °C/W, case to heatsink through a flat greased surface RθCS 0.50 °C/W, without a heatsink RθJA 62 °C/W. Let the transistor dissipate 3 W at 40 °C ambient. Without a heatsink the die is at 226 °C: beyond the 175 °C limit. To hold 125 °C, the heatsink is left with

RθSA ≤ (125 − 40) / 3 − 1.4 − 0.5 = 26.4 K/W

The layer under the tab matters more than it seems. If the tab is taken as 10 × 15 mm, a 0.25 mm silicone pad with k = 1.5 W/(m·K) is 1.11 K/W instead of 0.50 with grease, and the die reaches 127 °C. Dry metal to metal with an average 0.05 mm air gap is 12.7 K/W, and the die is already at 162 °C. Clamping and paste are part of the thermal design.

What heatsink is needed. A vertical plate with a 40 K overheat sheds (convection plus radiation at ε = 0.9) about 15 W/(m²·K). For 26.4 K/W it takes 25.3 cm² of surface — a plate of about 36 × 36 mm working on both sides. Shiny unpainted aluminium radiates poorly and needs more. The resistance of a ready-made heatsink is taken from its datasheet.

A linear regulator is the same calculation — power (Uin − Uout)·I and a path to air — covered in 55.4, the copper under it in 130б.5.


49д.5 Heat capacity and the thermal time constant

The circuit in figure 49д.2 is an ordinary RC network, just with three time constants: 0.00526 s, 0.317 s and 83.7 s. The first is the die, the second the package with its frame, the third the board. The transient thermal resistance Zθ(t) is the die overheat per watt a time t after switch-on; for a three-node network its solution is a sum of three exponentials:

def zth(t):
    """Переходное тепловое сопротивление кристалл — воздух, К/Вт: перегрев кристалла через t после
    включения 1 Вт."""
    return float(X_INF[0] - np.sum(coef * V[0] * np.exp(lam * t)))
Time Zθ
1 ms 2.23 K/W only the die heats
10 ms 11.8 K/W
100 ms 25.7 K/W the package warms up
1 s 61.0 K/W package warm, board almost cold
10 s 66.9 K/W
100 s 88.7 K/W the board warms up
steady state 100.0 K/W

After 10 s the model gives 66.9 K/W, the datasheet "up to 10 s" value is 70: 4 % less. The heat capacities come from dimensions and are not fitted, so this is a good order-of-magnitude check. The same network in ngspice with the same 1.37 W gives the same overheats within 2 %.

Pulse versus continuous load. A motor draws several times its running current at start; say 6 A for 0.2 s through the same AO3400A at 38 mΩ (hot, 10 V on the gate) — 1.37 W. Continuously that is a die at 162 °C with 25 °C ambient — beyond the limit. But in 0.2 s the board has no time to heat up, and the die reaches only 74 °C (+49.0 K), then cools within a second. The same power would bring the die to 150 °C in 123 s. Hence the rule: a pulse is compared with Zθ at its duration, not with RθJA; datasheets have a transient thermal impedance graph for this (for AO3400A — figure 11 on p. 4, with a family of curves by duty cycle).

PWM. A 0.3 W pulse at 50 % duty is 0.15 W on average and an overheat of 15.0 K. How much the die temperature "ripples" around the average depends on frequency:

PWM frequency Die temperature swing Peak overheat
20 kHz 0.0091 K 15.0 K
100 Hz 1.7 K 15.9 K
1 Hz 14 K 21.8 K

At PWM frequencies the die sees only the average power. With a slow "PWM" of a heater or motor — seconds — the die heats up within each pulse, and the pulse is what must be calculated.

Heater. Every heated object has its own time constant. A 50 g aluminium block is 44.9 J/K; if it has 5 K/W to air (assumed), then τ = 224 s, and at 10 W it settles at +50 K in about 11 min (three τ). A temperature controller that expects a faster response oscillates; how a controller deals with this is section 47 and the thermostat project 196.


49д.6 What firmware sees of this

The internal temperature sensor (section 14.7) measures the die, not the air, and the die is warmer by P·RθJA. G431 at 170 MHz, typical 25.5 mA at 25 °C (p. 76), 0.0841 W: in LQFP48 the sensor shows 4.9 °C above the air, in UFQFPN48 2.4 °C. After power-on the difference grows for minutes — while the board warms up.

The accuracy of the sensor itself is per the datasheet. F103 has no calibration: V25 from 1.34 to 1.52 V at a slope of 4.3 mV/°C (p. 79) — a spread of ±20.9 °C between parts in offset alone, plus ±3.8 °C from slope spread over 55 degrees. G431 stores two factory codes, TS_CAL1 at 30 °C and TS_CAL2 at 110 °C (p. 30); without them the V30 spread gives ±8.6 °C, with them the tolerance of the calibration itself remains — ±5 °C at the point. Enough to watch for overheating, not enough for a thermometer.

HSI frequency drifts with temperature. F103 (p. 56): at 25 °C from −1.1 to +1.8 %, over −40…105 °C from −2 to +2.5 %. G431, HSI16 (p. 103): ±1 % over 0…85 °C, from −2 to +1.5 % over −40…125 °C. The HSITRIM trim (section 6.8) removes the offset at the temperature where it was done; a hot device drifts again. A UART on HSI already loses bytes at 2–3 % error (section 16), so the trim is repeated when the temperature changes, or a crystal is used.

Leakage current grows with temperature. G431 at 100 kHz, where core activity costs almost nothing and the growth is mostly leakage: 0.170 mA at 25 °C and 2.15 mA at 125 °C (typical, p. 76) — 12.6 times, roughly 1.3 times every 10 °C. F103 in Stop mode: 24 µA typical at 25 °C and up to 200 and 370 µA at 85 and 105 °C (p. 45) — 8 and 15 times more. A battery estimate based on "room temperature" current is off several times in a hot enclosure.

Transistor on-resistance grows (0.43 % per degree for AO3400A, 49д.4), an electrolytic capacitor ages twice as fast every 10 °C (the rule from 167.6 and 204.2; there is no capacitor datasheet on disk — the life at your temperature comes from the series datasheet). So the thermal calculation is needed by firmware too: which mode is allowed in a hot enclosure, how much margin the UART frequency has, how long the battery lasts.


49д.7 Pitfalls

A "5 A" switch heats up at two. The rated 5.7 A and 1.4 W of a SOT-23 are at 25 °C and for a pulse up to 10 s. Continuously on a 1 inch² board it is about 4.7 A up to 125 °C, and with the gate driven from an MCU pin at 20 kHz PWM and 2 A the die is already at 70.1 °C.

The motor starts fine, but the transistor burns when it stalls. The 0.2 s start pulse is 74 °C; the same current continuously is 162 °C. Protection must act in time: current limiting or switch-off within seconds, not minutes.

The microcontroller heats up although the core is hardly loaded. Loaded outputs: 8 × 20 mA at VOL 1.3 V is 0.208 W, more than the core. At 85 °C ambient in LQFP48 — 105.5 °C on the die.

The temperature sensor "is off by 5 degrees". It measures the die, not the air: plus P·RθJA (4.9 °C for G431 in LQFP48). An uncalibrated F103 adds ±20.9 °C of offset.

The UART fails once the device has warmed up. HSI has drifted with temperature (for F103 up to +2.5 %), and the trim was done cold.

There is a heatsink, but the transistor is hot. The tab is screwed on dry: air in a 0.05 mm gap is 12.7 K/W against 0.50 with grease.

A battery device in a car in summer is flat within a week. F103 Stop current at 85 °C is up to 200 µA against 24 at 25 °C.


49д.8 Summary

Next: section 49е "Sensor physics: Hall effect, strain and piezo effect, thermo-EMF, photoeffect, capacitive and inductive sensing" — the sixth and last section of the series "Physics for the developer": how field, strain, force, temperature, light, capacitance and nearby metal turn into an electrical signal, what order it has and what follows for the amplifier and the ADC.

Open in the interactive handbook