DIY Smart pH Meter Project

In our daily diet, water consumption, and skincare routines, we often pay attention to the acidity of liquids. But how can we delve deeper into understanding the pH values of these fluids? Through this DIY pH meter project, we aim to unveil the technological mysteries woven into our lives. Let's gain a more intuitive understanding of the acidity levels in our surroundings. Embark on a journey to unravel the secrets of pH values, allowing technology to empower us with greater knowledge and insight.


1 Beetle ESP32 - C3
1 Gravity: Analog Spear Tip pH Sensor
1 OLED Transparent Display
1 3.7V Battery
1 Enclouse
1 Power Switch

DFRobot has introduced a series of pH sensors over the years, including the pH sensor for laboratory tests, the pH sensor for industrial use, and the niche pH sensor with spear tip for measuring the pH of wet soil and foods. Also there are V2.0 pH sensors that can be powered by 3.3V~5V, so they are compatible with multiple main-controllers like Arduino, ESP32, Raspberry Pi and so on. The equipped signal adapter comes with BNC and Gravity interfaces, plug and play, no soldering required. Besides, the sensor output is filtered by hardware and has a low overall jitter.






STEP1: Connect the pH sensor



STEP2: Connect it to the display and put on the shell



STEP3: Upload the code



STEP4: Then we get a simple pH meter

DFRobot provides you with the relevant open-source software library, which adopts the two-point calibration method and can automatically identify the two standard buffer solutions, simple and fast. 




STEP5: After the calibration, the pH sensor is ready for use. 



(1) the pH of the lemon liquid



(2) the pH of the milk



(3) the pH of the soapy water



If you're interested in how to calibrate a pH sensor, you can watch our previous video.

     * 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:
     *   enterph -> enter the calibration mode
     *   calph   -> calibrate with the standard buffer solution, two buffer solutions(4.0 and 7.0) will be automaticlly recognized
     *   exitph  -> 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();
            //temperature = readTemperature();         // read your temperature sensor to execute temperature compensation
            voltage = analogRead(PH_PIN)/1024.0*5000;  // read the voltage
            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



Through this DIY pH meter project, we hope to demonstrate how technology empowers us with more capabilities and insights. Understanding the acidity or alkalinity of liquids in our surroundings is no longer exclusive to professional laboratories; it has become simpler and more intuitive. If you have any questions or suggestions, feel free to leave a comment!

All Rights