Go Down

Topic: Programming an almost linear graph (Read 6776 times) previous topic - next topic


Hehe yes you are right looking at the sequence of the 1st decimal place in the sequence of measurements: 0, 3, 5, 8, 0, 3, 5, 8, 0, 3, 5, 8.  And since the last value is 4.62 setting it to 4.82 will make it even more linear....

It is supposed to be a linear relationship i think, even the opamp i am using costs a bit in order to give linear results under large amplifications, since the orignal voltage are mV and these have been amplified to V having a gain of 1000 and more.

Thank you for the advice, i think I will use it as linear.  I will mention all these comments (errors) in my thesis
tnx :)

You could use two op-amps... it would make the circuit a bit more complex, but you could also use them to filter the signal... if needed.

I think the best is to assume it as a linear load cell... What are the rated limits of the load cell? It is quite normal to see the load cell have some linearity problems in the beginning and end of the scale (like my teacher said: "Linearity is an illusion"). But with a 10 bit ADC, you'll probably get a bigger error from that.

What is the precision of the reading you're planning to have? 1,2,3 decimal places?

Since you have all the gear you need either way, do this. Program the Arduino to use a linear scale. Use one of the equations you found. Then compare readings with the scale you have and different values of sand and plot the results. You can then check if the "non-linearity", is really affecting your measurements or not.

From experience, having an R-squared of 0.9995 is as good as one. Especially considering you're using 10 bits...
This... is a hobby.


Apr 07, 2011, 08:47 am Last Edit: Apr 07, 2011, 08:54 am by WillR Reason: 1
Since nobody else picked up on this...

Daniel Said in an early post:

What I did was I got 20kgs of sand, and put 1kg, 1kg, 1kg ..... into separated plastic bags, so I have 20 plastic bags each 1kg. and exactly 1kg since I used a good electronic weighing scale to measure them.

"Good" is not an acceptable engineering or statistical term.

Saying that scale is accurate on a 1Kg measurement to +- 0.05 grams -- or whatever is  acceptable.

When you are dealing with numbers....

The Relative error adds absolutely
The absolute error adds absolutely...

Is the scale error given as a percent? Is it given as +- so many grams...

Regardless ... if each bag is off by 2 grams... then adding five bags gives an error of +- 10 grams...

If each bag is off by 2% -- because that is the rating on the scale... then if you have 5 bags in a bucket -- what is the error? (HINT: It is not 2%.)

If you always use the same bags for your 5Kg weight -- then you help to "constrain" the error.

If you always "randomize" the bags that is another issue.

If you choose the bags in a pattern -- that is another issue again.

Basic stats and engineering principles...

In your calculations -- if you multiply or divide -- the percentage error (relative error) adds absolutely. In additions or subtractions -- the absolute error adds absolutely.

In something like this you need to calculate the error at the same time you calculate your answer.

Edit: You can verify this by getting (access to) a weigh scale which can measure different combination of 5Kg bags -- you will likely get some different weights.

What I left out as well is another statistic about a measuring device... the repeatability. If you make the same measurement 10 times -- do you always get the same answer.

I have done this exercise many times in industrial and scientific environments... They are not trivial issues.

Best wishes...


Well, the electronic scale used to put 1kg of sand wasn't that accurate.  It was just a weighing scale bought from ebay used for other purposes,  it doesn't have a datasheet or anything.....so that might be the problem as well.  Fortunately it seems to be a sensitive weighing scale since it displays a change in 1 gram for example but it aint specific.

tnx for your interest. tomorrow il set up anoither experiment and take the readings again.


There's a big difference between precision and accuracy...


You can buy (Or borrow) a set of standard weights used to calibrate scales.

They should be easy to find in the university. Getting them might be another issue as labs don't like to loan equipment.

Doing all this work and pretending that you knew the weights of the bags was not a great use of time. :P

Bringing the scale to the weights, calibrating the scale, and then returning it to where you work might upset the calibration.

You really need to have the calibration weights handy to test the scale as you proceed through the weighing session.


Getting them might be another issue as labs don't like to loan equipment.

There's a good reason for that...

Also, don't forget, if you have a plate on the scale, the measured value should remain the same regardless of where you set the weight. I have no idea of the name of this test... but it is used in scales verification and calibration too.
This... is a hobby.

Go Up