# Why is Raspberry Pi 3B / 3B+'s CPU temperature precision 0.538°C?

While monitoring CPU temperature from `/sys/class/thermal/thermal_zone0/temp`, I noticed that the minimal step is exactly 0.538°C. This is the same on both Pi 3 B and Pi 3 B+, and I suppose that it applies to Pi 3 A+. Why is it this value?

• How are you calculating that exactly? i.e. how do you get from the contents of `/sys/class/thermal/thermal_zone0/temp` to deg C? Are you sure the number is not 0.538?? If so, please edit your question. Mar 15, 2019 at 14:43
• @Seamus The number fetched from that path is exactly 1000*temperature (in Celsius).
– iBug
Mar 15, 2019 at 16:30
• Yes, that's true. But the smallest incremental change I see on my system is `538` (or, `0.538 degC`). I was asking you to confirm the value posted in your question is really `.528` and not `.538`. Mar 15, 2019 at 16:46
• @Seamus That might be a typo. Let me re-check later.
– iBug
Mar 16, 2019 at 2:43
• @Seamus Yeah you're right. It's a typo and indeed the step is 0.538°C.
– iBug
Mar 16, 2019 at 4:30

I'm going to go off-script a bit, and supply an incomplete answer. I am doing this in the hope that it will help "smoke out" a bit of knowledge on the proprietary CPU used in the Raspberry Pi, namely the range and resolution of the built-in temperature sensor. I've searched in vain for these two values for the past 30 minutes; if they're "published", they seem to be well-hidden (either that, or my Google searches are lame :)

The OP's question can be answered with a formula for quantization error:

Q = R/2N

Where:

Q = quantum, or step size

R = sensor range (max temp - min temp)

N = # bits used to represent the temperature reading

Consider for example a temp sensor with a range of 180 degF, where the temp readings are encoded as an 8-bit value:

Q = 180/28 = 0.703 degF

Which simply says that as the real (analog) temperature changes, the digital representation of that temperature will "jump" in increments of 0.703 degF.

If we know the R and N values for the RPi's internal CPU temp sensor, the Q value will be 0.538 degC.

• You're seeking something that's proprietary to Broadcom and unlikely to be published anywhere. Mar 15, 2019 at 17:48
• @Dougie: I figured as much. But hackers are resourceful people, and if they come by the information honestly, then that's all well and good, and as it should be. Mar 15, 2019 at 19:51

The measuring range should extend over the full operating temperature range of the chip, and an 8 bit DAC presents minimal difficulty in fabrication, so is likely to be an 8 bit number. 0.528 * 256 = 135.168 deg. There will be a fair bit of tolerance on individual chips, if it was nominally 0.546875 (7.5% error, quite typical of untrimmed silicon) it would correspond to a range of 140 deg C, or -40 (typical lower limit for commercial semiconductors) to + 100 deg C, a reasonably safe maximum.

So I would suggest that it is the value of 1 LSB of an 8 bit uncalibrated DAC crudely measuring a typical working temperature range for the silicon.