calibration

Initial testing by adding bolts one at a time and measuring voltage with CRO - 16 Sep [|calibration.xls]


 * The scale is going to be nonlinear
 * The output of the device is not going to be 0-5V, more likley 1.3 - 3V, etc.

A new calibration test has been performed, this time with masses up to 1kg. It shows very linear result, which is good. [|calibration data 8-10-08.xls] Whilst using the generated formula to calculate values is somewhat inaccurate (mostly +/- 2g), these voltages are only to 3 significant figures. Hopefully the increased precision that the microcontroller gets will allow it to be more precise. Maybe.

Basic method for calibration. See... um... elsewhere... for all the #defines and globals. code format="c" /** * Use two points, and simple maths, to work out a calibration line. We need to work out if it's computationally * feasible to do it with more points. */ void calibrate(unsigned int zeroVoltage, unsigned int secondVoltage, unsigned in secondMass, char massUnit) {	float gradient = secondMass / (secondVoltage - zeroVoltage); float yIntercept = - zeroVoltage / gradient;

voltageToMassEquation[massUnit] = {gradient, yIntercept};

char otherMassUnit = massUnit ^ 1;	//0 or 1 voltageToMassEquation[otherMassUnit] = {convert_unit(gradient, massUnit, otherMassUnit), convert_unit(yIntercept, massUnit, otherMassUnit)}; } code