Innacturate Gravity: 7/24 (SEN0169-V1) pH meter, looking for some help!

Hello,

I am using a Gravity 7/24 Industrial analog pH meter (Gravity: 7/24 Industrial Analog pH Meter for Arduino - DFRobot) to measure the pH of BG11 media. It is powered by a 2A 5V power supply, and is wired directly to an Arduino Uno. When attempting to use or calibrate the pH meter, I constantly get inaccurate results, and the potentiometer adjustment doesn't work. In a neutral solution with an established pH of 7.00, the pH meter gives me pretty consistent pH values between 6.98 and 7.18. But when I test in a pH of 10.01, the pH value only increases up to ~7.60. And when testing in a pH of 4.00, the value only decreases to ~6.00. I get the same results when I begin measuring in the pH of 4.00 or 10.01, so this is not the fault of the averaging code.

I am using the original length signal wires, which I have shielded with copper tape and further insulated with dual-wall heat shrink tubing. I have also shielded the plastic box which the BNC board sits in with the same copper tape, but have tested with both the BNC board inside and outside the box with the same results.

The sensor is being powered by the 5.0V pin on the Arduino, and the Arduino is powered by its original power supply. I would like to use a separate power supply, but every alternate power supply I have tried causes the pH value to change drastically and become more inaccurate.

I have done everything I can, including adding an RH3.5X6X0.8 ferrite bead to the signal wire at the Arduino, and a 3.5mm ferrite bead to the power supply cable at the Arduino. But the addition of the ferrite beads further decreased any change between pH readings of the 4.0, 7.0, and 10.01 pH solutions. So they have been removed.

I am using this pH sensor for my Grade 12 Capstone Project, and it must be functional and trustworthy within 2 weeks. From what I can tell, the only possible error remaining would be within the pH meter anr/or BNC board.

Does anyone have some advice to offer me?

In addition what power supplies do you guys recommend, and does anyone have a sample code that doesn't average the pH?

Thanks in advance!

This is the code I am using:

/*
  # This sample code is used to test the pH meter V1.1.
  # Editor : YouYou
  # Ver    : 1.1
  # DAT    : 2014.06.23
  # Product: analog pH meter V1.1
  # SKU    : SEN0161
*/
#define SensorPin A2            //pH meter Analog output to Arduino Analog Input 2
#define Offset 0.00            //deviation compensate
#define LED 13
#define samplingInterval 20
#define printInterval 800
#define ArrayLength  40    //times of collection
int pHArray[ArrayLenth];   //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 == ArrayLenth)pHArrayIndex = 0;
    voltage = avergearray(pHArray, ArrayLenth) * 5.0 / 1024 + 0.05;
    pHValue = 3.5 * voltage + Offset;
    samplingTime = millis();
  }
  if (millis() - printTime > printInterval)  //Every 800 milliseconds, print a numerical, convert the state of the LED indicator
  {
    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;
  }
  if (number < 5) //less than 5, calculated directly statistics
  {
    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;
}

You may have a defective sensor or a wiring problem.

If measuring pH is critical for a project due in a couple of weeks, ask at a chemistry lab in a nearby education institution if you can make the required measurements using their professional equipment.