Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO Based pH Meter with LCD Display and Indicator LEDs

View and Edit Project In Cirkit DesignerImage of Arduino UNO Based pH Meter with LCD Display and Indicator LEDs

Circuit Documentation

Summary

This circuit is designed to measure the pH level of a solution and display the value on an LCD screen. It also includes a visual indicator system using LEDs: a yellow LED lights up for acidic solutions (pH < 5), a green LED for neutral to slightly alkaline solutions (pH 5-8), and a blue LED for alkaline solutions (pH > 8). Upon powering up, the system displays a welcome message on the LCD. The core of the circuit is an Arduino UNO microcontroller, which reads the pH level from a pH meter sensor, processes the data, and controls the LCD and LEDs accordingly.

Component List

Arduino UNO

LED: Two Pin (yellow)

LED: Two Pin (green)

LED: Two Pin (blue)

PH Meter

LCD 16x2 (Wokwi Compatible)

I2C Module

Wiring Details

Arduino UNO

LED: Two Pin (yellow)

LED: Two Pin (green)

LED: Two Pin (blue)

PH Meter

LCD 16x2 (Wokwi Compatible)

I2C Module

Documented Code

/*
 * Alat pengukur pH air dengan output nilai pH pada LCD.
 * Lampu kuning menyala jika pH < 5.
 * Lampu hijau menyala jika pH 5-8.
 * Lampu biru menyala jika pH > 8.
 * Saat alat dinyalakan, tampilkan pesan selamat datang.
 */

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27, 16, 2);

const int yellowLED = 1; // Pin connected to the anode of the yellow LED
const int greenLED = 2;  // Pin connected to the anode of the green LED
const int blueLED = 3;   // Pin connected to the anode of the blue LED
const int phSensorPin = A0; // Pin connected to the pH meter sensor

void setup() {
  pinMode(yellowLED, OUTPUT);
  pinMode(greenLED, OUTPUT);
  pinMode(blueLED, OUTPUT);
  lcd.begin(); // Initialize the LCD
  lcd.backlight(); // Turn on the backlight
  // Display welcome message
  lcd.setCursor(0, 0);
  lcd.print("pH meter ");
  lcd.setCursor(0, 1);
  lcd.print("Arduino");
  delay(2000); // Wait for 2 seconds
  lcd.clear(); // Clear the display
  // Display group information
  lcd.setCursor(0, 0);
  lcd.print("Pend Kimia 5-A");
  lcd.setCursor(0, 1);
  lcd.print("Kelompok 07");
  delay(2000); // Wait for 2 seconds
  lcd.clear(); // Clear the display
  // Display motivational message
  lcd.setCursor(0, 0);
  lcd.print("Semangat");
  delay(2000); // Wait for 2 seconds
  lcd.clear(); // Clear the display
}

void loop() {
  int phValue = analogRead(phSensorPin); // Read the pH sensor value
  float voltage = phValue * (5.0 / 1023.0); // Convert to voltage
  float ph = 7 - ((2.5 - voltage) / 0.18); // Calculate pH value
  // Display the pH value on the LCD
  lcd.setCursor(0, 0);
  lcd.print("pH: ");
  lcd.print(ph);
  // Control the LEDs based on the pH value
  if (ph < 5) {
    digitalWrite(yellowLED, HIGH);
    digitalWrite(greenLED, LOW);
    digitalWrite(blueLED, LOW);
  } else if (ph >= 5 && ph <= 8) {
    digitalWrite(yellowLED, LOW);
    digitalWrite(greenLED, HIGH);
    digitalWrite(blueLED, LOW);
  } else {
    digitalWrite(yellowLED, LOW);
    digitalWrite(greenLED, LOW);
    digitalWrite(blueLED, HIGH);
  }
  delay(1000); // Wait for 1 second before the next reading
}

This code is responsible for initializing the system, reading the pH sensor data, calculating the pH value, displaying the value on the LCD, and controlling the LEDs based on the pH level. It also includes a startup sequence with welcome and group messages.