Zeroing load cell data

Dear Group,
Please look at the Figure 1 and read the question below:
y | * * * * ------ Load cell calibration data
| * * | * * | *-- Pt. a * 0 |______________* --Pt. b ______ x | | Figure 1
In Figure 1 you have a set of load cell data. The thing is, the beginning and end points (Pt. and Pt. b) are above the "y" axis and away from the "x" axis i.e. they are not zeroed.
The following function was written to fix this problem, but it has an inherent flaw. The flaw can be demonstrated by Figure 1, point a > b, the script subtracts the gap between Pt. a and the "x" axis but this only adds the problem onto the end of Pt. b. How can you solve either the problem with this script or the problem in general?
function [zeroed_x,zeroed_y] = zero_xy_v2(x,y),
length_x = length(x); a = x(1); %first value of x b = x(length_x); %last value of x
%----------------------------- %Zero "X_axis" %----------------------------- zeroed_x = x;
% if a == b, % % if a == 0, % zeroed_x = x; % elseif a > 0, % zeroed_x = x - a; % else %a < 0 % zeroed_x = x + a; % end % % elseif ((a == 0) & (b > 0)), % zeroed_x = x - b; % % elseif ((a > 0) & (b == 0)), % zeroed_x = x - a; % % elseif ((a < 0) & (b > 0)), % zeroed_x = x - (b + a); % % elseif ((a > 0) & (b < 0)), % zeroed_x = x - (b + a); % % elseif ((a > 0) & (b > 0)), % if a > b, % zeroed_x = x - a; % else %b > a % zeroed_x = x - b; % end % % else %((a < 0) & (b < 0)) % % if a > b, % zeroed_x = x - a; % else %b < a % zeroed_x = x - b; % end % % end
%----------------------------- %Zero "Y_axis" %----------------------------- clear a b; length_y = length(y); a = y(1); %first value of y b = y(length_y); %last value of y
if a == b,
if a == 0, zeroed_y = y; elseif a > 0, zeroed_y = y - a; else %a < 0 zeroed_y = y + a; end
elseif ((a == 0) & (b > 0)), zeroed_y = y - b;
elseif ((a > 0) & (b == 0)), zeroed_y = y - a;
elseif ((a < 0) & (b > 0)), zeroed_y = y - (b + a);
elseif ((a > 0) & (b < 0)), zeroed_y = y - (b + a);
elseif ((a > 0) & (b > 0)), if a > b, %zeroed_y = y - a; %-------------------------------------------------------- %This was my first effort to fix the problem on one part of the script - you can see why %I left it! dummy_y = y - a; length_dummy_y = length(y); a = y(1); %first value of y b = y(length_y); %last value of y
if b == 0, %To check and delete if part of the curve is below zero zeroed_y = zeroed_y; elseif b < 0 length_zeroed_y = length(zeroed_y); for k = 1:length_zeroed_y, if length_zeroed_y(k) > 0 | length_zeroed_y(k) == 0, data(k) = length_zeroed_y(k); else data(k) = []; end zeroed_y = data; end %-------------------------------------------------------------
else % b > 0
end
else %b > a zeroed_y = y - b; end
else %((a < 0) & (b < 0))
if a > b, zeroed_y = y - a; else %b < a zeroed_y = y - b; end
end
Any help will be appreciated.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
alex wrote:

> 0 |______________* --Pt. b ______ x

...

Please help me with more information. What physical variables are plotted? In other words, what do 'x' and 'y' stand for?
What is the physical source of the offset?
Why is there no point at x = 0
What would the value of measurements taken halfway between point b and its neighbors be?
What sort of nonlinearity would make the output of your load cell non-monotonic?
Jerry
--
Engineering is the art of making what you want from things you can get.

  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
alex wrote:

-- code snipped --
I'm not going to look at the code (it's tedious, I'm lazy), but if you could reply with a description of the algorithm I'll look at that.
I assume that the plot is something like read-out vs. actual load. Just looking at the plot it looks like your biggest problem is the severe nonlinearity. Presumably you want to calibrate the cell for _just_ the linear portion, because anything beyond that is useless anyway -- right?
Were I to calibrate something with an output curve like this I'd first try to estimate which is the 'good' portion of the curve, where the cell output vaguely resembles reality. I'd do two things with that information: first, I'd remember the 'last good load' value, and ignore readings above that; second I'd take all of the readings within the good portion and I'd do a least-squares curve fit. It may not be the best way to calibrate your instrument, but chances are high that it'll be good enough (you'll have to check that 'good enough' part).
I have to comment: if you have a load cell with such an output function, you _must_ have some assurance that you aren't asking it to measure anything in the flat region or beyond. From the curve you give there's no way to tell between a weight that's way out of range and a very light weight -- this could lead to all sorts of disasters.
--

Tim Wescott
Wescott Design Services
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Tim Wescott wrote:

>> 0 |______________* --Pt. b ______ x

I can't imagine how a load cell could be that nonlinear, especially the sharp notch in the flat-top (saturation) region. I suspect two errors: improperly recorded data, and/or defective or improperly applied conditioning electronics. Many amplifiers "fold over" if sufficiently overdriven, and the notch in the saturation region could be the DC value of an oscillation.
Jerry
--
Engineering is the art of making what you want from things you can get.

  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Jerry Avins wrote:

Certainly something is wrong. However, even designing one's equipment to load things into the flat-topped region would be odd at best -- were I driving a load cell into a flat-topped region (assuming good drive electronics) I'd be concerned about mechanical damage.
--

Tim Wescott
Wescott Design Services
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
The flat section on the curve does not exist as such in my data (poor drawing) more rounded.
This is a non-standard calibration procedure for a non-standard sensor; normally you would not cut the curve, say at Pt. a; and bring it to zero; you would just leave it as the data does not exist there. The zeroing here was implemented so that the variability over a large set of data that came from a rig measuring pressure over a (relatively) flat surface could be evaluated.
For interest sake: y = Voltage (the response) and x = Force (the input).
This is purely a programming question.
Thanks for your replies though!
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

What are we looking at? Is the x-axis "time", or "force"?
--
Scott
Reverse name to reply
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Scott Seidman wrote:
...

...

Am I missing something?
Jerry
--
Engineering is the art of making what you want from things you can get.

  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Perhaps my ability to read ascii art is waning, but to me it looks like a time record-- zero load, followed by placing a known load on and leaving it there awhile, followed by removing the load, at which point it returns to a -different- zero. If this is the case, then I can understand what nonlinearity everybody seems to be talking about.
You referred to a force/voltage curve. It doesn't look like any force/voltage curve I've ever seen. Just seems to be a voltage vs time curve. The two calibration points would be at one of the zeros, and the value at the plateau.
FWIW, the only times I've seen a load cell do stuff like that was cases in which something was mechanically loose, or maybe the system had some play in it and started out somewhat bound. Personally, I'd put most of my effort into finding out what's wrong instead of finding some way to calibrate a system that can't be calibrated.
--
Scott
Reverse name to reply
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Scott Seidman wrote:

Hi Scott,
The sensor though not easily calibrated with a polynomial fit is able to be calibrated with another function; I have achieved this succesfully.
This was purely a programming question and so should not have posted it in this group; please accept my apologies to all.
Have a nice day!
Alex
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
alex wrote: ...

Please elaborate. I would deal with this with a look-up table and an interpolation routine.

You leave us with curiosity to be assuaged. Why is there no datum at x = 0?
Jerry
--
Engineering is the art of making what you want from things you can get.

  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
alex wrote:

Sorry, guys, the curve in Figure 1 above was purely used as an example of a particular curve that I wanted to zero; what axis was what does not really matter. But for the curious, Figure 1 was supposed to be y Force and x = time. The final curve that I use is the one which is a voltage/force curve and because of the nature of the curve it does not matter which way you write the equation because you will only get one solution; where as above you would get two solutions.
In some cases of course, if you were wanting an input of force to get an output of voltage then you would write V = ????F; otherwise you would write F = ????V; but you can minimise the equation to find V if you have the first equation but this is a little more tricky.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Scott Seidman wrote:

Alex wrote "y = Voltage (the response) and x = Force (the input)" and I have no reason to doubt him.

I have never seen a load cell behave this way either, but I have seen amplifiers behave this way, particularly overloaded op-amps. I agree that something meeds to be fixed.
Jerry
--
Engineering is the art of making what you want from things you can get.

  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

And then he clarified "Figure 1 was supposed to be y Force and x = time"-- but that was fairly recently. In any case, the correction clarifies alot, and I'd put money on a broken load cell housing or something wrong with the mechanical connection between the load cell and the device it's attached to
--
Scott
Reverse name to reply
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Scott Seidman wrote:

Your question was in response to that clarification. That's why I was puzzled. Anyhow, it was all a game. The data were fabricated.
Jerry
--
Engineering is the art of making what you want from things you can get.

  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Jerry Avins wrote:

An elaborate troll?
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
This is no game. You have just seen it from your perspective, that is all, and thus it appears to be a game. In reality, I am working with a different animal.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
alex wrote:

We see it from the prospective you provided. I, at least, feel cheated.
Jerry
--
Engineering is the art of making what you want from things you can get.

  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
I did not plan to deceive anyone. I thank you for all your best intentions; all very well received.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
alex wrote:

I know you didn't. You'll use better judgment next time.
Jerry
--
Engineering is the art of making what you want from things you can get.

  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.