-
Notifications
You must be signed in to change notification settings - Fork 5
PH_meter_temperature_compensation
Angelo edited this page Sep 21, 2016
·
2 revisions
Since there is no temperature sensor in the PH meter KIT, this temperature compensation is just a theoretical formula. It hasn't been verified by the specialized equipment.
/* pHConversion: converts the voltage value into a pH value updating the sensitivity
* in function of the temperature change
* Parameters: float input : voltage measured at the sensor output
* float cal_1 : voltage measured with the 10.0pH calibration solution
* float cal_2 : voltage measured with the 7.0pH calibration solution
* float cal_3 : voltage measured with the 4.0pH calibration solution
* float temp : temperature of the test solution
* float temp_cal : temperature of the calibration solutions
* Return: float value : the pH of the solution
* - -1 : wrong temperature introduced
* - -2 : wrong calibration temperature introduced
*
*/
float WaspSensorSW::pHConversion(float input, float cal_1, float cal_2, float cal_3, float temp, float temp_cal)
{
float value;
float zero_value;
float sensitivity;
if( (temp < 0)||(temp > 100) )
{
return -1.0;
}
if((temp_cal < 0)||(temp_cal > 100))
{
return -2.0;
}
// The value at pH 7.0 is taken as reference
zero_value = cal_2;
// The sensitivity is calculated using the other two calibration values
sensitivity = (cal_3-cal_1)/6;
// Add the change in the conductivity owed to the change in temperature
sensitivity = sensitivity + (temp - temp_cal)*0.0001984;
// pH value calculated from the calibration values
value = 7.0 + (zero_value-input)/sensitivity;
return value;
}