RCdecay calculate temperature from a thermistor
Crosswinds
Posts: 182
in Propeller 1
Hello!
I'm trying to make a program that is measuring temperature from an thermistor.
I need a thermistor because they seem to be the only ones to take temps up to 200celcius.
I don't need 0,1c accuracy.
I have in my datasheet a table that shows resistance vs temperature.
And i have via RCdecay in the kit labs book, page 126 made a experimental circuit to see what times shows up on three different resistance.
Example:
10K = 65500
1K = 6300
68 ohm = 220
Now i don't mind making some kind of look-up table for this, by using the datasheets 5degrees "steps" but i cannot find a good way to calculate what resistance that gives what times.
Now my math is not the best, so this might be the cause!
Does someone have any tips on calculating a given resistance from the table to a RCtime value? Maybe it is not even possible to do that?
I'm trying to make a program that is measuring temperature from an thermistor.
I need a thermistor because they seem to be the only ones to take temps up to 200celcius.
I don't need 0,1c accuracy.
I have in my datasheet a table that shows resistance vs temperature.
And i have via RCdecay in the kit labs book, page 126 made a experimental circuit to see what times shows up on three different resistance.
Example:
10K = 65500
1K = 6300
68 ohm = 220
Now i don't mind making some kind of look-up table for this, by using the datasheets 5degrees "steps" but i cannot find a good way to calculate what resistance that gives what times.
Now my math is not the best, so this might be the cause!
Does someone have any tips on calculating a given resistance from the table to a RCtime value? Maybe it is not even possible to do that?
Comments
https://en.wikipedia.org/wiki/Time_constant
Second, looking at common thermistors, they appear to top out at 250 degrees F. So being a resistive element, thermistors are likely to either burn up or become unstable at 400 degrees F. Maybe you are thinking of thermoCOUPLES, which are good up to 1000 degrees or more. They are made up of two dissimilar metal alloy wires welded together.
Using an RC circuit under these conditions just has too many variables and instabilities to get a good reading - Best to use a good op amp and ADC chip for best results. There are many circuits and software examples to do this.
For example:
10*C = 201660ohms
The decay time to fall below threshold voltage is 0.693 * capacitance * resistance. So for a 1uF cap, it becomes 0.693 * 0.000001 * resistance, which is a decay time of 0.13975038 sec. That number * 80M clocks per second gives 11180030 clocks.
Do that for ALL the temperatures in the table and you get something like this:
Note that I also converted the Deg*C into Deg*F for my use, so the Temperature list there is in Fahrenheit.
Once you have this table, do your RCTime measurement as usual and just figure out which table entries it's between, and interpolate.
Thanks for your help.
Jason, your entry seems to be exactly what i meant! Thank you very much.
This will probably give me the ~5 degree resolution i need since the table from the datasheet is is 5 degree incraments.
Thank you!
Im still missing something.
When i use the Testrcdecay example and the circuit from page 127 PElabs book, and use a 220k resistor, my time returns as around 4418543.
However, calculating as you said: 0.693 * 0.000001 * 220000 gives me 0.15246
Clearly i have misunderstood something
Any ideas?
The circuit you're referring to also uses a 0.01uF cap, whereas my example was for a 1uF. Your multiplier should be 1/100,000,000, not 1/1,000,000. That wouldn't account for all your difference though. If you're using long wires or a breadboard, there may be extra capacitance in your circuit. You might have better luck using a larger cap, as it'll be less sensitive to additional capacitance in the circuit.
The formula you wrote above where you get 0.15246 - That result is in seconds, not cycles. Multiply by 80,000,000 and you get 12,196,800 cycles. Your measured result is off by about a factor of 3, so look over your components and make sure you have all the values correct.
Again thanks for your help.
I did actually adopt my circuit to include the 1uF cap as stated in your example. But i did use the RCdecay instead.
So i made a new program, using RCtime instead.
With that, and a 1K resistor, i get a time output directly from RCtime 3891
But, by the calculation 0,693*0,000001*1000 = 0,000693 and that 0,000693 * 80000000 = 55440
There is still someting wrong that im missing, but cannot figure out what..
Edit: oh, and also, it does react accordingly, larger resistor, longer "time"
For temperature I have a thermocouple for my multimeter from which I get the temperature in C or F, and a small box with a fan and heater that I can put my thermocouple and the temperature measurement boards into. A simple spin program reads and stores the RC time from each board when I press a button and sends it to teraterm. Using that temperature and time data table I can convert RC time to temperature and get very consistent and accurate results.
You could do something like that if you have something that can measure up to the 200*C with reasonable accuracy. The other option would be to use resistors or a potentiometer to measure the RC time for each value in the table to create a temperature vs RC time table. Either way simplifies the calculations.
The output will be exponential, not unlike the output from an RC, and probably more stable to work with.
Probably the best way to go, and the way it is usually done in the commercial building automation systems i have seen.
Thank you for all your help.
I went the ADC way. Seems to work great.