Electorials Electronics
Published © GPL3+

Project 021: Arduino Liquid pH0-14 Detection Sensor Project

A slightly more intermediate project involving a unique pH sensor and an Arduino which is used to measure the pH level of solutions.

IntermediateProtip18 minutes735
Project 021: Arduino Liquid pH0-14 Detection Sensor Project

Things used in this project

Hardware components

ICStation Liquid pH0-14 Detection Sensor
×1
Jumper wires (generic)
Jumper wires (generic)
4 Male to Female Jumper Wires.
×1
Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
You could use any other Arduino board as well. The Seeeduino v4.2 is used in this example.
×1
USB-A to Micro-USB Cable
USB-A to Micro-USB Cable
Depends on the Arduino.
×1
PCBWay Custom PCB
PCBWay Custom PCB
×1

Story

Read more

Schematics

Circuit Diagram

Code

Arduino Liquid pH0-14 Detection Sensor Project Code

C/C++
#define SensorPin 0         
unsigned long int avgValue;
float b;
int buf[10],temp;
 
void setup()
{
  pinMode(13,OUTPUT);  
  Serial.begin(9600);  
}
void loop()
{
  for(int i=0;i<10;i++)       
  { 
    buf[i]=analogRead(SensorPin);
    delay(10);
  }
  for(int i=0;i<9;i++)       
  {
    for(int j=i+1;j<10;j++)
    {
      if(buf[i]>buf[j])
      {
        temp=buf[i];
        buf[i]=buf[j];
        buf[j]=temp;
      }
    }
  }
  avgValue=0;
  for(int i=2;i<8;i++)                      
    avgValue+=buf[i];
  float phValue=(float)avgValue*5.0/1024/6; 
  phValue=3.5*phValue;                   
  Serial.print("    pH:");  
  Serial.print(phValue,2);
  Serial.println(" ");
  digitalWrite(13, HIGH);       
  delay(800);
  digitalWrite(13, LOW); 
 
}

Credits

Electorials Electronics

Electorials Electronics

76 projects • 26 followers
I'm an electronic hobbyist interested in anything, from Arduino to drones. I plan to educate people with the content on my website.

Comments