Based on my calculations, the first two lines of that array in thermistortables.h for sensor ID "20" are wrong. Allow me to explain:
The number getting multiplied by the OVERSAMPLENR constant in the first column is the digital value of the ADC (0-1023 since it's a 10-bit ADC). If you want to get back to analog, just multiply by 5/1023 (5 is the 5 V that gr5 mentioned). The number in the second column is the temperature of the PT100 sensor in °C.
So let's do the math for the first row and show why it's wrong. 0 in the first column multiplied by 5/1023 is still 0 analog voltage. Divide by the gain of the INA826. Still 0. So that means the voltage drop across the PT100 would have to be 0, which would require a 0 Ω resistance. Not happening.
So what about row 2? Well, let's just take the independent variable (temperature) and figure out the dependent values (digital value of ADC) for each point. Use R_T=R_0*(1+3.9083E-3*T-5.775E-7*T^2) to find resistance of a PT100 sensor at temperature T (in °C) when T > 0 °C (the formula has another term if you're below zero). Add that resistance in series with the two 2.2k flanking resistors, find the current due to the 5 V source, multiply that current by the PT100 resistance to find the voltage drop across the PT100, multiply by the gain of the INA826 to get analog voltage, and then by 1023/5 to get the digital value. Here's what that looks like done in a spreadsheet (with V_dig rounded off to nearest whole number):
T (°C) R_PT100 (Ω) R_tot (Ω) i (A) V_PT100 (V) V_ana (V) V_dig0 100.000 4500.000 0.001111 0.1111 1.111 2271 100.391 4500.391 0.001111 0.1115 1.115 22810 103.903 4503.903 0.001110 0.1153 1.153 23620 107.794 4507.794 0.001109 0.1196 1.195 24530 111.673 4511.673 0.001108 0.1238 1.237 25340 115.541 4515.541 0.001107 0.1279 1.279 26250 119.397 4519.397 0.001106 0.1321 1.321 27060 123.242 4523.242 0.001105 0.1362 1.362 27970 127.075 4527.075 0.001104 0.1404 1.403 28780 130.897 4530.897 0.001104 0.1444 1.444 29590 134.707 4534.707 0.001103 0.1485 1.485 304100 138.506 4538.506 0.001102 0.1526 1.526 312110 142.293 4542.293 0.001101 0.1566 1.566 320120 146.068 4546.068 0.001100 0.1607 1.606 329130 149.832 4549.832 0.001099 0.1647 1.646 337140 153.584 4553.584 0.001098 0.1686 1.686 345150 157.325 4557.325 0.001097 0.1726 1.726 353160 161.054 4561.054 0.001096 0.1766 1.765 361170 164.772 4564.772 0.001095 0.1805 1.804 369180 168.478 4568.478 0.001094 0.1844 1.844 377190 172.173 4572.173 0.001094 0.1883 1.882 385200 175.856 4575.856 0.001093 0.1922 1.921 393210 179.528 4579.528 0.001092 0.1960 1.960 401220 183.188 4583.188 0.001091 0.1998 1.998 409230 186.836 4586.836 0.001090 0.2037 2.036 417240 190.473 4590.473 0.001089 0.2075 2.074 424250 194.098 4594.098 0.001088 0.2112 2.112 432260 197.712 4597.712 0.001087 0.2150 2.150 440270 201.314 4601.314 0.001087 0.2188 2.187 447280 204.905 4604.905 0.001086 0.2225 2.224 455290 208.484 4608.484 0.001085 0.2262 2.262 463300 212.052 4612.052 0.001084 0.2299 2.298 470310 215.608 4615.608 0.001083 0.2336 2.335 478320 219.152 4619.152 0.001082 0.2372 2.372 485330 222.685 4622.685 0.001082 0.2409 2.408 493340 226.206 4626.206 0.001081 0.2445 2.444 500350 229.716 4629.716 0.001080 0.2481 2.480 507360 233.214 4633.214 0.001079 0.2517 2.516 515370 236.701 4636.701 0.001078 0.2552 2.552 522380 240.176 4640.176 0.001078 0.2588 2.588 529390 243.640 4643.640 0.001077 0.2623 2.623 537400 247.092 4647.092 0.001076 0.2659 2.658 544500 280.978 4680.978 0.001068 0.3001 3.001 614600 313.708 4713.708 0.001061 0.3328 3.327 681700 345.284 4745.284 0.001054 0.3638 3.638 744800 375.704 4775.704 0.001047 0.3933 3.933 805900 404.970 4804.970 0.001041 0.4214 4.213 8621000 433.080 4833.080 0.001035 0.4480 4.480 9171100 460.036 4860.036 0.001029 0.4733 4.732 968
Starting at data row 3, you'll notice the V_dig values start matching those from thermistortables.h that get multiplied by OVERSAMPLENR.
But having those first two rows incorrect doesn't seem like it would affect how my measured voltage of 1.217 V at ambient gets interpreted, since that would fall between rows 4 and 5, which are correct.
Regarding OVERSAMPLENR, it's a way of time-averaging temperature readings from the ADC. With OVERSAMPLENR set to 16, it takes 16 successive digital measurements and adds them together. To time-average that, you could either divide by 16 to get a number back in the 0-1023 range or just leave it as the sum of all 16 values and instead multiply the digital value column of the lookup table by 16. The thermistortables.h file does the latter.
Edited by Guest
Recommended Posts
Top Posters In This Topic
39
23
11
Popular Days
Jun 21
7
Jun 10
6
Jun 5
6
Jun 16
6
Top Posters In This Topic
dbotos 39 posts
gr5 23 posts
Torgeir 11 posts
Popular Days
Jun 21 2016
7 posts
Jun 10 2016
6 posts
Jun 5 2016
6 posts
Jun 16 2016
6 posts
Posted Images
gr5 2,230
Oh and probably you want to ignore that 16X multiplier and stick with the table values that go roughly from 0 to 1023.
Link to post
Share on other sites