Tekko BDSimSimulatorProjects

পানি ছাড়া ট্যাংকের লেভেল (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.

▶ ফ্রি চালিয়ে দেখো / Run it free Parts অর্ডার করো (WhatsApp)

সার্কিট ডায়াগ্রাম · Circuit diagram

Contactless Water Tank Level with Arduino (Ultrasonic + Auto Refill) circuit diagram — Arduino Uno, Ultrasonic distance sensor (HC-SR04), LCD 16x2 with I2C, Relay module (5V, 1 channel), Mini water pump (3–6V), Resistor 220Ω, LED (red), Jumper wires

যা যা লাগবে · Parts you need

তার লাগানো · 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