Ever wonder how internal MCU temperature sensors work?Follow article
If you have ever wondered how internal MCU temperature sensors work, then get out your notebook because it’s time to go back to school and learn the circuitry and physics of an internal temperature sensor, and yes, before you ask, this will be on the test.
Temperature Sensor Architecture used on Silicon Labs 8-bit and Precision 32 MCUs:
I can’t speak for internal temp sensors on other MCUs but I know the Silicon Labs’ ones quite well. The temperature sensors on most Silicon Labs 8-bit and 32 bitMCUs use a similar architecture, with only minor differences in implementation from one product to another. A block diagram of this sensor is shown in the figure below. The core of the sensor is a circuit which generates a voltage that is proportional to absolute temperature (VPTAT); this voltage is then buffered and made available as an input to the SAR ADC, which can provide a digital representation of this value to the CPU.
This circuit makes use of the fact that the difference in the base-emitter voltages of two PNP bipolar junction transistors operated at different current densities is proportional to absolute temperature. The base-emitter voltage of a bipolar transistor is given by
VBE = (kT/q)*ln(IC / IS)
Where k is Boltzmann’s constant (1.38 × 10-23 m2 kg s-2 K-1), T is temperature (Kelvin), q is the electron charge (1.602 × 10-19 coulombs), IC is the collector current, and IS is the saturation current. The saturation current is a property of the particular bipolar transistor used, and it tends to vary considerably with normal manufacturing variations, though two bipolar transistors formed adjacent to one another on the same piece of silicon will have saturation currents that match to a high degree of accuracy. The saturation current is also strongly temperature-dependent. However, the difference in VBE voltages between two matching bipolar transistors operating at different current densities (defined as the collector-emitter current divided by the area of the base-emitter junction) is given by
ΔVBE = (kT/q)*[ln(IC1 / IS) – ln(IC2 / IS)]
= (kT/q)*ln(IC1 / IC2)
Thus the ΔVBE term does not include the saturation current; it is proportional to absolute temperature, and it also depends on two constants and on the ratio between two current densities, which can be accurately controlled on a single die.
In the diagram, Q2 has an emitter-base junction area that is n times larger than that of Q1; therefore, its current density is n times smaller than that of Q1, and its base-emitter voltage will be lower. Note that since Q1 and Q2 are PNP bipolar transistors, their base-emitter voltages are actually negative, but for simplicity this document uses the term VBE to refer to the absolute value of the base-emitter voltage. If p-channel mosfets M1 and M2 are the same size, then the core amplifier will ensure that currents I1 and I2 are equal, which will result in a voltage equal to ΔVBEbeing applied across resistor R2, as shown. This circuit actually has two stable operating points. The first is the desired operating point, when I1 and I2 have the same non-zero value, maintained by feedback. The second is a non-desired operating point, when I1 and I2 are both zero. The startup circuit ensures that I1 and I2 are conducting some current, which will then cause the feedback loop to take over and set the bias voltages and currents at the desired operating point.
Since ΔVBEis applied across R2,
I2 = ΔVBE / R2
By scaling the size of M3 and the value of R3, we can effectively amplify ΔVBE:
VPTAT = I2*(M3/M2)*R3
= (ΔVBE / R2)*(M3/M2)*R3
= ΔVBE * (M3/M2)*(R3/R2)
Where M3 and M2 here refer to the W/L ratios of mosfets M3 and M2. If resistors R3 and R2 are made from the same material and are located near each other than any temperature variation in their resistance will cancel. Therefore, VPTAT is directly proportional to ΔVBE, meaning that it is proportional to absolute temperature. The buffer amplifier ensures that this voltage is not disturbed by the switching action of the input stage of the ADC.
While nearly all Silicon Labs 8-bit and EFM 32 bit MCUs use this architecture, the Precision Temperature Sensor included on the C8051F39x/37x MCUs uses a completely different architecture. However, the F39x/37x MCUs also include a second temperature sensor that operates much the same way as the sensor described in this post.
Phew, you can breathe easy now. That was quite the journey and I hoped you learned something! If you have any questions please do not hesitate to contact me or ask them in the comments.