0

In finding the pH value of a liquid/Soil, what is the range of Offset voltage value that I can use in my code?

Using / calibrating pH sensor module

I considered the above link as a reference. But I didn't come to know the range of Offset Value...

Here is the logic below to find the value of pH right...

avgValue = 0;
for (int i=2;i<8;i++)       // take the average value of 6 center sample
avgValue+=buf[i]; 

float phValue = (float)avgValue*5.0/1024/6; // convert the analog into millivolt
phValue=3.5*phValue+Offset;

What is the range of Offset value can I use in the above/my code?

Thanks in Advance

1 Answers1

1

When converting real world sensor measurements into usable data there are several issues to consider:

  1. Noise from any number of sources such as (unavoidable?) long cables and power supplies to name two. Consider using exponential averaging to minimize the effects of noise. If the noise if predictable consider sampling only when the noise is absent.

  2. Slope of the data is important when converting to known scales. For example the slop of the resistance of a thermistor verses heat may not have the same slope as the temperature in Celsius verses heat. Simply multiply by the appropriate constant to correct for slope error.

  3. After you correct for slope the values may still not be correct. When all values are equally less or more then the expected values an offset is required. Simply add or subtract the appropriate constant to correct for offset error.

  4. Linearity is often corrected using lookup tables. Linearity is a measure of how closely the sensor tracks the physical value being measured. For example, after slope and offset corrections, a thermistor measurement may appeared curved when compared to the actual temperature in Celsius. For this final correction the sensor measured value is used to index into a lookup table which returns a correction value. Interpolation is used to control the size of the lookup table when space is a consideration.

st2000
  • 7,503
  • 2
  • 13
  • 19