Skip to content

Automatically compute the temperature lookup table corresponding to a specific thermistor.

License

Notifications You must be signed in to change notification settings

RICCIARDI-Adrien/Thermistor_Calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Thermistor Calculator

Building

Use make to build the program.

Usage

Simply execute thermistor-calculator -h to display program full help.
Here is what the help looks like :

ar@ar-i7:~/Documents/Thermistor_Calculator$ ./thermistor-calculator -h
+-------------------------------------------------+
| Thermistor calculator (C) 2018 Adrien RICCIARDI |
+-------------------------------------------------+
Compute the ADC lookup table (containing Celsius temperatures) corresponding to a specific thermistor voltage, taking into account the voltage divider the thermistor is connected to.
For now, only Negative Temperature Coefficient thermistors are supported.

Here are the two voltage divider circuits that are supported by the program :

Circuit variant 1        Circuit variant 2
-----------------        -----------------

      Vcc                      Vcc
       |                        |
      +-+                      +-+
      | | Resistor             | | NTC
      +-+                      +-+
       |                        |
       |--- Vout                |--- Vout
       |                        |
      +-+                      +-+
      | | NTC                  | | Resistor
      +-+                      +-+
       |                        |
      GND                      GND

Usage : ./thermistor-calculator [-c circuit] [-B beta] [-R R25] [-r resistor] [-v Vcc] [-a resolution] [-h]
  -c : circuit variant, it can be 1 or 2 (see above for circuit variants description). Default value is 1.
  -B : thermistor Beta coefficient (kelvin), this is the B25/100 value of the datasheet. Default value is 4300.
  -R : thermistor resistance at 25 Celsius degrees (ohm), floating numbers are allowed. Default value is 10000.
  -r : voltage divider bridge other resistance value (ohm), floating numbers are allowed. Default value is 10000.
  -v : Vcc voltage (volt), floating numbers are allowed. Default value is 3.3.
  -a : ADC resolution (or how many values you want in the lookup table). Default value is 256.
  -h : display this help.

Example

This is the program output for the following circuit characteristics :

  • Circuit variant : 2
  • Thermistor beta : 3988
  • Thermistor resistance at 25 Celsius degrees : 10K
  • Voltage divider other resistance : 10K
  • Vcc : 3.3V
  • ADC resolution : 8 bits
ar@ar-i7:~/Documents/Thermistor_Calculator$ ./thermistor-calculator -c 2 -B 3988 -R 10000 -r 10000 -v 3.3 -a 256
+-------------------------------------------------+
| Thermistor calculator (C) 2018 Adrien RICCIARDI |
+-------------------------------------------------+
ADC value	Thermistor voltage (V)	Thermistor resistance (ohm)	Thermistor temperature (Celsius)
0		0.000000		inf			-273.150000
1		0.012941		2540000.000000			-62.291438
2		0.025882		1265000.000000			-54.222305
3		0.038824		840000.000000			-49.188530
4		0.051765		627500.000000			-45.459139
5		0.064706		500000.000000			-42.467632
6		0.077647		415000.000000			-39.954231
7		0.090588		354285.714286			-37.777228
8		0.103529		308750.000000			-35.850469
9		0.116471		273333.333333			-34.117511
10		0.129412		245000.000000			-32.539288
11		0.142353		221818.181818			-31.087597
12		0.155294		202500.000000			-29.741386
13		0.168235		186153.846154			-28.484510
14		0.181176		172142.857143			-27.304304
15		0.194118		160000.000000			-26.190645
16		0.207059		149375.000000			-25.135305
17		0.220000		140000.000000			-24.131507
18		0.232941		131666.666667			-23.173599
19		0.245882		124210.526316			-22.256812
20		0.258824		117500.000000			-21.377090
21		0.271765		111428.571429			-20.530949
22		0.284706		105909.090909			-19.715375
23		0.297647		100869.565217			-18.927741
24		0.310588		96250.000000			-18.165746
25		0.323529		92000.000000			-17.427357
26		0.336471		88076.923077			-16.710775
27		0.349412		84444.444444			-16.014395
28		0.362353		81071.428571			-15.336783
29		0.375294		77931.034483			-14.676648
30		0.388235		75000.000000			-14.032827
31		0.401176		72258.064516			-13.404266
32		0.414118		69687.500000			-12.790006
33		0.427059		67272.727273			-12.189177
34		0.440000		65000.000000			-11.600980
35		0.452941		62857.142857			-11.024683
36		0.465882		60833.333333			-10.459616
37		0.478824		58918.918919			-9.905159
38		0.491765		57105.263158			-9.360739
39		0.504706		55384.615385			-8.825829
40		0.517647		53750.000000			-8.299936
41		0.530588		52195.121951			-7.782604
42		0.543529		50714.285714			-7.273409
43		0.556471		49302.325581			-6.771953
44		0.569412		47954.545455			-6.277867
45		0.582353		46666.666667			-5.790802
46		0.595294		45434.782609			-5.310434
47		0.608235		44255.319149			-4.836457
48		0.621176		43125.000000			-4.368584
49		0.634118		42040.816327			-3.906543
50		0.647059		41000.000000			-3.450080
51		0.660000		40000.000000			-2.998952
52		0.672941		39038.461538			-2.552932
53		0.685882		38113.207547			-2.111804
54		0.698824		37222.222222			-1.675362
55		0.711765		36363.636364			-1.243413
56		0.724706		35535.714286			-0.815771
57		0.737647		34736.842105			-0.392260
58		0.750588		33965.517241			0.027287
59		0.763529		33220.338983			0.443029
60		0.776471		32500.000000			0.855120
61		0.789412		31803.278689			1.263705
62		0.802353		31129.032258			1.668923
63		0.815294		30476.190476			2.070908
64		0.828235		29843.750000			2.469787
65		0.841176		29230.769231			2.865683
66		0.854118		28636.363636			3.258714
67		0.867059		28059.701493			3.648993
68		0.880000		27500.000000			4.036628
69		0.892941		26956.521739			4.421724
70		0.905882		26428.571429			4.804382
71		0.918824		25915.492958			5.184699
72		0.931765		25416.666667			5.562769
73		0.944706		24931.506849			5.938683
74		0.957647		24459.459459			6.312528
75		0.970588		24000.000000			6.684390
76		0.983529		23552.631579			7.054349
77		0.996471		23116.883117			7.422487
78		1.009412		22692.307692			7.788879
79		1.022353		22278.481013			8.153602
80		1.035294		21875.000000			8.516726
81		1.048235		21481.481481			8.878325
82		1.061176		21097.560976			9.238465
83		1.074118		20722.891566			9.597214
84		1.087059		20357.142857			9.954638
85		1.100000		20000.000000			10.310800
86		1.112941		19651.162791			10.665763
87		1.125882		19310.344828			11.019586
88		1.138824		18977.272727			11.372330
89		1.151765		18651.685393			11.724053
90		1.164706		18333.333333			12.074811
91		1.177647		18021.978022			12.424660
92		1.190588		17717.391304			12.773655
93		1.203529		17419.354839			13.121850
94		1.216471		17127.659574			13.469296
95		1.229412		16842.105263			13.816047
96		1.242353		16562.500000			14.162152
97		1.255294		16288.659794			14.507663
98		1.268235		16020.408163			14.852628
99		1.281176		15757.575758			15.197096
100		1.294118		15500.000000			15.541116
101		1.307059		15247.524752			15.884735
102		1.320000		15000.000000			16.227999
103		1.332941		14757.281553			16.570956
104		1.345882		14519.230769			16.913651
105		1.358824		14285.714286			17.256130
106		1.371765		14056.603774			17.598438
107		1.384706		13831.775701			17.940620
108		1.397647		13611.111111			18.282721
109		1.410588		13394.495413			18.624784
110		1.423529		13181.818182			18.966853
111		1.436471		12972.972973			19.308974
112		1.449412		12767.857143			19.651188
113		1.462353		12566.371681			19.993541
114		1.475294		12368.421053			20.336074
115		1.488235		12173.913043			20.678832
116		1.501176		11982.758621			21.021858
117		1.514118		11794.871795			21.365195
118		1.527059		11610.169492			21.708886
119		1.540000		11428.571429			22.052975
120		1.552941		11250.000000			22.397506
121		1.565882		11074.380165			22.742522
122		1.578824		10901.639344			23.088067
123		1.591765		10731.707317			23.434185
124		1.604706		10564.516129			23.780920
125		1.617647		10400.000000			24.128317
126		1.630588		10238.095238			24.476421
127		1.643529		10078.740157			24.825276
128		1.656471		9921.875000			25.174929
129		1.669412		9767.441860			25.525424
130		1.682353		9615.384615			25.876810
131		1.695294		9465.648855			26.229131
132		1.708235		9318.181818			26.582436
133		1.721176		9172.932331			26.936773
134		1.734118		9029.850746			27.292189
135		1.747059		8888.888889			27.648734
136		1.760000		8750.000000			28.006459
137		1.772941		8613.138686			28.365412
138		1.785882		8478.260870			28.725646
139		1.798824		8345.323741			29.087212
140		1.811765		8214.285714			29.450163
141		1.824706		8085.106383			29.814553
142		1.837647		7957.746479			30.180437
143		1.850588		7832.167832			30.547869
144		1.863529		7708.333333			30.916908
145		1.876471		7586.206897			31.287610
146		1.889412		7465.753425			31.660034
147		1.902353		7346.938776			32.034240
148		1.915294		7229.729730			32.410291
149		1.928235		7114.093960			32.788248
150		1.941176		7000.000000			33.168175
151		1.954118		6887.417219			33.550138
152		1.967059		6776.315789			33.934204
153		1.980000		6666.666667			34.320442
154		1.992941		6558.441558			34.708922
155		2.005882		6451.612903			35.099716
156		2.018824		6346.153846			35.492898
157		2.031765		6242.038217			35.888543
158		2.044706		6139.240506			36.286730
159		2.057647		6037.735849			36.687539
160		2.070588		5937.500000			37.091052
161		2.083529		5838.509317			37.497353
162		2.096471		5740.740741			37.906530
163		2.109412		5644.171779			38.318672
164		2.122353		5548.780488			38.733871
165		2.135294		5454.545455			39.152223
166		2.148235		5361.445783			39.573826
167		2.161176		5269.461078			39.998781
168		2.174118		5178.571429			40.427192
169		2.187059		5088.757396			40.859168
170		2.200000		5000.000000			41.294820
171		2.212941		4912.280702			41.734264
172		2.225882		4825.581395			42.177618
173		2.238824		4739.884393			42.625008
174		2.251765		4655.172414			43.076560
175		2.264706		4571.428571			43.532408
176		2.277647		4488.636364			43.992690
177		2.290588		4406.779661			44.457548
178		2.303529		4325.842697			44.927132
179		2.316471		4245.810056			45.401595
180		2.329412		4166.666667			45.881098
181		2.342353		4088.397790			46.365808
182		2.355294		4010.989011			46.855898
183		2.368235		3934.426230			47.351551
184		2.381176		3858.695652			47.852955
185		2.394118		3783.783784			48.360306
186		2.407059		3709.677419			48.873812
187		2.420000		3636.363636			49.393685
188		2.432941		3563.829787			49.920153
189		2.445882		3492.063492			50.453449
190		2.458824		3421.052632			50.993820
191		2.471765		3350.785340			51.541524
192		2.484706		3281.250000			52.096831
193		2.497647		3212.435233			52.660026
194		2.510588		3144.329897			53.231408
195		2.523529		3076.923077			53.811290
196		2.536471		3010.204082			54.400003
197		2.549412		2944.162437			54.997894
198		2.562353		2878.787879			55.605331
199		2.575294		2814.070352			56.222701
200		2.588235		2750.000000			56.850413
201		2.601176		2686.567164			57.488900
202		2.614118		2623.762376			58.138621
203		2.627059		2561.576355			58.800062
204		2.640000		2500.000000			59.473737
205		2.652941		2439.024390			60.160194
206		2.665882		2378.640777			60.860017
207		2.678824		2318.840580			61.573826
208		2.691765		2259.615385			62.302283
209		2.704706		2200.956938			63.046095
210		2.717647		2142.857143			63.806019
211		2.730588		2085.308057			64.582864
212		2.743529		2028.301887			65.377501
213		2.756471		1971.830986			66.190864
214		2.769412		1915.887850			67.023958
215		2.782353		1860.465116			67.877868
216		2.795294		1805.555556			68.753767
217		2.808235		1751.152074			69.652925
218		2.821176		1697.247706			70.576717
219		2.834118		1643.835616			71.526642
220		2.847059		1590.909091			72.504331
221		2.860000		1538.461538			73.511568
222		2.872941		1486.486486			74.550304
223		2.885882		1434.977578			75.622685
224		2.898824		1383.928571			76.731074
225		2.911765		1333.333333			77.878079
226		2.924706		1283.185841			79.066595
227		2.937647		1233.480176			80.299840
228		2.950588		1184.210526			81.581406
229		2.963529		1135.371179			82.915322
230		2.976471		1086.956522			84.306122
231		2.989412		1038.961039			85.758935
232		3.002353		991.379310			87.279589
233		3.015294		944.206009			88.874746
234		3.028235		897.435897			90.552065
235		3.041176		851.063830			92.320404
236		3.054118		805.084746			94.190087
237		3.067059		759.493671			96.173236
238		3.080000		714.285714			98.284206
239		3.092941		669.456067			100.540162
240		3.105882		625.000000			102.961849
241		3.118824		580.912863			105.574642
242		3.131765		537.190083			108.410006
243		3.144706		493.827160			111.507574
244		3.157647		450.819672			114.918184
245		3.170588		408.163265			118.708446
246		3.183529		365.853659			122.967863
247		3.196471		323.886640			127.820423
248		3.209412		282.258065			133.444459
249		3.222353		240.963855			140.108934
250		3.235294		200.000000			148.245455
251		3.248235		159.362550			158.607848
252		3.261176		119.047619			172.685625
253		3.274118		79.051383			194.071000
254		3.287059		39.370079			235.621896
255		3.300000		0.000000			-273.150000

ADC lookup table :
-273,  -62,  -54,  -49,  -45,  -42,  -40,  -38,  -36,  -34,  -33,  -31,  -30,  -28,  -27,  -26, 
 -25,  -24,  -23,  -22,  -21,  -21,  -20,  -19,  -18,  -17,  -17,  -16,  -15,  -15,  -14,  -13, 
 -13,  -12,  -12,  -11,  -10,  -10,   -9,   -9,   -8,   -8,   -7,   -7,   -6,   -6,   -5,   -5, 
  -4,   -4,   -3,   -3,   -3,   -2,   -2,   -1,   -1,    0,    0,    0,    1,    1,    2,    2, 
   2,    3,    3,    4,    4,    4,    5,    5,    6,    6,    6,    7,    7,    7,    8,    8, 
   9,    9,    9,   10,   10,   10,   11,   11,   11,   12,   12,   12,   13,   13,   13,   14, 
  14,   15,   15,   15,   16,   16,   16,   17,   17,   17,   18,   18,   18,   19,   19,   19, 
  20,   20,   20,   21,   21,   21,   22,   22,   22,   23,   23,   23,   24,   24,   24,   25, 
  25,   26,   26,   26,   27,   27,   27,   28,   28,   28,   29,   29,   29,   30,   30,   31, 
  31,   31,   32,   32,   32,   33,   33,   34,   34,   34,   35,   35,   35,   36,   36,   37, 
  37,   37,   38,   38,   39,   39,   40,   40,   40,   41,   41,   42,   42,   43,   43,   44, 
  44,   44,   45,   45,   46,   46,   47,   47,   48,   48,   49,   49,   50,   50,   51,   52, 
  52,   53,   53,   54,   54,   55,   56,   56,   57,   57,   58,   59,   59,   60,   61,   62, 
  62,   63,   64,   65,   65,   66,   67,   68,   69,   70,   71,   72,   73,   74,   75,   76, 
  77,   78,   79,   80,   82,   83,   84,   86,   87,   89,   91,   92,   94,   96,   98,  101, 
 103,  106,  108,  112,  115,  119,  123,  128,  133,  140,  148,  159,  173,  194,  236, -273,

About

Automatically compute the temperature lookup table corresponding to a specific thermistor.

Topics

Resources

License

Stars

Watchers

Forks