পানি ছাড়া ট্যাংকের লেভেল (ultrasonic + অটো ফিল)Contactless Water Tank Level with Arduino (Ultrasonic + Auto Refill)
Ultrasonic sensor ট্যাংকের ঢাকনায় ঝুলে পানির উপরের ফাঁকা জায়গা মাপে — পানিতে কিছু ডোবে না, তাই মরচে ধরার সুযোগ নেই। লেভেল % = ১০০ মাইনাস ফাঁকা সেন্টিমিটার; ২০% এর নিচে নামলে relay pump চালু করে, ৯০% পার হলে থামায়।
The ultrasonic sensor hangs on the tank lid and measures the empty space above the water — nothing rusts in the water. Level % = 100 minus the empty centimetres; below 20% a relay starts the pump and above 90% it stops.
সার্কিট ডায়াগ্রাম · Circuit diagram
যা যা লাগবে · Parts you need
- 1 × Arduino Uno Arduino Uno
- 1 × Ultrasonic distance sensor (HC-SR04) আল্ট্রাসনিক দূরত্ব সেন্সর (HC-SR04)
- 1 × LCD 16x2 with I2C LCD ১৬x২ (I2C)
- 1 × Relay module (5V, 1 channel) রিলে মডিউল (5V, ১ চ্যানেল)
- 1 × Mini water pump (3–6V) ছোট পানির পাম্প (৩–৬V)
- 1 × Resistor 220Ω Resistor
- 1 × LED (red) LED বাতি
- 17 × Jumper wires জাম্পার তার
তার লাগানো · Wiring
| Ultrasonic distance sensor (HC-SR04) VCC | → | Arduino Uno 5V |
| Ultrasonic distance sensor (HC-SR04) GND | → | Arduino Uno GND |
| Ultrasonic distance sensor (HC-SR04) TRIG | → | Arduino Uno D9 |
| Ultrasonic distance sensor (HC-SR04) ECHO | → | Arduino Uno D10 |
| LCD 16x2 with I2C VCC | → | Arduino Uno 5V |
| LCD 16x2 with I2C GND | → | Arduino Uno GND |
| LCD 16x2 with I2C SDA | → | Arduino Uno A4 |
| LCD 16x2 with I2C SCL | → | Arduino Uno A5 |
| Relay module (5V, 1 channel) VCC | → | Arduino Uno 5V |
| Relay module (5V, 1 channel) GND | → | Arduino Uno GND |
| Relay module (5V, 1 channel) IN | → | Arduino Uno D7 |
| Relay module (5V, 1 channel) COM | → | Arduino Uno 5V |
| Relay module (5V, 1 channel) NO | → | Mini water pump (3–6V) + |
| Mini water pump (3–6V) - | → | Arduino Uno GND.3 |
| Arduino Uno D4 | → | Resistor a |
| Resistor b | → | LED A |
| LED K | → | Arduino Uno GND.3 |
Code (Arduino C++)
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Contactless tank level: the HC-SR04 sits on the lid of a closed tank and
// measures the EMPTY space above the water, so nothing rusts in the water.
// Level % = 100 - empty cm (for a 100 cm tank). Below 20% the pump refills
// through a relay until 90% — the same hysteresis trick as the smart irrigation.
LiquidCrystal_I2C lcd(0x27, 16, 2);
const int trig = 9, echo = 10, relayPin = 7, lowLed = 4;
bool filling = false;
void setup() {
pinMode(trig, OUTPUT);
pinMode(echo, INPUT);
pinMode(relayPin, OUTPUT);
pinMode(lowLed, OUTPUT);
lcd.init();
lcd.backlight();
Serial.begin(9600);
}
void loop() {
digitalWrite(trig, LOW); delayMicroseconds(2);
digitalWrite(trig, HIGH); delayMicroseconds(10);
digitalWrite(trig, LOW);
long d = pulseIn(echo, HIGH) / 58; // cm of empty space
int pct = constrain(100 - (int)d, 0, 100);
if (!filling && pct < 20) { filling = true; Serial.println("PUMP ON"); }
if (filling && pct > 90) { filling = false; Serial.println("PUMP OFF"); }
digitalWrite(relayPin, filling ? HIGH : LOW);
digitalWrite(lowLed, pct < 20 ? HIGH : LOW);
lcd.setCursor(0, 0); lcd.print("Tank: "); lcd.print(pct); lcd.print("% ");
lcd.setCursor(0, 1); lcd.print(filling ? "Filling... " : "OK ");
Serial.print("Level: "); Serial.println(pct);
delay(300);
}
আরো project · More projects
- Blink: তোমার প্রথম programBlink: your first program
- ঘনত্ব অনুযায়ী ট্রাফিক সিগন্যাল (কার অনুযায়ী সবুজ)Density-based traffic signal (green time follows the queue)
- GPS জিওফেন্স এলার্ম (পোষা প্রাণী বা সাইকেলের জন্য)GPS geofence alert (pet collar / bike tracker)
- স্মার্ট ডোরবেল: দুই সুরের ঘণ্টাSmart doorbell with a two-tone chime