What is pH Sensor Kit

“If it turns pink, it’s acidic I think.” This, probably, has been the most common confusion during our Chemistry labs. Measuring acids and alkalis (bases) with litmus paper is something pretty much everyone learns how to do in school. It might be relatively easy to compare that little strip of wet paper with the colours on the pH scale and figure out how acidic or alkaline something is but sometimes that's too crude a measurement. If you keep tropical fish, for example, who live in water of a certain acidity or alkalinity, getting things wrong with the litmus risks killing off your fragile pets. That's why many people invest in a pH sensor that can measure pH directly. Let's take a closer look!

What does pH mean?

The pH of a substance is an indication of how many hydrogen ions it forms in a certain volume of water. There's no absolute agreement on what "pH" stands for, but most people define it as something like "power of hydrogen" or "potential of hydrogen." Mathematically, it is defined as

pH = -log(H+)

A typical pH sensor has two electrodes. The electrode that does the most important job, which is called the glass electrode, has a silver-based electrical wire suspended in a solution of potassium chloride, contained inside a thin bulb (or membrane) made from a special glass containing metal salts (typical compounds of sodium and calcium). The other electrode is called the reference electrode and has a potassium chloride wire suspended in a solution of potassium chloride.


For pH meters to be accurate, they must be properly calibrated (the meter is accurately translating pH measurements into voltage measurements), so they usually need testing and adjusting before you start to use them. You calibrate a pH meter by dipping it into standard buffer solutions (test solutions of known pH) and adjust the meter accordingly. It should always be dipped in deionized water after each use, this keeps the measurements precise.

The connections to a microcontroller is as follows:

  • VCC – 5V
  • GND - GND
  • GND - GND
  • Po – A0

The Po outputs the voltage value sensed by the pH sensor. The code we write needs to convert the voltage value to the corresponding pH value


Before we get started, the sensor needs to be calibrated. The sensor board outputs 0V at pH 7 while giving negative voltage for acids and positive voltage for bases. Hence to calibrate, we simulate taking a solution of pH 7 and then adjust the Analog reading offset potentiometer to give the reading of 2.5V.


In order to calibrate, we can short the probe terminals using a jumper wire as shown below:


This is to simulate a pH 7 solution, as the output from the probe should be 0 V. Upload the Analog voltage reading code below and adjust the Analog Reading offset potentiometer to read 2.5 V in the serial monitor.


void setup() {



void loop() {

  int sensorValue = analogRead(A0);

  float voltage = sensorValue * (5.0 / 1023.0);



pH Measurement Code

Once calibration is done, you can proceed to upload the pH measurement code


Note: Please do not cross contaminate your solutions. Always rinse the pH probe with distilled water after every test and please allow the sensor to sit in the solution for at least two minutes before taking the reading


float calibration = 0.00; //change this value to calibrate

const int analogInPin = A0;

int sensorValue = 0;

unsigned long int avgValue;

float b;

int buf[10],temp;

void setup() {



void loop() {

for(int i=0;i<10;i++)





  for(int i=0;i<9;i++)


  for(int j=i+1;j<10;j++)











  for(int i=2;i<8;i++)


  float pHVol=(float)avgValue*5.0/1024/6;

  float phValue = -5.70 * pHVol + calibration;

  Serial.print("sensor = ");





You can buy the pH Sensor Kit Online 

Leave a comment

Please note, comments must be approved before they are published