Posted: Thu Jan 19, 2023 8:37 pm Post subject: Another point of view for ADC and NTC.
Hello!
As you know, NTC is passive element used mainly for temperature measurement.
Unfortunately this element is non-linear.
On the internet we can see a lot of formulas which can be used and implement. But is there any easier method? I think yes (for me of course ).
1. We will consider NTC connected to the bottom of voltage divider:
2. We need to have information, what is NTC's resistance at temperatures.
In my case: NCP18XV103J03RB (10k @ 25 deg. C, B const.=3900K)
3. We're opening Excel and fill it:
Column M: temperature
Column N: NTC's resistance in Ohm
Column O: R1 - constant (so we're creating 10k to 10k voltage divider at 25 deg. C
Q: Voltage to which voltage divider is connected. In my case: 5.2V
R: Voltage divider output. Vout=(Vin/(R1+Rntc))*Rntc
W: Voltage to counts = Vout/4,096*1024 [4,096 - ADC reference voltage, 1024 - resolution]
Because device will not be working below 0 deg. C, we're creating chart (2D, xy) from 0 deg.C.
As you can see, on the X axis we have ADC counts, on the Y axis - temperature.
4. Adding trend line.
We're clicking on the chart (right click) and pressing: add trend line. We're selecting the closest one. In this case: log. We're clicking also: show equation.
Trend line is a dashed one.
5. Adding code.
We received equation: y=-38,07ln(x)+270,19 and we need to implement it.
Code:
Dim ADC_Temp0 asword Dim ADC_Temp0a assingle Dim ADC_Temp0s assingle
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum