PH sensor interfacing with Arduino nano

PH sensor interfacing with Arduino nano

In this article we will learn how to interface arduino with PH sensor. In the last post we will learn how to interface arduino with TDS sensor. You can visit our website,
I hope you appreciate my work, let’s discuss about today’s project.

What is PH sensor?

A ph sensor is one of the most essential tool that’s typically used for water measurements. This type of sensor is able to measure the amount of alkalinity and acidity in water and other solutions. When used correctly, pH sensor is able to ensure the safety and quality of a product and the processes that occur within a wastewater or manufacturing plant.

Components which we use in this project are below:

  1. Arduino nano
  2. TDS sensor
  3. Push button
  4. 9V battery
  5. LCD display
  6. Connecting wires

Diagram of this project is below:

PH sensor interfacing with Arduino nano
PH sensor interfacing with Arduino nano

Construction of PH sensor interface with arduino nano:

  • Connect +ve point of the PH sensor with 5V point of arduino nano
  • Connect GND point of PH sensor with GND point of arduino nano
  • Connect signal point of PH sensor with A0 point of arduino nano
  • Connect the D2 point of arduino with the DB7 point of LCD
  • Connect the D3 point of arduino with the DB6 point of LCD
  • Connect the D4 point of arduino with the DB5 point of LCD
  • Connect the D5 point of arduino with the DB4 point of LCD
  • Connect the D6 point of arduino with the E point of LCD
  • Connect the D7 point of arduino with the VDD point of LCD
  • Connect the (K-, DB3, RW, VSS) points with each other through the GND point of arduino
  • Connect VO point of LCD with Vin point of arduino nano
  • Connect the 1 terminal of push button to the Vin point of arduino nano
  • Connect the other terminal of push button with the +ve terminal of 5V battery
  • Connect the –ve terminal of 5V battery with the GND point of arduino nano

Working of PH sensor interface with arduino nano:

A ph sensor is one of the most essential tool that’s typically used for water measurements. This type of sensor is able to measure the amount of alkalinity and acidity in water and other solutions. When used correctly, pH sensor is able to ensure the safety and quality of a product and the processes that occur within a wastewater or manufacturing plant.

Applications of PH sensor interface with arduino nano:

  1. Aquarium pH Monitoring
  2. Hydroponics and Agriculture
  3. Swimming Pool Management
  4. Water Quality Monitoring

Advantages of PH sensor interface with arduino nano:

  1. Cost-Effective Solution
  2. Customizability
  3. User-Friendly Interface
  4. Real-Time Monitoring
  5. Automation

Program code of this project is below:

#include <Wire.h>

#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27, 16, 2);

float calibration_value = 21.34;

int phval = 0;

unsigned long int avgval;

int buffer_arr[10],temp;

void setup()

{

Serial.begin(9600);

lcd.init();

lcd.begin(16, 2);

lcd.backlight();

lcd.setCursor(0, 0);

lcd.print(”   Welcome to      “);

lcd.setCursor(0, 1);

lcd.print(” Circuit Digest    “);

delay(2000);

lcd.clear();

}

void loop() {

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

{

buffer_arr[i]=analogRead(A0);

delay(30);

}

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

{

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

{

if(buffer_arr[i]>buffer_arr[j])

{

temp=buffer_arr[i];

buffer_arr[i]=buffer_arr[j];

buffer_arr[j]=temp;

}

}

}

avgval=0;

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

avgval+=buffer_arr[i];

float volt=(float)avgval*5.0/1024/6;

float ph_act = -5.70 * volt + calibration_value;

lcd.setCursor(0, 0);

lcd.print(“pH Val:”);

lcd.setCursor(8, 0);

lcd.print(ph_act);

delay(1000);

Serial.print(“pH Val:”);

Serial.println(ph_act);

 

 

}