sagar saini
Published © GPL3+

A Review to DFRobot Gravity pH Sensor Kit V2

That's how I measured the pH with this lab grade DFRobot Gravity pH Sensor Kit V2

BeginnerFull instructions provided2 hours199
A Review to DFRobot Gravity pH Sensor Kit V2

Things used in this project

Software apps and online services

JUSTWAY

Story

Read more

Custom parts and enclosures

Library

Schematics

Circuit diagram

Code

Code

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

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

void setup() {
    Serial.begin(115200);  
    ph.begin();
}

void loop() {
    static unsigned long timepoint = millis();
    if(millis()-timepoint > 1000U) {  // Update every 1 second
        timepoint = millis();
        
        // Read analog voltage from sensor
        voltage = analogRead(PH_PIN)/1024.0*5000;  // Convert to mV
        
        // Calculate pH with temperature compensation
        phValue = ph.readPH(voltage, temperature);
        
        // Print results
        Serial.print("temperature:");
        Serial.print(temperature, 1);
        Serial.print("^C  pH:");
        Serial.println(phValue, 2);
    }
    
    // Handle calibration commands
    ph.calibration(voltage, temperature);
}

Credits

sagar saini
97 projects • 100 followers
I am Sagar Saini an electronic hardware enthusiast

Comments