What are thermistors NTC and PTC? For those who have never been exposed to NTC, PTC or have just been exposed to NTC and PTC, they don’t know what NTC and PTC are. Of course, it is relatively simple to understand the concepts of NTC and PTC, but when you search for information and see many confusing professional terms, as well as some hardware, you may be a little dumbfounded, after all, you have never been exposed to them and your mind is full of question marks. For beginners or software engineers who are eager to start a project, it is best to have a preliminary understanding as soon as possible, learn the basic principles, and run the correct data with the code. After all, learning is gradual, and you can’t go deep into its principles in one go.
1. What are thermistors NTC and PTC?
NTC and PTC are both thermistors, which are special resistors that can change resistance with temperature. They can also be said to be a kind of sensor.
NTC and PTC are both types of thermistors, which are temperature-sensitive resistors, where NTC stands for “Negative Temperature Coefficient” meaning its resistance decreases as temperature increases, while PTC stands for “Positive Temperature Coefficient” meaning its resistance increases as temperature rises; essentially, NTC thermistors are commonly used for temperature sensing, while PTC thermistors are often used for circuit protection due to their self-resetting overcurrent capabilities.
The difference is that NTC is a negative temperature coefficient thermistor, and PTC is a positive temperature coefficient thermistor.
Positive temperature coefficient thermistor (PTC): resistance value increases with increasing temperature;
Negative temperature coefficient thermistor (NTC): resistance value decreases with increasing temperature;
II. Applications of NTC and PTC
1. Applications of NTC:
Used for temperature detection, generally temperature measurement type NTC
Used for surge suppression, generally power type NTCNTC Thermistor:
Resistance decreases with increasing temperature.
Widely used for temperature measurement.
Can be used as inrush current limiters in circuits.
2. Applications of PTC include:
In protection circuits, such as over-temperature protection, over-current protection
In start-up circuits
Resistance increases with increasing temperature.
Often used as self-resetting fuses to protect circuits from overcurrent situations.
Can act as a self-regulating heating element in certain applications.
III. B value
B value: material constant, a parameter used to indicate the amplitude of the resistance value of NTC with temperature change within the operating temperature range, which is related to the composition of the material and the sintering process. B value is usually numerical (3435K, 3950K).
The larger the B value, the faster the resistance value decreases with increasing temperature, and the smaller the B value, the opposite is true.
B value is not used in this article, but just for understanding. The temperature can also be calculated by the temperature coefficient B value calculation method, which can also be called the Kelvin temperature algorithm.
4. R25
R25: Resistance value of NTC body at 25℃.
5. Principle Analysis
Take NTC as an example, the general schematic diagram is as follows:
Principle Analysis:
The ADC function is used to collect voltage.
R1 and R2 are series circuits. According to the voltage division formula of series resistors, we have:
R=R1+R2;
From I=U/R=U/(R1+R2), then:
U1=IR1=U(R1/(R1+R2))
U2=IR2=U(R2/(R1+R2))
We use U2=IR2=U(R2/(R1+R2)) and that’s it.
The data collected by ADC is converted into voltage, which is the voltage of U2, so
U(R2/(R1+R2))=ADC/1024*U
Here 1024 is the 10-bit resolution of the ADC of the microcontroller I use, that is, 1024
Here we know that U=3.3v, which is VCC in the figure, the value of R1 is 10k, and R2 is NTC, so its value is not known for the time being. U can be offset.
The final formula is: R2=ADC*R1/1024-ADC
That is, R2=ADC*10000/1024-ADC
After obtaining the resistance value of R2, we can get the temperature by comparing it with the resistance table. The resistance comparison table is generally provided by the merchant after purchase.
Next, let’s go to the code. Here, we use the NTC table lookup method to convert the temperature. You can use this code by just adding your ADC value.
const unsigned int temp_tab[]={
119520,113300,107450,101930,96730,91830,87210,82850,78730,74850,//-30 A -21,
71180,67710,64430,61330,58400,55620,53000,50510,48160,45930,//-20 A -11,
43810,41810,39910,38110,36400,34770,33230,31770,30380, 29050,//-10 A -1,
27800,26600,25460,24380,23350,22370,21440,20550,19700,18900,18130,//0-10,
17390,16690,16020,15390,14780,14200,13640,13110,12610,12120,//11-20,
11660,11220,10790,10390,10000,9630,9270,8930,8610,8300, //21-30, 8000,7710,7430,7170,6920,6670,6440,6220,6000,5800,//31-40, 5600,5410,5230,5050,4880,4720,4570,4420,4270,4130,//49-50, 4000,3870,3750,3630,3510,3400,3300,3190,3090,3000,//51-60, 2910,2820,2730,2650,2570,24 90,2420,2350,2280,2210,//61-70, 2150,2090,2030,1970,1910,1860,1800,1750,1700,1660,//71-80, 1610,1570,1520,1480,1440,1400,1370,1330,1290,1260,//81-90 1230,1190,1160,1130,1100,1070,1050,1020,990,//91-99, };
short ADC; // Get the ADC value of NTC
short NTC_R; // NTC resistance value
#define R1 10000
void get_temp()
{
short temp;
short cnt;
ADC= adc_get_value(ADC_CH_0); // Get the ADC value
printf(“———–ADC:%d \n\n”,ADC);
NTC_R=ADC*R1/(1024-ADC);
cnt = 0;
temp = -30;
do{
if(temp_tab[cnt] < NTC_R){ // Table value is less than the calculated resistance value, exit to get the temperature
break;
}
++temp;
}while(++cnt < sizeof(temp_tab)/4); // The size of the loop table, that is, the number of times
printf(“NTC_R:%d temp:%d \n\n”,NTC_R,temp);
}