First of all, you need to take off an dependence one value from other with calibrated measure unit and your one. Then make a table on dependences.
For creating a curve it is enough to use demo version of Curve Expert Basic (CurveExpert Software). Then select a most appropriate polynomial and use constant factors for you formula.
I'll try to explain:
For example, you are measuring voltage from term-resistance sensor, supplied by voltage. (In case of current supply you will see linear characteristic.)
You connecting you sensor to your device and together with another one thermometer puts the sensors in a oven.
Then you making a table:
X - what did you measured with ADC (code)
Y - what do you measured with real device
View attachment 64358
Than you will try to pick up a most appropriate curve. I must warn you few things:
1) Check correct adc value range - for the last one (2048) - the absolute maximum adc (11 bit for example) reached and the last one is not very accuracy. Better remove it.
2) More accuracy polynomial need more calculations. It takes more time, more flash (and damage your brain if you are assembler programmer :lol
For our purposes it looks like the best is a quadratic fit:
View attachment 64359
Than we pressing the INFO button and see how exactly calculate the real temperature from code:
View attachment 64360
Just using this formula and factors and we can easily convert code values to temperature. Good luck!
Just press INFO button ))))now i need to know what is the basic formula behind this to calculate the a,b,c,d,e.. values..
Just press INFO button ))))
The problem is with the irregular S-curve shape. 4th order polynominal is a good guess anyway, better matching with original can be achieved with a look-up table and piecewise linear interpolation. But you would want more data points in this case. The question is how accurate the measured x y pairs are?
A brief explanation of calculation methods is given here: Polynomial regression - Wikipedia, the free encyclopedia
The formula to the 4th polynomial marked red.Final Result [Linear Regressions/Polynomial Regression (degree=4)]:
Equation : a + b*x + c*x^2 + ...
a = 2.777777777777422E+00
b = -2.483941983941771E+00
c = 1.751942501942551E+00
d = -9.336959336960277E-02
e = 4.079254079254566E-03
Standard Error : 1.042977031291248E-01
Correlation Coefficient : 9.999965176684795E-01
I seems like you are trying to explicitely solve the equation. That's in fact a different method compared to the regression method. What's the point of calculating the coefficients in an uP? Do you need to perform an empirical in system calibration? In this case, a look-up table with piecewise linear interpolation is involving less arithmetic effort.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?