Need to measure water quality and other parameters but haven't got any low cost pH meter? Find it difficult to use with Arduino? Here comes an analog pH meter, specially designed for Arduino controllers and has built-in simple, convenient and practical connection and features. It has an LED which works as the Power Indicator, a BNC connector and PH2.0 sensor interface. To use it, just connect the pH sensor with BNC connector, and plug the PH2.0 interface into the analog input port of any Arduino controller. If pre-programmed, you will get the pH value easily. Comes in compact plastic box with foams for better mobile storage. Attention:In order to ensure the accuracy of the pH probe, you need to use the standard solution to calibrate it regularly.Generally, the period is about half a year. If you meaure the dirty aqueous solution, you need to increase the frequency of calibration.



Board Overview

pH Electrode Size


pH Electrode Characteristics

The output of pH electrode is Millivolts,and the pH value of the relationship is shown as follows (25 ℃): Ph-mv.jpg


Connecting Diagram


Step to Use the pH Meter


**(1)**Connect equipments according to the graphic,that is,the pH electrode is connected to the BNC connector on the pH meter board,and then use the connection lines,the pH meter board is connected to the ananlong port 0 of the Arduino controller. When the Arduino controller gets power,you will see the blue LED on board is on. **(2)**Upload the sample code to the Arduino controller. **(3)**Put the pH electrode into the standard solution whose pH value is 7.00,or directly shorted the input of the BNC connector.Open the serial monitor of the Arduino IDE,you can see the pH value printed on it,and the error does not exceed 0.3. Record the pH value printed,then compared with 7.00, and the difference should be changed into the "Offset" in the sample code. For example,the pH value printed is 6.88,so the difference is 0.12.You should change the "# define Offset 0.00" into "# define Offset 0.12" in your program. **(4)**Put the pH electrode into the pH standard solution whose value is 4.00.Then wait about one minute,adjust the gain potential device, let the value stabilise at around 4.00.At this time,the acidic calibration has been completed and you can measure the pH value of an acidic solution. Note:If you want to measure the pH value of other solution,you must wash the pH electrode first! (5) According to the linear characteristics of pH electrode itself, after the above calibration,you can directly measure the pH value of the alkaline solution, but if you want to get better accuracy, you can recalibrate it. Alkaline calibration use the standard solution whose pH value is 9.18.Also adjust the gain potential device, let the value stabilise at around 9.18. After this calibration, you can measure the pH value of the alkaline solution.

Sample Code

Sample code for testing the PH meter and get the sensor feedback from the Arduino Serial Monitor.

 # This sample code is used to test the pH meter V1.0.
 # Editor : YouYou
 # Ver    : 1.0
 # Product: analog pH meter
 # SKU    : SEN0161
#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 ArrayLenth  40    //times of collection
int pHArray[ArrayLenth];   //Store the average value of the sensor feedback
int pHArrayIndex=0;
void setup(void)
  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)
      voltage = avergearray(pHArray, ArrayLenth)*5.0/1024;
      pHValue = 3.5*voltage+Offset;
  if(millis() - printTime > printInterval)   //Every 800 milliseconds, print a numerical, convert the state of the LED indicator
        Serial.print("    pH value: ");
double avergearray(int* arr, int number){
  int i;
  int max,min;
  double avg;
  long amount=0;
    Serial.println("Error number for the array to avraging!/n");
    return 0;
  if(number<5){   //less than 5, calculated directly statistics
    avg = amount/number;
    return avg;
      min = arr[0];max=arr[1];
        amount+=min;        //arr<min
      }else {
          amount+=max;    //arr>max
          amount+=arr[i]; //min<=arr<=max
    avg = (double)amount/(number-2);
  return avg;



Q&A Some general Arduino Problems/FAQ/Tips
A For any questions, advice or cool ideas to share, please visit the DFRobot Forum.

More Documents

Schematic PCB Design layout pH Electrode Manual Arduino Sample Code Zips For All Above New Version Wiki(V2)

DFshopping_car1.png Get Analog pH Sensor / Meter Kit For Arduino from DFRobot Store or DFRobot Distributor.

Turn to the Top