 # machine.temperature()

• I've got my doubts about the accuracy of machine.temperature(). I've uploaded

``````import machine; t=(machine.temperature() - 32) / 1.8; print('temp(C)', t)
``````

into a gpy which I let sit for a few hours unpowered on a 20C day. Soon as I power it up it runs the above & reports

``````temp(C) 42.77778
``````

It seems unlikely for the core to heat itself up by 43-20=23C in the fraction of a second it takes to run that line of code?

• @kjm You're right. I looked up the specific mass of silicon as 2.3 g/cm**3, but used 3.3 in the calculation.
But then I thought: lets calculate the thermal resistance of the whole path from silicon to the outside air. The power consumption is known, and the silicon temperature too.
That looked ok. I used an LoPy4, sitting on a PCB in an open box almost flush to the top of the box. At an average current of about 90 mA I had after 45 seconds a silicon temperature of about 52°C at 24°C environmental temp, but then it stuck at 52.66667 °C. By chance, this is 127° Fahrenheit, and 127 is a largest value of a signed byte. Tracing through the code it is indeed an 8 bit section of a 32 register, bits 22-29. So the software if fine, the hardware insufficient.

Conclusion:
a) machine.temperature() is useless. And according to the discussion in the net it is obsolete and not supported any more by espressif.
b) the total thermal resistance is larger than 94°K/W

• @robert-hh If the density of silicon is 2330 kg/m3 then a 3x3x0.4mm wafer is 3.6E-9 x 2.33E+3 = 8.4E-6 kg, so Q=703x8.4E-6x23=.58Ws? But you're right of course, machine.temperature is a BS number, reads in the 40s even after the gpy has been in the fridge(4C).

• @kjm Since it's a lazy Sunday afternoon, I grasped some numbers to see, how much energy is needed to heat up the die by 23°C.
The die size is about 3x3mm and a typical thickness is .4 mm, giving a mass m of 0.012g or 1.2E-5kg. The heat capacity q of Silicon is 703 J/(kg * °K)

The Energy needed to heat up the die by 23*C is:

Q = q * m * ∆t
Q = 703 * 1.2E-5 * 23 = 0.192 Ws

At 100mA/3.3V = .33 Ws/s, this energy is supplied to the chip within about half a second. Without any cooling, the die would heat up in 3 seconds by ~120°C!

Luckily, this estimation ignores that the die is in a package which cools the device and increases the heat capacity. A thermal resistance number I found for a QFN48 package was 64-103°C/W on a standard PCB and 24°C/W for an optimal assembly. I do not know the thermal properties of the Pycom modules, so let's assume it is at the lower end, like 60°C/W, such that in the long run 0.3W will increase the package temperature by about 20°C. Obviously, the die will be somewhat warmer.

Conclusion: Yes, the die in the package can heat up by 23°C within 3 seconds.

• @robert-hh Fair enough Rob, I was just looking for an alternative to an ammeter to verify my deepsleeps are low power. I've had so much grief with deepsleep I thought core temperature might be simple-to-implement validation. There might be some C code that does a better job of reading the core temperature, last post at https://github.com/espressif/esp-idf/issues/732

• @kjm It's a few seconds more, since the device had to start up until it executes these lines, which takes about 3 seconds and more. And the core's thermal capacity is pretty small. So it can heat up very fast.
But anyhow: who cares. The machine.temperature() value is of almost no concern, at least in my opinion.