Arduino Projects

DIY pH Meter using Arduino and pH sensor and Calibrating it for Accuracy

Learn how to make a pH meter Interfacing pH sensor with Arduino and display the pH values on serial monitor, 16x2 LCD display and OLED display.

Overview

In this Quick tutorial, we are interfacing pH sensor and Arduino to make pH meter which can measure the pH values of any liquids and display the pH values on LCD display, OLED display and serial monitor. You can also learn how to calibrate the Ph sensor to show the accurate results.

Before getting started in to the project, lets learn about few topics.

What is pH

It is a unit of measurement of alkalinity or acidity of a solution, more specifically the pH measures the amount of hydrogen ions that a certain solution contains, the meaning of pH in its acronym is potential of hydrogen ions, this has become a practical way of handling alkalinity figures, instead of other slightly more complicated methods. It can be measured precisely through the use of a tool known as a pH meter, this device can measure the potential difference between a pair of electrolytes.

The hydrogen ion potential scale is numbered from 1 to 14, between 1 and 6 means that the substance is more acidic, 7 is the case of distilled water and has a neutral value, and 8 to 14 means that the substance is more alkaline.

The sequence that the pH scale has is logarithmic, which means that the difference between one numerical unit and another can be 10 times more basic or acidic depending on the case.

What is pH meter, how it works and its technical Specifications

pH meter is an instrument which is used to measure the potential of hydrogen ions in a liquid, and differentiating the acidity and alkalinity of a liquid with numbered units from 0-14. pH meter measures the electrical potential difference between the reference electrode and internal electrode. So it is also called as “potentiometric pH meter”. The potential difference between electrodes define the acidity of the solution in which the pH sensor is placed.

Working of pH meter

pH meter has a module and a pH electrode where the module has a voltage regulator which can support from 3.3v to 5.5v DC power supply and some has a 5v DC which is compatible with many programable boards like Arduino, ESP 8266, STM and ESP 32. Module equipped with hardware which can output filtered signal with less jitter. The module also has a potentiometer to calibrate the pH electrode.

pH Electrode probe working:

There are two types of electrodes glass and non glass electrodes, in our case we are only dealing with glass electrode, So here in a glass electrode the pH sensor element is a glass bulb is located to the end a glass tube this glass tube electrode is filled with the neutral potassium chloride solution with pH 7 and contains a silver wire coated with silver chloride. the structural diagram is shown in the below image.

glass based ph electrode working diagram

As you can see from the above image the reference system is located on the outer glass or plastic tube and also consists of silver chloride coated on silver wire in a saturated potassium chloride solution. So as the both glass electrode and reference electrode has same known pH solution there is no potential difference between them. the porous plug protects the reference system from medium to be measured without disconnecting the electrical connection between them.

The pH value is calculated by measuring the potential difference between the reference system and the measuring system.

Now the important part in the probe, the pH sensitive glass membrane, it is specially designed in such a way that the H+ ions moves towards surface of glass membrane and stick to them, when the glass is dipped inside a solution to be measured the positive charged H+ ions from the solution moves towards the surface of the glass membrane, the same happens with the internal solution which brings the H+ ions towards the glass membrane internally, So the difference in the H+ ions on both sides causes a potential difference. This potential difference is captured by the signal conversion module and apply the Nernst equation to get the value of pH.

ph glass membrane ions forming potential difference

If the hydrogen ion concentration on the inside is lower than the outside then the measured solution is acidic and pH is less than 7, or if the H+ ion concentration on the inside is higher than the outside, the measured solution is basic and the pH value will be greater than 7.

Analog pH sensor pinout diagram and technical Features: 

ph sensor module pinout diagram

Signal Conversion Module:

  • Supply Voltage: 3.3~5.5V
  • High Accuracy: ±0.1@25°C
  • BNC Probe Connector
  • Detection Range: 0~14

PH electrode:

  • Operating Temperature Range: 5~60°C
  • Easy calibration
  • Internal Resistance: <250MΩ
  • Zero (Neutral) Point: 7±0.5

Building pH Meter interfacing Arduino and pH sensor kit

Now after a detailed overview and working principles of pH sensor kit get build a pH meter interfacing analog pH sensor with Arduino Uno R3 and display the pH value on LCD display.

Required components for building pH meter using Arduino

  • 1x Arduino Uno R3
  • 1x Analog pH sensor kit
  • 16×2 LCD module with I2C
  • Few connecting wires

Circuit diagram:

Now connect all the required components as shown in the below schematic diagram.

pH Meter interfacing Arduino and pH sensor circuit diagramAs from the above connection diagram pH sensor module VCC is connected to 5v of Arduino, GND to GND of Arduino and sensor OUT pin is connected to A0 of Arduino.

As we are connecting the 16X2 LCD display with I2C adapter we are connecting the SDA and SCL of LCD module to A4 and A5 of Arduino respectively. and VCC and GND of LCD module to 5v and GND of Arduino respectively.

If you need to connect the LCD display without I2C adapter refer our previous article on Interfacing LCD Display with Arduino in detail.

After connecting everything as described above connect Arduino to PC or Laptop to upload the code.

Source Code:

Copy the below code, paste in the Arduino IDE, select the correct board and port from the Tools tab and tap Upload.

As we are using the LCD display with I2C you need LiquidCrystal_I2C library download here. Link

After uploading the code check the LCD display which shows like below image

ph meter output with arduino and lcd moduleHere we inserted the electrode probe in the lemon water, so as the lemon water are acidic the pH value is less than 7. In the same way if we insert it in the pure distilled water the value should be displayed is 7, if not you need to calibrate the device we learn at the end.

Interfacing OLED display to Arduino pH meter

Here in this method we are just replacing the LCD display with OLED display, every other connections are same except the OLED display connection, Which you can get from the below Schematic diagram.

Required components for building pH meter using Arduino

  • 1x Arduino Uno R3
  • 1x Analog pH sensor kit
  • OLED Display 0.96″ I2C
  • Few connecting wires

Circuit Diagram

Connect all the required components as shown in the below connection diagram

Interfacing OLED display to Arduino pH meter circuit diagram

The connections between Arduino and pH sensor module are same as above method.

As we are connecting the OLED display we are connecting the SDA and SCL of LCD module to A4 and A5 of Arduino respectively. and VCC and GND of LCD module to 5v and GND of Arduino respectively.

After connecting everything as described above connect Arduino to PC or Laptop to upload the code.

Source Code:

Copy the below code, paste in the Arduino IDE, select the correct board and port from the Tools tab and tap Upload.

As we are using the OLED display, you need Adafruit_GFX.h, Adafruit_SSD1306.h libraries download here. Link

After uploading the code check the LCD display which shows like below image

ph meter output with arduino and oled display
Here we inserted the electrode probe in the lemon water, so as the lemon water are acidic the pH value is less than 7 which we got as 2.93. In the same way if we insert it in the pure distilled water the value should be displayed is 7, if not you need to calibrate the device we learn at the end.

Calibrating pH sensor connected to Arduino

Calibrating a pH sensor is very essential to get the accurate readings, this is very easy in this project.

Calibrating the sensor is easy, the only thing you need is a known pH buffer solution. For Example take a buffer solution with pH value 7 and dip the electrode probe in the solution and observe the reading. if the output is not equal to 7 or decimals near to 7, rotate the potentiometer present on the signal conversion board till the output shown 7. That’s it your pH meter is calibrated and ready to use with accuracy.

Precautions to follow:

  • Sensor kit i.e the signal conversion board must be kept in dry place, moisture can effect the readings
  • Avoid touching or scratching the glass bulb in the probe, which can give incorrect readings
  • After usage disconnect the probe from signal conversion board. With out power supply the probe should not be connected to the board for a long time.

CircuitSchools Staff

We at CircuitSchools publish on basics of electronics and electric components and everything related to evolution of electrical technology with complete analysis of development boards and modules along with latest projects with innovative ideas.

Related Articles

Back to top button