Author

Topic: How to scale an analog input data (Read 77470 times)


support
Global Moderator
Posts: 3081


How to scale an analog input data
« on: February 15, 2004, 10:03:23 PM »


The builtin analog ports on all the Mseries PLC return data in the range of 0 to 4092 which corresponds to the full range of voltage input presented at the analog pin. However, very often a user needs a formula to translate this numeric data into units meaningful to the process (e.g. degree C or F, psi etc). To do so, you need to know at least two reference points of how the native unit map to the PLC's ADC reading.
Reference Point ADC Reading =========== ========== x1 a1 x2 a2
Hence, for any reading A = ADC(1), the corresponding X is derived from: X  x1 A  a1  =  x2  x1 a2  a1
==> X = (x2  x1)*(A  a1)/(a2  a1) + x1
Note that since x1,x2,a1, and a2 are all constants the actual formula is much simpler then it appears above.
E.g. Temperature measurement ========================
Temp ADC(n) 30 200 100 3000
So for any ADC readings A, the temperature is:
X = 70*(A  200)/2800 + 30
Note: To get better resolution , you can represent 30 degree as 300 and 100 degree as 1000 so if X = 123 it means 12.3 degree. [Edit 2014/7]: If you are using Fx PLC or the SmartTILEFx then you can use floating point operation directly without having to use integer to emulate the decimal point. So the formula could be:
X# = 70.0*(A200.0)/2800.0 + 30.0

Email: support@triplc.com Tel: 1877TRIPLCS



Fernandz
Newbie
Posts: 10


Re:How to scale an analog input data
« Reply #1 on: March 12, 2004, 11:56:15 PM »


I just posted in "Technical" about a sensor that has a 32 to 200 Deg. F range. This is what I know about scaling I hope it helps. We know that our ADC is 05volts and will send a count of 0 to 4092 So a 5 volt signal will be counted as 4092, and 0 volts will be a count of 0. Lets say our sensor outputs a signal thats proportional to temp. say .010v per'F and at 32 DegF we have an output of .32 volts.......... (.32 / .010v)=32'F and 200'F is an output, from the sensor, as 2 volts.......(2/.010v)=200'F
 0 .32v 2v 5v ' ADC volts   0 261 1637 4092 ' Converter count [ Our Sensor]
In order to get the Converter count of 261 and 1637 I use the formula count=4092/5*ADC(voltage)
So count=4092/5*.32 count=818*.32 count=261
Once you have your converter counts then use the above formulas to read temps. EG. temp=168*(ADC(n)261)/1376+32
This is how I do it, keep in mind I'm no engineer and self taught.




DAlgie
Newbie
Posts: 16
Using PLC for aircraft controller


Re:How to scale an analog input data
« Reply #2 on: July 26, 2004, 12:23:30 AM »


I have a nice Excel program for doing just this, scaling an analog input. I'll send it to anyone who wants it.




Ruaidhri
Newbie
Posts: 2
I'm a llama!


Re:How to scale an analog input data
« Reply #3 on: June 20, 2014, 11:42:14 AM »


@DAlgie could you send me a copy of this im starting to struggle with these adc's thanks in advance Ruaidhri






