টিডিএস পানির বিশুদ্ধতা পরীক্ষকTDS Water Purity Tester with Arduino (TDS Probe + LCD)
TDS module এর AO পিনে দ্রবীভূত কঠিন পদার্থের সাথে supply এর ভগ্নাংশ বাড়ে, তাই sketch টা analogRead গড় করে volt কে ppm এ ফেরত নিয়ে ব্যান্ডের সাথে মিলিয়ে দেখে। Button চাপলে খাওয়ার পানির ব্যান্ড (~500 ppm এর নিচে) আর মাছের পানির ব্যান্ড (~1000 ppm এর নিচে) বদলায়।
The TDS module's AO pin holds a fraction of the 5 V supply that rises with dissolved solids, so the sketch averages analogRead, converts volts back to ppm and judges the water against a band. The button flips between a drinking band (under ~500 ppm) and a fish-tank band (under ~1000 ppm).
সার্কিট ডায়াগ্রাম · Circuit diagram
যা যা লাগবে · Parts you need
- 1 × Arduino Uno R3 Arduino Uno
- 1 × TDS water quality sensor TDS পানির মানের সেন্সর
- 1 × LCD 16x2 with I2C LCD ১৬x২ (I2C)
- 1 × Push button চাপ-বাটন
- 9 × Jumper wires জাম্পার তার
তার লাগানো · Wiring
| TDS water quality sensor VCC | → | Arduino Uno R3 5V |
| TDS water quality sensor GND | → | Arduino Uno R3 GND |
| TDS water quality sensor 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 |
| Push button 1 | → | Arduino Uno R3 D2 |
| Push button 2 | → | Arduino Uno R3 GND |
Code (Arduino C++)
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
// TDS water purity tester: the probe's AO pin holds a fraction of the 5 V
// supply - about 0.05 x supply at 0 ppm rising to 0.95 x supply at 1000 ppm.
// The sketch averages the reading, turns it back into ppm, and judges it
// against a band you pick with the button: drinking water (under ~500 ppm) or
// a fish tank (under ~1000 ppm). These are rough demo bands, not a lab
// certificate - the probe cannot say WHICH solids are dissolved.
const int PROBE = A0, BUTTON = 2;
bool fishMode = false, lastBtn = false; // lastBtn tracks "was pressed"
float readPpm() {
long sum = 0;
for (int i = 0; i < 8; i++) { sum += analogRead(PROBE); delay(2); }
float v = (sum / 8.0) * (5.0 / 1023.0); // average the samples -> volts
float ppm = (v - 0.25) / 4.5 * 1000.0; // 0.25 V = 0 ppm, 4.75 V = 1000 ppm
if (ppm < 0) ppm = 0;
return ppm;
}
void setup() {
pinMode(BUTTON, INPUT_PULLUP);
lcd.init();
lcd.backlight();
Serial.begin(9600);
}
void loop() {
bool btn = digitalRead(BUTTON) == LOW;
if (btn && !lastBtn) fishMode = !fishMode; // one press = one band change
lastBtn = btn;
float ppm = readPpm();
lcd.setCursor(0, 0);
lcd.print("TDS: "); lcd.print((int)ppm); lcd.print(" ppm ");
lcd.setCursor(0, 1);
if (fishMode) lcd.print(ppm < 1000 ? "Fish OK <1000 " : "Too hard >1000 ");
else lcd.print(ppm < 500 ? "Drink OK <500 " : "NOT drinkable ");
Serial.print(ppm, 0);
Serial.println(fishMode ? " ppm (fish band <1000)" : " ppm (drink band <500)");
delay(300);
}