Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

Fast Thermistor Calculator

odissey1
Level 9
First comment on KBA 1000 replies posted 750 replies posted
Level 9

Hi All,

   

Attached is my Thermistor Calculator component ("myThermistor"). It calculates thermistor temperature from the resistance, similar to the Creator's stock Thermistor component. Calculated temperature returned as float-precision value with accuracy approx. 0.001 degC. Calculation speed is about 14-15x times faster than stock Thermistor component (formula-based) taking about 1100 CPU cycles.

     

The component was developed for fast TEC control, where accuracy, speed and wide temperature range were important. Attached archive contains the workspace bundle of the demo project, datasheet, screenshots and reference materials. Tested on PSoC5LP.

      

regards,  

odissey1

P.S. Updated link to SRS Thermistor Calculator:

https://www.thinksrs.com/downloads/programs/therm%20calc/ntccalibrator/ntccalculator.html

myThermistor demo.PNG

Parameters.PNG

SRS Thermistor Calculator.png

10 Replies
Praveen
Community Manager
Community Manager 250 sign-ins 100 sign-ins 50 replies posted
Community Manager

 Thanks for sharing this with the community.

   

 

   

Praveen

Cheers
Praveen
0 Likes
urchc_1533771
Level 5
5 likes given First like received First like given
Level 5

I opened this design and not see any connections to thermistor. How it`s work ?

   

Usually exist thermistor and normal resistor and ADC that calculate difference between ... 

0 Likes
Bob_Marlowe
Level 10
First like given 50 questions asked 10 questions asked
Level 10

It is a pure software component that offers different ways to calculate the temperature from ADC values. See datasheet.

   

 

   

Bob

0 Likes
odissey1
Level 9
First comment on KBA 1000 replies posted 750 replies posted
Level 9
        chaplin.u, the Fast Thermistor Calculator is a replacement for Cypress stock Thermistor Calculator component and should be used same way the standard Thermistor Calculator is used. This component optimizes calculation speed (approx. 15x faster) by using log function approximation. Use Cypress standard Thermistor demo project and add/replace Thermistor Calculator.   
0 Likes
urchc_1533771
Level 5
5 likes given First like received First like given
Level 5

Thanks, I tried it and it work fine. Just one problem. Instead of it`s "pure software component"  when I change my device to PROC Components tab is not visible and receive error :Component is not supported by this device...

0 Likes
odissey1
Level 9
First comment on KBA 1000 replies posted 750 replies posted
Level 9

I will take a look what is going on. But don't hold your breath...

0 Likes
odissey1
Level 9
First comment on KBA 1000 replies posted 750 replies posted
Level 9

Here is an answer. The custom component creation is not supported for PRoC family of devices. (?!)

The FastThermistorCalculator is indeed is just a piece of C code with component symbol attached to it. All you need is to copy *.h and *.c files into your project and set parameters in code like that.

Replace in *.h:

/***************************************

*           API Constants

***************************************/

#define `$INSTANCE_NAME`_REF_RESISTOR   ((float) `$ReferenceResistor`) //Reference resistor value [oHm]

#define `$INSTANCE_NAME`_K2C    (273.15f)                       //conversion degK to degC, deg: Tc = Tk - K2C

   

#define `$INSTANCE_NAME`_THA    ((float) `$SteinhartHart_THA`)  //Steinhart-Hart coeff A  

#define `$INSTANCE_NAME`_THB    ((float) `$SteinhartHart_THB`)  //Steinhart-Hart coeff B

#define `$INSTANCE_NAME`_THC    ((float) `$SteinhartHart_THC`)  //Steinhart-Hart coeff C

with something like (use your parameters!):

/***************************************

*           API Constants

***************************************/

#define `$INSTANCE_NAME`_REF_RESISTOR   ((float) 10000.0) //Reference resistor value [oHm]

#define `$INSTANCE_NAME`_K2C    (273.15f)                       //conversion degK to degC, deg: Tc = Tk - K2C

   

#define `$INSTANCE_NAME`_THA    ((float) 0.0011259)  //Steinhart-Hart coeff A  

#define `$INSTANCE_NAME`_THB    ((float) 0.0002346498)  //Steinhart-Hart coeff B

#define `$INSTANCE_NAME`_THC    ((float) 8.564001E-08)  //Steinhart-Hart coeff C

0 Likes
urchc_1533771
Level 5
5 likes given First like received First like given
Level 5

Thanks ! I found second way. Just changed to PSOC device, compiled, copy generated code to my project and return to PROC.

Thanks for your code again !!!

0 Likes
urchc_1533771
Level 5
5 likes given First like received First like given
Level 5

Hi !

What a range of temperatures this calculator ? In datasheet not exist this information.

0 Likes
odissey1
Level 9
First comment on KBA 1000 replies posted 750 replies posted
Level 9

Good question. The accuracy was tested using a set of A,B,C coefficients

for a 10k thermistor, which I typically use (TS-91), using the test demo

project provided.  The Datasheet clearly states that accuracy comparison

was done in Range 0-50C (from Rmin=3.602 k to Rmax=33.660 k)

You can run demo using your set of Steinhart coefficients to check the

accuracy of approximation in the range of interest.

0 Likes