Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

how to convert the non linear voltage in to linear volatge??

Status
Not open for further replies.

skarthikshines

Member level 5
Joined
Feb 21, 2011
Messages
81
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
2,060
hi all?

am using msp430 controller.. i want to convert the non linear voltgae in to linear voltage by means of sofware..(it already did by means of hard ware)..please suggest me any good idea??
 

What is a linear voltage?
Do you mean regulated?
 

no.. actually .. i may get the input voltage from the inductive sensors .. it will be in a non linear format based on the target distance which was placed in front of the inductive sensor.. so i should convert this voltage to linear format ..like for 1mm target distance.. the voltage should be 0.5 volt, for 2mm the voltage should be1.5 volt like this
 

I have no idea of what linear/nonlinear voltages mean, neither.
 

you mean , AC to DC conversion?
 

Three standard methods:
- if the non-linear behavior follows a particular mathematical function, e.g. squareroot, apply it in the linearization
- use a polynominal as approximation
- use a look-up table with linear iinterpolation between the table points
 

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
1.png
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:
2.png
Than we pressing the INFO button and see how exactly calculate the real temperature from code:
3.png
Just using this formula and factors and we can easily convert code values to temperature. Good luck!
 
  • Like
Reactions: FvM

    FvM

    Points: 2
    Helpful Answer Positive Rating
If you need analog output, then you may use DAC (external or internal - i think some MSP430 have those) or filtered PWM to output the voltage.
 

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!

hi Easyrider83
as per your suggestion by the help of curve expert professional i did like this way
my
x y

1.0840000000000001E+00 5.0000000000000000E-01
1.3830000000000000E+00 1.5625000000000000E+00
1.6719999999999999E+00 2.6250000000000000E+00
1.9299999999999999E+00 3.6875000000000000E+00
2.1499999999999999E+00 4.7500000000000000E+00
2.3319999999999999E+00 5.8125000000000000E+00
2.4740000000000002E+00 6.8750000000000000E+00
2.5560000000000000E+00 7.9375000000000000E+00
2.6709999999999998E+00 9.0000000000000000E+00
and i run the 4th order polynoimal regression and i got the equation for y =a + b*x + c*x^2 + d*x^3+e*x^4 where
a = 1.716236806392966E+00
b = -1.046324519143091E+01
c = 1.442338999281995E+01
d = -6.592572556925052E+00
e = 1.139785212532146E+00
now i need to know what is the basic formula behind this to calculate the a,b,c,d,e.. values..
 

You mean, how the polynominal regressions works mathematically? It's based on minimizing the quadratic error between original data and polynominal fit. Minimum quadratic error is identical with zero of first derivative d(y1-y2)²/dx = 0. Put in the data points and you get a system of linear equations to be solved for a .. e. Besides the said Curve Expert software, also MS Excel calculates polynominal fits.

P.S.: The shown coefficient set suggests, that the fit isn't very good, because the higher oder coefficients don't converge against 0.
 

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?
 

Attachments

  • Fit.zip
    2.2 KB · Views: 98

Just press INFO button ))))

i downloaded curve expert proffesional 15.0 .. in this software i did t find INFO button.. where it will be there??

---------- Post added at 10:54 ---------- Previous post was at 10:33 ----------

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?

i found your attachment it s very useful for me and you formed the y equation as below
y =(1.139*x^4)-(6.592*x^3)+(14.42*x^2)-(10.46*x)+1.716.. here i need to know the basic steps to formulate the above equation for the given x and y variable inputs..please help me
 

A brief explanation of calculation methods is given here: Polynomial regression - Wikipedia, the free encyclopedia

i found that coefficient values by the follwing formula in excel
Equation: y = (c3* x^4)+(c3 * x^3) + (c2 * x^2) + (c1 * x^1) + b
C4: =INDEX(LINEST(y,x^{1,2,3,4}),1)
C3: =INDEX(LINEST(y,x^{1,2,3,4}),1,2)
C2: =INDEX(LINEST(y,x^{1,2,3,4}),1,3)
C1: =INDEX(LINEST(y,x^{1,2,3,4}),1,4)
b: =INDEX(LINEST(y,x^{1,2,3,4}),1,5).. i need to know how to bring INDEX(LINEST(y,x^{1,2,3,4}),1) this function in c programming for my msp430
 

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.
 

Calculate results will be shown in message window (version 15)
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
The formula to the 4th polynomial marked red.
 

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.

actually i am trying to calibrate my system in my case x variable may change slightly based on the hardware tolerance error but the y variable is a output and it should be constant.. so i am trying to generate the own polynomial for varying x input..if i able to find the co-efficient of polynomial means. i can generate the constant y output..hence that's y am asking the method to find co efficient of the generated polynomial??
and i don't have any knowledge about a look-up table with piecewise linear interpolation??if u say about this with an example means it will be more help full for me..
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top