I have a project where I need to measure the height of a box and deal it off to one of many directions according to it's measurement. I am using an ultrasonic transducer to do this. I am inputting this to an 888+ PLC and it works great. My problem is that it is not linear over the entire range. I have a range of 0" to 24" with the 0" representing no box present to the 24" equaling the tallest box. If I have it correct at the max. height then It will be off by 1/2" at the min. height.
The ultrasonic output is 0-10vdc of which I use a resister network as outlined in the manual to derive a 0 - 5 vdc input. This works correctly.
The formula I am using is B = ((ADC(1) * Z)/4092)
Z = 2400 which is 24" x 10 to get rid of the real number.
I need to measure down from 0.0" to 24.0"
What am I doing wrong?
Everything works correctly, just that it is not linear. It has to be in my scaling formula.