DFRobot Gravity: Analog pH meter V2 is specifically designed to measure the pH of the solution and reflect the acidity or alkalinity. It is commonly used in various applications such as aquaponics, aquaculture, and environmental water testing.

As an upgraded version of pH meter V1, this product greatly improves the precision and user experience. The onboard voltage regulator chip supports the wide voltage supply of 3.3~5.5V, which is compatible with 5V and 3.3V main control board. The output signal filtered by hardware has low jitter. The software library adopts the two-point calibration method, and can automatically identify two standard buffer solutions( 4.0 and 7.0), so simple and convenient.

With this product, main control board (such as Arduino) and the software library, you can quickly build the pH meter, plug and play, no soldering. DFRobot provides a variety of water quality sensor products, uniform size and interface, not only meet the needs of various water quality testing but also suitable for the DIY of multi-parameter water quality tester.

The pH is a value that measures the acidity or alkalinity of the solution. It is also called the hydrogen ion concentration index. The pH is a scale of hydrogen ion activity in solution. The pH has a wide range of uses in medicine, chemistry, and agriculture. Usually, the pH is a number between 0 to 14. Under the thermodynamic standard conditions, pH=7, which means the solution is neutral; pH<7, which means the solution is acidic; pH>7, which means the solution is alkaline.

1. The BNC connector and the signal conversion board must be kept dry and clean, otherwise, it will affect the input impedance, resulting in an inaccurate measurement. If it is damp, it needs to be dried.
2. The signal conversion board cannot be directly placed on a wet or semiconductor surface, otherwise, it will affect the input impedance, resulting in the inaccurate measurement. It is recommended to use the nylon pillar to fix the signal conversion board, allow a certain distance between the signal conversion board and the surface.
3. The sensitive glass bubble in the head of the pH probe should avoid touching with the hard material. Any damage or scratches will cause the electrode to fail.
4. After completing the measurement, disconnect the pH probe from the signal conversion board. The pH probe should not be connected to the signal conversion board without the power supply for a long time.


Board Overview

Num Label Description
1 - Power GND(0V)
2 + Power VCC(3.3~5.5V)
3 A Analog Signal Output(0~3.0V)
4 BNC pH Probe Connector


This tutorial will demonstrate how to use this pH meter for calibration and measurement. Please read each step carefully.

Before measuring another solution, be sure to wash the probe and absorb residual water-drops with paper to prevent cross-contamination between solutions. The probe can be washed with distilled water.


Connection Diagram

Before using the pH probe, pull out the probe from the protective cap, then wire as shown below. After completing measurement, clean the probe, then insert it into the protective cap.


To ensure accuracy, the probe used for the first time, or used for a period of time, needs to be calibrated. This tutorial uses two-point calibration and therefore requires standard buffer solutions of 4.0 and 7.0. The following steps show how to operate two-point calibration.




Sample Code

Please download DFRobot_PH Library first,then install it. How to install Libraries in Arduino IDE?

 * file DFRobot_PH.ino
 * @
 * This is the sample code for Gravity: Analog pH Sensor / Meter Kit V2, SKU:SEN0161-V2
 * In order to guarantee precision, a temperature sensor such as DS18B20 is needed, to execute automatic temperature compensation.
 * You can send commands in the serial monitor to execute the calibration.
 * Serial Commands:
 *   enter -> enter the calibration mode
 *   cal -> calibrate with the standard buffer solution, two buffer solutions(4.0 and 7.0) will be automaticlly recognized
 *   exit -> save the calibrated parameters and exit from calibration mode
 * Copyright   [DFRobot](, 2018
 * Copyright   GNU Lesser General Public License
 * version  V1.0
 * date  2018-04

#include "DFRobot_PH.h"
#include <EEPROM.h>

#define PH_PIN A1
float voltage,phValue,temperature = 25;
DFRobot_PH ph;

void setup()

void loop()
    static unsigned long timepoint = millis();
    if(millis()-timepoint>1000U)  //time interval: 1s
      timepoint = millis();
      voltage = analogRead(PH_PIN)/1024.0*5000;  // read the voltage
      //temperature = readTemperature();  // read your temperature sensor to execute temperature compensation
      phValue = ph.readPH(voltage,temperature);  // convert voltage to pH with temperature compensation
      Serial.print("^C  pH:");
    ph.calibration(voltage,temperature);  // calibration process by Serail CMD

float readTemperature()
  //add your code here to get the temperature from your temperature sensor


Q1. How long does the probe need to be calibrated?
A2. The calibration interval is determined by the frequency of use. Normally, you can calibrate it once a month. If used frequently, it can be calibrated once a week. When calibrating, fresh standard buffer solution is recommended.
Q2. During the calibration, is it necessary to complete two points calibration? Can I complete only one point calibration?
A2. In the case of low demand, you can use neutral standard buffer solution (7.0) for calibration, which is called single-point calibration and is used to confirm the actual zero point of the pH probe. At this point, the slope is the theoretical value. Then the actual slope of the pH probe can be confirmed by calibration with standard buffer solution (4.0) after signal-point calibration. Therefore, in order to ensure the measurement accuracy, it is recommended to use two-point calibration.
Q3. What might be the reason for the first calibration that always fails to calibrate, or prints the unexception value?
A3. When calibrating, the relevant parameters are stored in the specified position in EEPROM. If other data previously saved in the same position in EEPROM, there may be a conflict, resulting in an inability to calibrate properly. Use the following code to erase the contents in the specified position in EEPROM. Run it once, then upload the sample code again to restart the calibration.
    #include <EEPROM.h>
    #define KVALUEADDR 0x00
    void setup(){
        for(byte i = 0;i< 8; i++   ){
          EEPROM.write(KVALUEADDR+i, 0xFF);
    void loop(){
For any questions, advice or cool ideas to share, please visit the DFRobot Forum.

pH Probe Maintenance Notes

1. When the probe is used for the first time or used for some time, the probe needs to be immersed in the 3NKCL solution for 8 hours.

  1. Glass bubble in the head of the pH probe(in the plastic protection grid) shall not be contacted with the hard objects, and any breakage or rubbing will invalidate the probe.
  2. When the measurement is finished, the protective cap should be put on, and a small amount of 3mol/L KCL solution should be put inside the protective cap to keep the glass bulb moist.
  3. The plug of the pH probe must be kept clean and dry, absolutely prevent the output ends short-circuit, otherwise, it will result in inaccurate measurement or probe failure.
  4. The probe should avoid long-term immersion in distilled water, protein, acid fluoride solution, and prevent contact with silicone oil.
  5. After long-term use, if you found that the percentage of the theoretical slope of the probe (PTS) slightly reduced, you can soak the lower end of the probe in 4%HF (hydrofluoric acid) for 3-5 seconds, wash with distilled water, and then soak in the 0.1MOL/L HCL solution for a few hours, rinse clean with deionized.
  6. The probes are passivated by the presence of contamination-sensitive bulbs in the solution under test or by the plugging of the liquid boundary. The phenomenon is that the theoretical slope (PTS) is reduced, the response time is long and the readings are unstable. Therefore, according to the nature of the contaminants, they should be cleaned with an appropriate solution to make them fresh.
  7. Attention should be paid to the selection of the cleaning agent. The soluble polycarbonate cleaning liquid, such as carbon tetrachloride, trichloroethylene, four furans and so on, may stained glass ball bubble surface, and make the probe failure, please use these with great caution!

More Documents

DFshopping_car1.png Get Gravity: Analog pH Sensor/Meter Kit from DFRobot Store or DFRobot Distributor.

Turn to the Top