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.
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.
ASSEMBLY
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
* @ https://github.com/DFRobot/DFRobot_PH
*
* 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](https://www.dfrobot.com), 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()
{
Serial.begin(115200);
ph.begin();
}
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("temperature:");
Serial.print(temperature,1);
Serial.print("^C pH:");
Serial.println(phValue,2);
}
ph.calibration(voltage,temperature); // calibration process by Serail CMD
}
float readTemperature()
{
//add your code here to get the temperature from your temperature sensor
}
CONCLUSION
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!