pH (Power of Hydrogen) is the (-) negative log of hydrogen ion concentration in a water based solution described by Danish Biochemist Soren Peter Laurits Sorensen late 1909. pH has it value of 0 (ACID) and 14 (BASIC) in a neutral value of 7 see below the diagram for common substances of pH values . pH measurements are important in the field of agronomy, medicine, biology, chemistry, agriculture, forestry, food, science, environmental science, oceanography, civil engineering, chemical engineering, nutrition, water treatment, and water purification etc.
Basically there are 3 common buffer solution used for power of hydrogen measurement pH 4.01 | pH 6.86 | pH 9.18 | also the pH 7.0 and 10.0 are available values sense by this module.
Calibration is important to get the proper value of the pH, basically there are two different calibration OFFSET Value | STEP Value. Offset is the shifting value of all pH to specific voltage range using the trimmer pot attach to the board, to calibrate to pH 7 you need to adjust the voltage of the BNC connector out of 2.5v or 2.4v for pH 8 offset of +0.3v. STEP is another buffer solutions depending the range and precision we need, to acquire the proper values of range to be measured.
The pH probe is calculated by getting the know pH value of 7 (Neutral) as voltage of 2.5v then add some pH step to equal the probe voltage, this means that the pH of 8 has a voltage of 2.5v pH 7 + 0.1839 x 1 unit / step or pH 9 is 2.5v + 0.1839 + 0.1839 = 2.87v the 0.1839 is a small division of the voltage by pH units or volts per pH number.
Required Components
- Arduino Microcontroller, NodeMCU, Teensy Board, TeensyDuino, ESP8266 12, 12E, ESP8266 NodeMCU, ESPDuino, ATMEGA328 16/12, ATMEGA32u4 16/8/ MHz, ESP8266, ATMEGA250 16 MHz, ATSAM3x8E, ATSAM21D, ATTINY85 16/8 MHz (Note: The Diagram below is using NANO. (please refer to the respective pin-outs)
- pH Sensor (See below diagram)
- pH BNC Electrode Probe
- Jumper Wires / DuPont Wires
- Voltage Tester
Wiring Guide
Source Codes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
#include <Wire.h> #include <LiquidCrystal_I2C.h> //Download the library below //LiquidCrystal_I2C lcd(0x3F,16,2); //Set 0x27 if your using different i2c address (20,4 if your using 20/4 LCD) int pHSense = A0; void setup() { Serial.begin(9600); delay(100); //Wire.begin(2,14); //lcd.init(); //lcd.backlight(); //lcd.setCursor(0,0); //lcd.print("14CORE | pH Probe "); //lcd.setCursor(0,1); //lcd.print(">Initializing..."); //delay(4000); // lcd.clear(); //lcd.setCursor(0,0); //lcd.print("14CORE | pH Sense"); Serial.println("14CORE | pH Sense"); } void loop(){ int measuringVal = analogRead(pHSense); Serial.print("Measuring Raw Value > "); Serial.print(measuringVal); double vltValue = 5/1024.0 * measuringVal; Serial.print("Voltage Value > "); Serial.print(vltValue, 3); float P0 = 7 + ((2.5 - vltValue) / 0.18); Serial.print(""); Serial.print("pH Value > ") Serial.print(P0, 3); Serial.print(""); delay(3000); } |
Downloads
Hi there,
I am using this probe with an Arduino Uno. I am getting readings but my pH values are negative.
My readings look like this:
Measuring Raw Value > 892Voltage Value > 4.355pH Value > -3.308
Any suggestions which way I need to adjust the Offset? I am using distilled water for test.
Looking forward to hearing from you. Thanks for the code.
Val = 7 / 1024.0 * 892 = 6.9 pH > just remove lines of codes are not required we use 7 because 7 is the pH value of distilled water. :D
Hi,
I’m using nodeMCU ESP8266 to be able to measure the pH of the aquarium, I have used your code but it gives me wrong values.
In the double formula
vltValue = 5 / 1024.0 * measuringVal;
With the value of 7:
Measuring Raw Value> 892 Voltage Value> 6.098 pH Value> -12.987
With the value of 5 (original):
Measuring Raw Value> 891 Voltage Value> 4.351 pH Value> -3.281
Thanks for your code.
Hi,
I’m using nodeMCU ESP8266 to be able to measure the pH of the aquarium, I have used your code but it gives me wrong values.
In the formula:
double vltValue = 5 / 1024.0 * measuringVal;
With calibrating liquid at ph = 7
With the value of 7:
Measuring Raw Value> 892 Voltage Value> 6.098 pH Value> -12.987
With the value of 5 (original):
Measuring Raw Value> 891 Voltage Value> 4.351 pH Value> -3.281
With calibrating liquid at ph = 9
With the value of 7:
Measuring Raw Value> 785 Voltage Value> 5.366 pH Value> -8.923
With the value of 5 (original):
Measuring Raw Value> 785 Voltage Value> 3.833 pH Value> -0.406
Any solution?
Thanks for your code.
Also same problem