李成笔记网

专注域名、站长SEO知识分享与实战技巧

NTC温度传感器的B值代表什么参数?(附查表法代码)


各种类型的NTC温度传感器

当我们描述一个NTC温度传感器的时候,

往往会写么写:R25 = 10k ±1% B25/50=3950 ±1%

描述释义

关于B值:

  • B值也叫 β 值,代表NTC的材料常数。用于描述热敏电阻的热灵敏度。
  • B值越大,灵敏度越大。电阻-温度曲线越陡
  • 一个NTC的B值并非恒定不变,不同温度下的B值是不一样的
  • 常用NTC的B值(25/50)有:
    3500K, 3380K, 3900K,4050K,4250K, 4485K
  • 由于B值反应的是两个温度点之间的变化规律
    所以有计算公式。

o有了这个公式,就可以不用查表法(NTC分度表)来计算温度了
(话虽如此,但是查表法+插补算法是最准的)

计算举例:
10K NTC B25/100 = 3455,计算其100℃的阻值

随着计算点的增多,这条R-T曲线就越发真实

查表法代码:

Bash
//NTC 分度表 0-100度
const uint16_t TabNtc_100K[TempSize]=
{32510,30958,29499,28120,26813,25570,24384,23252,22168,21132,20140,19155,18259,17431,
16655,15919,15215,14538,13886,13256,12648,12064,11505,10973,10471,10000,9563,9162,
8798,8475,8194,7872,7557,7249,6947,6652,6365,6088,5822,5567,5326,5100,4889,4696,
4522,4366,4193,4029,3874,3727,3588,3455,3329,3208,3091,2979,2870,2765,2662,2561,
2462,2373,2287,2204,2124,2047,1973,1902,1834,1769,1706,1647,1590,1536,1484,1435,
1389,1346,1303,1263,1224,1186,1149,1113,1078,1044,1010,977,945,913,882,853,826,801,
776,753,730,709,688,667,647}; 
Bash
/************************************************************
//NAME:FineTab
//Function:find the resistanca position in the tab
//INPUT: pTmp,TempSize,resistanca of NTC(Kohm X 100)
//return:the position(for example,the value between 36643 and 34458,then return 0,between 312 and 302,then return 109)
*************************************************************/
uint8_t FineTab(uint16_t *a,uint8_t TabLong,uint16_t data)//data in tab is big to samll  
    {  
        uint8_t st,ed,m ;  
        uint8_t i ;  
      
        st = 0 ;  
        ed = TabLong-1 ;  
        i = 0  ;  
      
        if(data >= a[st]) return st ;  
        else if(data <= a[ed]) return ed ;  
      
        while(st < ed)  
        {  
            m = (st+ed)/2 ;
      
            if(data == a[m] ) break ;  
            if(data < am data> a[m+1]) break ;  
              
              
            if(data > a[m])  ed = m ;                      
            else st = m ;     
              
            if(i++ > TabLong) break ;  
        }  
      
        if(st > ed ) return 0 ;   
      
        return m ;  
    } 
Bash
/************************************************************
//NAME:Get_Temp
//Function:Resistance of NTC transform to Temperature
//INPUT: the Resistance(Kohm X 100) of NTC
//return:Temperature X 10
*************************************************************/
int16_t Get_Temp(uint16_t RES)
  {    
    uint8_t Position_tab; 
    uint16_t *pTmp ;
    uint16_t R_NTCAD;
    int16_t Exact_Temp;




    R_NTCAD = RES; 
    pTmp = TabNtc_100K;
    Position_tab = FineTab(pTmp,TempSize,R_NTCAD);




    return Position_tab;
  }
Bash
/************************************************************
//NAME:Get_Temp_NTC
//Function: Get the temperature of NTC channel
//INPUT: AN channel number
//return:Temperature x 10
*************************************************************/
void Get_Temp_NTC(void)             //in system, 10ms 调用一次
{
    //int32_t Value_ADC;
    //int16_t R_NTC,Temp;
    //Value_ADC = ((ADC_filter(channel)&0x3ff)*5)/10.23;
    //R_NTC = (Value_ADC*Rup*100)/(VCC*100-Value_ADC);     //R_NTC is Kohm X 100
    //Temp = Get_Temp(R_NTC);
    //return Temp;
    static uint16_t value_buf[AD_FilterN];
    static uint8_t counter = 0;
    uint8_t j,k;
    uint16_t temp;
    uint32_t Vntc;
    uint16_t NTCRes;
    float temp2;
    
    value_buf[counter] = ADCC_GetSingleConversion(channel_Temperature);
    counter ++;

    if(counter == (AD_FilterN-1))   //数据读取完毕
    {
        counter = 0;
        for (j=0;j<AD_FilterN-1;j++)
            {
              for (k=0;kvalue_buf[k+1])
                {
                  temp = value_buf[k];
                  value_buf[k] = value_buf[k+1];
                  value_buf[k+1] = temp;
                }
              }
            }
    
        temp =  value_buf[(AD_FilterN-1)/2];
        Vntc = VCC*temp/4.095;      //是实际值的1000倍
        if((Vntc< 4900vntc> 1000))  //211010 当电压大于4.9V时表示NTC传感器断路
        {
            NTCRes = (Vntc*Rup)/(VCC*1000-Vntc)*100;        
            TankRealtimeTemperature = Get_Temp(NTCRes)+Adject_NTC;
        }
        else TankRealtimeTemperature = 0;
        NOP();
    }
}

发表评论:

控制面板
您好,欢迎到访网站!
  查看权限
网站分类
最新留言