ল্যাবের ডিজিটাল pH মিটারDigital pH Meter with Arduino and LCD (pH Probe)
pH বোর্ডটা AO তে absolute voltage দেয় — pH 7 এ প্রায় 2.5 V, প্রতি pH ধাপে 0.18 V — তাই sketch টা volt কে সরাসরি pH এ ফেরত নেয়। Potentiometer টা আসল pen এর buffer solution দিয়ে করা two-point calibration: মাঝে রাখলে কিছু যোগ হয় না, ঘোরালে দেখানো pH এদিক-ওদিক সরে।
The pH board drives AO with an absolute voltage — about 2.5 V at pH 7, moving 0.18 V per pH step — so the sketch maps volts straight back to pH. The potentiometer stands in for the two-point calibration a real pen gets against buffer solutions: centred it adds nothing, turning it shifts the displayed pH.
সার্কিট ডায়াগ্রাম · Circuit diagram
যা যা লাগবে · Parts you need
- 1 × Arduino Uno R3 Arduino Uno
- 1 × PH sensor module PH সেন্সর মডিউল
- 1 × LCD 16x2 with I2C LCD ১৬x২ (I2C)
- 1 × Knob (potentiometer) নব (Potentiometer)
- 10 × Jumper wires জাম্পার তার
তার লাগানো · Wiring
| PH sensor module VCC | → | Arduino Uno R3 5V |
| PH sensor module GND | → | Arduino Uno R3 GND |
| PH sensor module AO | → | Arduino Uno R3 A0 |
| LCD 16x2 with I2C VCC | → | Arduino Uno R3 5V |
| LCD 16x2 with I2C GND | → | Arduino Uno R3 GND |
| LCD 16x2 with I2C SDA | → | Arduino Uno R3 A4 |
| LCD 16x2 with I2C SCL | → | Arduino Uno R3 A5 |
| Arduino Uno R3 5V | → | Knob (potentiometer) 1 |
| Knob (potentiometer) 2 | → | Arduino Uno R3 GND |
| Knob (potentiometer) W | → | Arduino Uno R3 A1 |
Code (Arduino C++)
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
// Digital pH meter for the lab: the probe's AO is an ABSOLUTE voltage - about
// 2.5 V at neutral pH 7, moving 0.18 V per pH step (acid higher, alkali
// lower) - so the sketch maps volts straight back to pH. The knob is the
// two-point calibration trim every real pen gets against buffer solutions:
// centred it adds nothing, turning it shifts the displayed pH up or down. The
// verdict line calls the liquid acidic, neutral or basic around the classic
// 6.5 - 7.5 band.
const int PROBE = A0, CAL = A1;
float readPh() {
float v = analogRead(PROBE) * (5.0 / 1023.0);
float ph = 7.0 + (2.5 - v) / 0.18; // probe volts -> pH
float trim = (analogRead(CAL) * (5.0 / 1023.0) - 2.5) / 0.18; // knob -> pH offset
ph += trim;
if (ph < 0) ph = 0;
if (ph > 14) ph = 14;
return ph;
}
void setup() {
lcd.init();
lcd.backlight();
Serial.begin(9600);
}
void loop() {
float ph = readPh();
String verdict = "NEUTRAL";
if (ph < 6.5) verdict = "ACIDIC";
if (ph > 7.5) verdict = "BASIC";
lcd.setCursor(0, 0);
lcd.print("pH: "); lcd.print(ph, 2); lcd.print(" ");
lcd.setCursor(0, 1);
lcd.print(verdict);
lcd.print(" ");
Serial.print("pH: "); Serial.print(ph, 2);
Serial.print(" -> "); Serial.println(verdict);
delay(300);
}