SOP for Calibration of SEN0169 pH Probe

Objective

Ensure that pH readings during experimentation will be fully accurate and reflect the true pH value of the probe tip environment.

Product

DFRobot SEN0169 Gravity: Analog pH Sensor (PRO)

Documentation

Overview

Calibration is done by adjusting BOTH the software code on arduino IDE, as well as manually adjusting the potentiometer on the pH meter board.

Procedure

Material Prep


Hardware Setup

  1. pH probe ↔ pH meter board via BNC connector
  2. pH meter board ↔ arduino via 3-pin connector
    1. blue: signal out to any analog pin
      1. should keep in mind which pin is being used, as this will reflect in the code
    2. red: power to 5V
    3. black: gnd to gnd
  3. arduino ↔ connect to laptop for power
  4. flash code onto arduino:
    /*
     # This sample code is used to test the pH meter Pro V1.0.
     # Editor : YouYou
     # Ver    : 1.0
     # Product: analog pH meter Pro
     # SKU    : SEN0169
    */
    
    #define SensorPin A0  //pH meter Analog output to Arduino Analog Input 0
    #define Offset 0.00  //deviation compensate
    #define LED 13
    #define samplingInterval 20
    #define printInterval 800
    #define ArrayLength  40  //times of collection
    
    int pHArray[ArrayLength]; //Store the average value of the sensor feedback
    int pHArrayIndex=0;
    
    void setup(void)
    {
      pinMode(LED,OUTPUT);
      Serial.begin(9600);
      Serial.println("pH meter experiment!"); //Test the serial monitor
    }
    
    void loop(void)
    {
      static unsigned long samplingTime = millis();
      static unsigned long printTime = millis();
      static float pHValue,voltage;
      
      if(millis()-samplingTime > samplingInterval)
      {
          pHArray[pHArrayIndex++]=analogRead(SensorPin);
          if(pHArrayIndex==ArrayLength)pHArrayIndex=0;
          voltage = avergearray(pHArray, ArrayLength)*5.0/1024;
          pHValue = 3.5*voltage+Offset;
          samplingTime=millis();
      }
      //Every 800 milliseconds, print the state of the LED indicator
      if(millis() - printTime > printInterval) 
      {
        Serial.print("Voltage:");
            Serial.print(voltage,2);
            Serial.print("    pH value: ");
        Serial.println(pHValue,2);
            digitalWrite(LED,digitalRead(LED)^1);
            printTime=millis();
      }
    }
    
    double avergearray(int* arr, int number){
      int i;
      int max,min;
      double avg;
      long amount=0;
      if(number<=0){
        Serial.println("Error number for the array to avraging!/n");
        return 0;
      }
      // less than 5, calculated directly statistics
      if(number<5){   
        for(i=0;i<number;i++){
          amount+=arr[i];
        }
        avg = amount/number;
        return avg;
      }
      else{
        if(arr[0]<arr[1]){
          min = arr[0];max=arr[1];
        }
        else{
          min=arr[1];max=arr[0];
        }
        for(i=2;i<number;i++){
          if(arr[i]<min){
            amount+=min;        //arr<min
            min=arr[i];
          }else {
            if(arr[i]>max){
              amount+=max;    //arr>max
              max=arr[i];
            }else{
              amount+=arr[i]; //min<=arr<=max
            }
          }//if
        }//for
        avg = (double)amount/(number-2);
      }//if
      return avg;
    }
    1. letting the probe run while looking at the terminal on the Arduino IDE interface should read continuous values of voltage AND pH

CALIBRATION SOFTWARE

  1. Rinse probe tip with distilled water and gently dry
  2. Submerge tip into pH 7 solution
  3. Watch the terminal until a steady pH value is read
  4. Record steady pH value
  5. Determine offset

    Offset = 7.00 - steady pH value

  6. Implement offset into .ino code
    #define Offset 0.00   // change this value!
  7. Save file and reflash the code onto the arduino
  8. Check that pH readings are within range of pH 7
🥼

Operator notes: Offset is set to 0.35

Caliberation Hardware

  1. Rinse probe tip with distilled water and gently dry
  2. Submerge tip into pH 4 solution
  3. Watch the terminal until a steady pH value is read
  4. Adjust the potentiometer until a pH value of 4 is read
    1. 2 way knob: one way is increasing pH, other way is decreasing pH
  5. DONE WITH POTENTIOMETER! DO NOT ADJUST ANYMORE!
  6. Once both sets of calibration have been completed, check back that the probe is correctly reading pH 7.0 in pH 7.0 solution and pH 4.0 in pH 4.0 solution

🥼

Operator notes: Calibration did not work on first try due to dehydration of the probe tip. Probe tip was soaked in 0.1 HCl solution for 24 hours, then in 3M KCl solution for 6 hours before use.