A more conventional method for collecting temperature using NTC thermistor

This article provides a more conventional method of collecting temperature using an NTC thermistor.

First, an NTC thermistor having a resistance value of Rn=10K and a thermal index of B=3950 is used when the rated temperature Tn=25°C. The method of collecting temperature using a thermistor is very simple, as shown in Figure 1. ADC_Temp enters the ADC6 port of the chip, and uses the AVR 8-bit chip Atmega48. The chip converts the thermistor resistance value by detecting the voltage of the voltage divider circuit, and then obtains the actual temperature value. As shown below:

A more conventional method for collecting temperature using NTC thermistor

Figure 1 Schematic diagram of NTC thermistor temperature acquisition circuit

The resistance and temperature of the thermistor are as follows:

A more conventional method for collecting temperature using NTC thermistor

Programmers can use Excel or other software to obtain the relationship between resistance and temperature by using the above relationship, or directly use the form provided by the seller with the thermistor. In fact, what we need is the relationship between AD value and temperature. From the chip data, it can be understood that the voltage corresponding to the 0-5V AD value is from 0-1023. To make a graph, you can get the following relationship curve:

A more conventional method for collecting temperature using NTC thermistor

Fig. 2 Relationship between temperature and resistanceFig. 3 Temperature and AD value curve

The above outlines an idea. Here is the post program.

First, the temperature and AD values ​​should be posted.

A more conventional method for collecting temperature using NTC thermistor

In the above table, NTC_fdb represents the AD value corresponding to i degrees. PROMEM defines the table data in the flash space.

The actual temperature value can be obtained by the position of the acquired AD value in the table.

Initialization is required before using the ADC.

A more conventional method for collecting temperature using NTC thermistor

The subfunctions that read the AD value are as follows:

A more conventional method for collecting temperature using NTC thermistor

Below is the temperature acquisition from the subroutine.

A more conventional method for collecting temperature using NTC thermistor

So how do you use the above subfunctions?

Very simple. Just use the following statement: temp_value=GetNTCTemperature(adc_read(ADC_TEMP));

Cummins 401-999KW Diesel Generator

Cummins 401-999Kw Diesel Generator,Cummins Shanghai Genset,Cummins Shanghai Power Generator,999Kw Diesel Generator

Shanghai Kosta Electric Co., Ltd. , https://www.ksdpower.com

Posted on