Arduino Projects

pH Sensor with Arduino, pH Sensor Calibration, pH meter, pH value of Liquids

pH Sensor with Arduino:

pH Sensor with Arduino, pH Sensor Calibration, pH meter, pH value of Liquids- Recently, I got the Gravity Analog pH Sensor Kit V2 from the DFrobot. And let me tell you; this is the upgraded version of the pH meter V1 that we could only use with 5V compatible controller boards like Arduino, Raspberry pi, and other 5V compatible controller boards , whereas the pH Meter V2 is compatible with both 5V and 3.3V compatible controller boards like, ESP32, Raspberry Pi Pico, STM32, ESP8266, etc.

pH Sensor with Arduino

You can check my latest project on the ESP32 and pH Sensor based Hydroponic System.

allpcb circuit




The pH Sensor V2 kit includes:

  • A product qualification card.
  • A paper that gives you an introduction, technical details, and safety tips about pH sensor.
  • A pH probe with the BNC connector.

pH Probe Specification:

Probe Type: Laboratory Grade

Detection Range: 0~14

Temperature Range: 5~60°C

Zero Point: 7±0.5

Response Time: <2min

Internal Resistance: <250MΩ

Probe Life: >0.5 years (depending on the frequency of use) and

Cable Length: 100cm

The pH sensor interface board or the signal conversion board. It must be kept dry and clean, otherwise, it will affect the input impedance, resulting in an inaccurate measurement.

pH meter v2 signal conversion board with Arduino


Signal Conversion Board Specification:

Supply Voltage: 3.3~5.5V

Output Voltage: 0~3.0V

Probe Connector: BNC

Signal Connector: PH2.0-3P

Measurement Accuracy: ±0.1@25℃

Dimension: 42mm*32mm/1.66*1.26in

Some wires and screws.

And standard buffer solutions 4.0 and 7.0.

how to use buffer solution for pH Sensor with Arduino

You can only measure the pH value of water or any other liquid accurately if your pH probe is correctly calibrated. This is only possible when you use buffer solutions to calibrate the pH probe. Without these buffer solutions, you can never properly calibrate the pH probe. So, that’s why I ordered this complete kit. But, you can also purchase buffer solutions without purchasing the entire kit. Anyway;

You will also need an Arduino board and an i2c supported SSD1306 Oled display module.



Amazon Links:

Arduino Nano USB C type (Recommended)

SSD1306 Oled display Module

DFrobot Gravity pH Sensor Kit V2

pH Buffer Solutions

*Disclosure: These are affiliate links. As an Amazon Associate I earn from qualifying purchases.



pH Sensor Interfacing with Arduino:

Circuit diagram of pH Sensor with Arduino

Connect the Red and Brown wires which are labeled as + and – on the interface board to the Arduino 5V and GND. Connect the Yellow wire which is labeled as A on the signal conversion / interface board to the Arduino analog pin A1.

Connect the VCC and GND pins of the SSD1306 Oled display module to the Arduino 3.3V and GND pins. Connect the SDA and SCL pins to the Arduino i2c pins A4 and A5. A4 is the SDA and A5 is the SCL.

connecting pH Sensor with Arduino

Our hardware setup is completed; so, let’s calibrate the pH Sensor.

pH Sensor Calibration:

For the pH Sensor/meter calibration; first connect the Arduino to your Laptop or PC.

For the libraries installation; read my previous article on the Hydroponic System.

Then upload the following program and open the Serial Monitor.




pH Sensor Arduino Program:

Dip the pH probe in the pH 7 buffer solution.

pH Sensor with Arduino

“Don’t forget to rinse the pH probe”.



Open the Serial monitor and wait for at least 2 to 5 minutes until the pH value gets stable.

pH Sensor calibration using Arduino

Right now you can see, the pH probe has successfully detected the pH 7 solution, this is because; I have already calibrated it.

If you get a wrong value, simply adjust the calibration value in the program until the pH probe reading matches the buffer solution. This process should take around 5 minutes.

float calibration_value = 15.00 – 0.31;

When you use buffer solutions, you need to clean the probe with water each time. Make sure there is not any pH 7 solution on the probe when you dip it into the pH 4 solution, and vice versa.

buffer solution use for pH Sensor calibration with Arduino

Anyway, after this, when you dip the pH probe into the pH 4 solution, it will automatically detect it. As per the manufacturer the pH Sensor response time is around 2 minutes, so, do not panic if you see wrong values at first; give the pH sensor some time to stabilize.

pH Sensor displaying buffer solution on Arduino serial monitor

You can see it’s getting close to the pH 4 value; which means we have successfully calibrated the pH Probe.



Let’s dip it again in the pH 7 solution and let’s see if it can still successfully detect the pH 7 buffer solution.

testing water quality using pH Sensor with Arduino

Amazing, it successfully detected the pH 7 buffer solution. Now, let’s go ahead and check the pH values of different liquids.

Note: for every measurement, make sure you rinse the pH probe, and after you dip the pH probe in a liquid then wait for around 5 minutes. You should give enough time to the pH value to get stabilize. Following are the stabilized values.

Testing pH Value Using Arduino:

pH Value of Well Water:

testing ph value of well water using pH Sensor with Arduino

After 5 minutes of waiting, the water pH value stabilized at 7.39.



pH Value of Milk:

testing milk ph value using pH Sensor with Arduino

Stabilized pH value of Milk is 6.97.

pH Value of Shampoo:

testing ph value of shampoo using pH Sensor with Arduino

Stabilized pH value of Shampoo is 6.92.

pH Value of Baking Soda:

testing baking soda ph value using pH Sensor with Arduino

Stabilized pH value of Baking Soda is 7.89.




Watch Video Tutorial:

 

Engr. Shahzada Fahad

Engr. Shahzada Fahad is an Electrical Engineer with over 15 years of hands-on experience in electronics design, programming, and PCB development. He specializes in microcontrollers (Arduino, ESP32, STM32, Raspberry Pi), robotics, and IoT systems. He is the founder and lead author at Electronic Clinic, dedicated to sharing practical knowledge.

Related Articles

One Comment

  1. Hi! I intend to interface the same pH sensor but using STM32. Also, I am requried to program it using bare metal code, or not using the Arduino Library. Do you by any chance have any idea on how to be able to do this? I’ve tried finding its datasheet but DFRobot seems not to provide the datasheet.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button
Electronic Clinic
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.