Electronic – How to find temperature of microcontroller

avrmicrocontrollerpictemperature

In some boards which environment temperature goes up could cause high temperature in micro controller. This will effect on micro and bad situation maybe occurs. For example I have designed a device which used in a box. This box was near a motor and after some load to motor I encountered a high temperature near micro. So, anyone could help me if there is any solution for finding temperature of micro? This micro could be AVR or PIC. If micro could find it's temperature, it could terminate working before any bad damage.

Best Answer

At least some (I don't know about all of them) AVRs have a temperature sensor on-chip, which is connected to the ADC.

The temperature measurement is based on an on-chip temperature sensor that is coupled to a single ended ADC channel. The sensor is a diode that produces a temperature dependent voltage. This voltage is measured with the ADC. The voltage has a linear relationship to temperature and the result has approximately a 1 LSB/°C correlation to temperature.

(from this application note)

A number of PIC devices also have an internal temperature indicator, like the PIC16F15xx and 16F18xx.

This family of devices is equipped with a temperature circuit designed to measure the operating temperature of the silicon die. The circuit’s range of operating temperature falls between -40°C and +85°C. The output is a voltage that is proportional to the device temperature. The output of the temperature indicator is internally connected to the device ADC. The circuit may be used as a temperature threshold detector or a more accurate temperature indicator, depending on the level of calibration performed. A one-point calibration allows the circuit to indicate a temperature closely surrounding that point. A two-point calibration allows the circuit to sense the entire range of temperature more accurately.

(from this datasheet)


Further reading
AVR122: Calibration of the AVR's internal temperature reference, Atmel application note,
Using the AVR internal temperature sensor,
PIC16F15xx datasheet, p.133
AN1333: Use and Calibration of the Internal Temperature Indicator, Microchip application note,