pH Sensor for Water Quality

pH Sensor for Water Quality

Introduction

This experiment shows how to use a pH sensor with an Arduino to measure the pH level of water, which is an important indicator of water quality.

pH Sensor

Components Needed

Circuit Setup

  1. Connect the pH sensor's output to an analog input pin (e.g., A0) on the Arduino.
  2. Connect the sensor's VCC and GND pins to the Arduino's 5V and GND, respectively.

The pH sensor will output an analog voltage that corresponds to the pH level.

pH Sensor Circuit Setup

Code for pH Measurement

Upload the following code to your Arduino to measure pH levels:


const int pHSensorPin = A0;
float voltage, pHValue;

void setup() {
  Serial.begin(9600);
}

void loop() {
  voltage = analogRead(pHSensorPin) * (5.0 / 1023.0);
  pHValue = 3.5 * voltage;  // Example conversion formula
  Serial.print("pH Value: ");
  Serial.println(pHValue);
  delay(1000);
}
            

Explanation

The pH sensor provides a voltage output that corresponds to the pH level of the water. The Arduino reads this value and converts it to a pH value, which is then displayed on the Serial Monitor.

Troubleshooting