Water pollution can be caused by different chemicals. So measuring water quality is very important otherwise it can affect human health. Previously, water quality is measured by using a traditional method namely; pH indicator. But this method cannot provide accurate pH reading of water. The most frequently used pH indicators in laboratory are; phenolphthalein litmus & methyl orange. To guess pH of water, pH indicators mainly depend on visible color changes. To overcome this, the standard procedure is used with pH sensor to measure the pH of water. This sensor is a simple device used to measure the water quality like acidity and alkalinity. This article provides brief information on pH sensor, working and its applications.
What is a pH Sensor?
A sensor that is used to detect the hydrogen ions concentration within a solution and changes it into an equivalent usable o/p signal is known as pH sensor. This sensor includes a signal transmission part and chemical part. This sensor is used to measure alkalinity & acidity within water. This sensor’s standard measurement range is 0 to 14 that is represented in digital. The substance pH value 7 indicates neutrality. When the measurement value of substance is larger than seven, then the alkalinity is considered as stronger. Similarly, if the substance measurement value is smaller, then acidity value is considered as stronger. This sensor is frequently used in industries for substances measurement like water & solutions.
The difference between alkaline & acidic substances is significant for any corporation that utilizes boilers, cooling towers, pool control manufacturing processes, a variety of environmental monitoring.
Specifications
The specifications of pH sensor include the following.
- This sensor voltage is 5V.
- Its power consumption is <= 0. 5watts.
- Its current supply ranges from 5 to 10mA.
- Its measurement concentrate range is 0 to 14.
- Its temperature ranges from 0 to 60 degrees.
- Its response time is <= 5sec.
- Its stability time is <= 120 sec.
- This sensor size is 42mm x 32mm x 20mm.
- This sensor weight is 25 grams.
pH Sensor Working
The pH sensor is made with glass frequently and includes a rod by a bulb at the base that simply holds the sensor. The basic operation of this sensor is, the ions exchange from the solution to the glass electrodes inside solution through the glass membrane. The porosity of glass membrane reduces and probe’s performance will be reduced by continued usage.
A glass bulb is particularly made to be selective to the concentration of hydrogen ion is present within the glass electrode utilized for measuring pH. In the test solution, the hydrogen ions will exchange with other ions on the glass bulb upon concentration within the solution under test, forming an electrochemical potential across the glass bulb. The difference of electrical potential in between two electrodes can be formed during the test is noticed through the electronic amplifier that changes it into pH units.
The following Nernst equation simply states that the electrochemical potential across the bulb can be linked linearly to pH.
Em = Eo + (2.3RT/nF) log [H+]
Where:
‘Em’ is the pH electrode’s potential.
‘Eo’ is connected to the reference electrode’s potential.
‘R’ is the Gas Law constant,
‘F’ is Faraday’s constant,
‘T’ is the temperature within Kelvin,
‘n’ is the ionic charge & [H+] is the concentration of hydrogen ion in moles/L.
As the reference electrode is made with metallic conductor and that is connected to the display, then it is not sensitive to the pH of solution. The electrolyte solution like potassium chloride is allowed by porous ceramic membrane where this conductor is submerged for interacting by the test solution. Voltmeters that show voltage within pH units make up the display.
Types of pH Sensor
There are different types of pH sensors available which are discussed below.
pH Composite Sensor
pH composite sensor can be defined as; an electrode that merges a pH glass electrode & a reference electrode. These sensors are known with two names based on the outer shell material used; if the material is plastic then called a plastic-shell pH composite sensor and outer shell is made with glass then called a glass pH composite sensor. The main benefit of this sensor is; it combines two electrodes into one, simple to use and its detection range is 0 to 14PH. The applications of this sensor mainly include; domestic sewage, industrial sewage, aquaculture, agriculture, etc.
Desulfurization Type sensor
The main function of this sensor is to measure pH within flue gas desulfurization. The electrode used in this sensor is maintenance free gel electrode that maintains high accuracy even at maximum pH values or high temperature. This is a type of slurry & desulfurization PH electrode which is flat, not simple to scale & simple to clean. So, it is most appropriate electrode for desulfurization. The pH detection range is from 0 to 14PH. This sensor is used in a variety of industrial wastewater, mineral suspension, ecological protection water treatment, measurement of PH within flue gas desulfurization.
PTFE pH sensor
This sensor is made with polytetrafluoroethylene is known as PTFE pH sensor where this sensor utilizes very low-impedance based glass sensitive film that is resistant to very strong alkalis, acids & to corrosion. This sensor is appropriate to monitor the value of pH within organic substances. The probe of this sensor is front-facing and the ring-mounted safety ring guards the glass bulb by linearity & better accuracy. The detection range of this sensor is from 0 to 14PH. The applications of PTFE pH sensor mainly include acid-base neutralization, industrial wastewater, severely polluted water & strong acids.
Electroplating Sensor
Electroplating PH sensor uses double liquid junction to decrease the contamination of the reference liquid. The electrodes service life deeply prolongs the diffusion path of long-distance reference of the electrode within very harsh environments. The detection range of this sensor is 0 to 14PH. The applications of this sensor mainly include sewage treatment, occasions with high organic content, electroplating wastewater fermentation, and many more.
pH Glass Sensor
This type of sensor is an electrochemical sensor that simply produces a mV output equivalent to varying pH values. This sensor’s measurement electrode part mainly depends on a particularly created pH sensitive glass that responds with the concentration of hydrogen ion within the media.
The measured solution’s pH value by the pH glass electrode is the saturated calomel electrode. The pH glass electrode measures PH value accurately and quickly & is less interfered through different factors like chromaticity of water, colloidal substances, turbidity, oxidants, agents & salinity reducing. The detection range of pH glass sensor is from 0 to 14PH. The applications of this sensor mainly include; pharmacy, Biological engineering, beer, semiconductor electronics industry, chemical industry, etc.
pH Antimony Sensor
The pH-sensitive electrode like antimony electrode is fairly strong and used wherever the electrode is necessary to be strong, although it has huge limitations. Antimony electrode is appropriate for PH test of solution with hydrofluoric acid. Antimony is an exclusive metal with direct relationship characteristic in between pH & its measured potential. The main voltage or potential difference developed in between antimony & a copper or copper sulfate reference electrode changes in between around 0.1-0.7V because of changes within the pH.
The antimony electrode should be cleaned before we use with any half-cells. Antimony is extremely brittle & should be carefully treated. The antimony pH electrode is mainly suitable for solutions which have hydrofluoric acid because the pH sensor doesn’t have glass wetted parts and will not degrade in such environment. These sensors are used for sewage, Online breeding monitoring, hydrofluoric acid, etc.
Maintenance
This sensor can be maintained in good condition by regularly maintaining the pH electrode because some common issues may affect the electrode without appropriate maintenance like oil coating above the electrode, fouling or blockage of the reference contact, crack of the PH bulb, malfunction & short electrode life because of reference poisoning.
Usually if the electrodes are covered with different substances, consider using a sensor that includes a non-porous reference junction. The use of automated systems for cleaning electrodes can further reduce your maintenance needs. If the reference junction is often clogged or fouled, a non-porous electrode can also be used as a solution to this problem. If your pH bulb breaks when it comes in contact with sewage, you can use a bulb guard to protect it. As for the problem of reference poisoning, the use of non-porous electrodes can avoid these problems.
To clean and maintain the pH electrode, there few steps need to follow. While handling these types of electrodes, wearing security glasses & gloves is very important. Once the pH electrodes are not using, then they must be kept within a liquid solution always. If this electrode dries out, then it cannot be used for long time.
To clean these electrodes, you have to place it in a solution that has 5% hydrochloric acid & 95% water. Once this electrode is positioned within this solution then most of the electrode coating will liquefy. The pH sensor must be soaked for minimum 5 to 10 minutes & after that cleaned it. If the sensor coating is mostly heavy, then above process must be repeated many times.
Make sure to clean the pH sensor with a smooth cloth, because any brush or abrasive cloth will harm the electrode. Generally, this sensor must be maintained regularly because some common problems may affect the pH electrode without proper maintenance like PH bulb crack, oil coating over the electrode, the reference contact’s fouling (or) blockage, short electrode life & malfunction, etc.
pH Sensor Interfacing with Arduino
The term ‘pH’ is used to identify the condition of water-based solution whether that is acidic (or) basic. The pH value is lower for acidic solutions whereas pH value is high for basic solutions. So, the sensor is capable in determining the Ph value of any solution and it detects whether the solution is basic or acidic or neutral within nature. If we know that pH value then we can easily check the quality of water in agricultural field & also in fish farming. This sensor is used in different applications which include pharmaceuticals, wastewater treatment, chemicals and petrochemicals.
The interfacing of pH Sensor with Arduino is shown below. Here the sensor used is Gravity analog pH sensor. The required components to make this interfacing mainly include Arduino UNO, Ph Sensor Kit, breadboard and connecting wires.
Analog pH meter V2 is specially designed for measuring the pH value of the solution. This is an advanced edition of pH meter V1, so this sensor progresses the accuracy & user experience greatly. The voltage supply range of the voltage regulator chip on board ranges from 3.3 to 5.5V. By using this sensor, you can make the pH meter very quickly for measuring the Ph value of the various solutions.
The pH sensor kit includes a signal conversion board V2 & pH probe. The main features these two follows as;
- The voltage supply of signal conversion board V2 ranges from 3.3 to 5.5Volts.
- Its output voltage is 0 to 3.0Volts.
- Probe connector is BNC
- Signal connector is PH2.0-3P
- Measurement accuracy is ±0.1@25℃entigrade.
- The pH probe type is laboratory grade.
- Its range of detection is 0 to 14.
- Its temperature range is from 5 to 60°C.
- Its response time is < 2min.
- Its internal resistance is < 250MΩ.
- Probe life is above 0.5 years.
- The length of cable is 100cm.
Let us discusses how to interface gravity analog pH sensor with Arduino Uni using simple code. This interfacing is very simple and pH sensor circuit diagram or schematic diagram is shown below. The connections of this interfacing follow as;
The sensor includes three pins which are connected to Arduino Uno board. Thus connect the VCC pin of sensor to 5V pin of Arduino Uno.
The GND pin of the sensor is connected to GND pin of Arduino board.
The analog pin of sensor is connected to A0 pin of Arduino board.
Once the connections are made for the interfacing, then upload the following code into the Arduino board.
Code
// Include the necessary libraries
#include <Wire.h>
// Define the analog pin where the pH sensor is connected
const int sensorPin = A0;
void setup() {
// Start serial communication
Serial.begin(9600);
}
void loop() {
// Read the analog value from the pH sensor
int sensorValue = analogRead(sensorPin);
// Convert the analog value to pH using a calibration factor
float pHValue = map(sensorValue, 0, 1023, 0, 14.00);
// Print the pH value to the serial monitor
Serial.print(“pH Value: “);
Serial.println(pHValue);
// Wait for a short delay before the next reading
delay(1000);
}
Once the above code is uploaded into the Arduino Board, serial monitor need to be opened & start sensor testing with different solutions like milk, soap water, lemon juice and tap water.
pH Sensor Interfacing with ESP32 WiFi Module
The pH sensor interfacing with Nodemcu is shown below. The pH Sensor used in this interfacing is; an analog type that providess a linear pH reading in the range of 0pH – 14pH. ESP32 board is a 12-bit controller including ADC, thus it measures data more accurately as compared to Arduino uno board which includes a 10-bit ADC.
The required components to make IoT based pH Meter are; ESP32 WiFi Module, Ph Sensor Kit, 9V DC supply, connecting wires & breadboard. The basic interfacing of pH sensor with ESP32 WiFi Module is shown below and is a very simple connection diagram.
The analog pH meter kit including real-time industrial electrode is especially designed for different microcontrollers. This kit includes a simple, very convenient and practical connection. The pH electrode is designed with a sensitive glass membrane by low impedance which is used in different pH measurements through quick response & outstanding thermal stability.
The sensor is powered by an external 9V DC supply or 9Volts battery. The connections of this interfacing follow as; the A0 pin of the pH Sensor signal board is given to Vp pin of ESP32 board. The GND pin of the sensor board is connected to GND pin of the ESP32 WiFi module. The sensor output ranges from 0.5V to 3V thus the sensor is used with analog pins of WiFi module.
Code
Here, the pH sensor is a type of analog sensor thus, we will be changing the analog o/p voltage into a pH value. The following code is simple ESP32 and sensor code. So, copy the below code & upload it into the ESP32 WiFi Module. Choose the ESP32 module from the Board Manager & also choose the COM port and upload the below code.
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_ADS1015.h>
#include <WiFi.h>
// Replace with your network credentials
const char *ssid = “your-SSID”;
const char *password = “your-PASSWORD”;
// Create an Adafruit ADS1115 ADC instance
Adafruit_ADS1115 ads;
// Analog pin connected to the pH sensor
const int pHPin = 34; // Change this to the actual pin you’re using
void setup() {
Serial.begin(115200);
// Connect to Wi-Fi
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println(“Connecting to WiFi…”);
}
Serial.println(“Connected to WiFi”);
// Initialize the ADS1115 ADC
ads.begin();
// Set the gain to 1 for reading voltages from 0 to 4.09V
ads.setGain(GAIN_ONE);
}
void loop() {
// Read the analog voltage from the pH sensor
int16_t rawValue = analogRead(pHPin);
// Convert the raw ADC value to millivolts
float voltage = rawValue * 0.1875; // 0.1875mV per bit
// Print the raw ADC value and the voltage
Serial.print(“Raw Value: “);
Serial.print(rawValue);
Serial.print(“, Voltage: “);
Serial.print(voltage);
Serial.println(” mV”);
// You can now perform pH calculations using the voltage value
delay(1000); // Adjust the delay according to your needs
}
This part of the code attempts to connect the ESP32 to the specified WiFi network. The while loop waits until the connection is established (WL_CONNECTED), and then it prints a message to the Serial Monitor indicating a successful connection.
So, in summary, the purpose of the WiFi module in this code is to provide a means for the ESP32 to connect to a WiFi network, enabling communication over the network. This could be useful for scenarios where you want to remotely monitor or control the pH sensor data, send the data to a server, or implement other IoT (Internet of Things) applications.
Once the above code I uploaded then open the Serial Monitor and the values of sensor must be noticeable.
Now the pH value is tested for different substances like lemon juice, detergent solution and milk. The pH value for lemon juice is around 2.8 to 3.0, the pH value for detergent is above 8 and for milk is approximately 5.
Advantages and Disadvantages
The advantages of pH sensor include the following.
- These sensors provide accurate pH value with pH meters.
- These sensors are very faster.
- The pH meter provides a numerical value for the pH.
These are very helpful in deciding the condition of a substance.
The disadvantages of pH sensor include the following.
- This sensor is very expensive.
- pH meters which uses pH sensors need to be calibrated.
- There is a change of breakage.
Applications
The applications of pH sensor include the following.
- These sensors are used in different applications like maintenance of swimming pool, making cheese, stain removal, measuring pH value of soil etc.
- The pH meters are used in different industries like gas & oil, pharmaceutical, food and beverage, plants for water purification treatment.
- It is very significant factor within the production of detergent.
- These sensors are used in the treatment of waste water.
- These are used in paramedical & chemical industries.
Thus, this is an overview of pH Sensor, working, types, interfacing and its applications. pH sensor is used pH meters for measuring the pH value of different substances. Here is a question for you, what is soil moisture sensor?