Smart Water Level Monitoring & Auto Switch System
Real-Time Percentage Scaling, SSD1306 OLED UI & Automated Buzzer Control
This automated water monitoring station utilizes an analog fluid sensor to translate raw resistive metrics into an exactly constrained 0–100% capacity range. The processing unit constantly tracks this scaling data against a defined threshold boundary to execute safety switch routines. Visual metrics stream directly to a monochrome SSD1306 OLED interface framework.
Procure the following core components to deploy this precision safety switch project prototype:
| Target Component Label | Structural Allocation Quantity | Functional Deployment Purpose |
|---|---|---|
| Arduino UNO / Nano | 1 Unit | Main microcontroller unit processing ADC metrics and handling device constraints. |
| Analog Water Level Sensor | 1 Unit | Tracks liquid presence via trace resistance lines to compute relative fluid volume. |
| SSD1306 OLED Display (I2C) | 1 Unit | Renders the local graphical control interface header, system percentage, and switch state. |
| LED | 1 Unit | Visual system indicator representing the current automated switch output power state. |
| Buzzer | 1 Unit | Generates auditory notification frequencies during threshold violations. |
| Connecting Wires & Resistors | 1 Set | Signal transmission jumpers and system current-limiting infrastructure. |
Wire your hardware prototype precisely matching these designated digital and analog configuration pins:
| Sensor / Module Output Pin | Arduino Target Pin Mapping | Functional Context |
|---|---|---|
| Water Sensor Signal | Analog Input Pin A0 | Raw ADC value data stream path |
| LED Positive (Anode) | Digital Output Pin 13 | Automated switch status light |
| Buzzer Positive Pin | Digital Output Pin 8 | High-frequency alarm output line |
| OLED Display SDA | I2C Data Pin SDA | Serial data packet transfer channel |
| OLED Display SCL | I2C Clock Pin SCL | Serial sync clock timing line |
Copy and flash this highly efficient firmware directly onto your target hardware platform via the Arduino IDE workspace:
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
const int waterLevelPin = A0;
const int ledPin = 13;
const int buzzerPin = 8;
// Switch Threshold percentage mein (Yaani 35% se upar paani jayega toh ON hoga)
const int switchThresholdPercent = 35;
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(buzzerPin, OUTPUT);
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
for(;;);
}
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(10, 20);
display.print("OLED WATER SWITCH");
display.setCursor(20, 40);
display.print("System Ready...");
display.display();
delay(2000);
}
void loop() {
int sensorValue = analogRead(waterLevelPin);
// RAW VALUE KO 0-100% MEIN CONVERT KARNE KA FORMULA
int waterPercent = (sensorValue / 1023.0) * 100;
waterPercent = constrain(waterPercent, 0, 100); // Safety limit
display.clearDisplay();
// Header Title
display.setTextSize(1);
display.setCursor(0, 0);
display.print("--- WATER SYSTEM ---");
// Show Percentage Value
display.setCursor(0, 22);
display.print("Water Level: ");
display.setTextSize(2);
display.print(waterPercent);
display.print("%");
// Switch Status Logic (Ab percentage ke mutabiq chalega)
display.setTextSize(1);
display.setCursor(0, 48);
if (waterPercent > switchThresholdPercent) {
digitalWrite(ledPin, HIGH);
digitalWrite(buzzerPin, HIGH);
display.print("SWITCH STATUS: ON ");
} else {
digitalWrite(ledPin, LOW);
digitalWrite(buzzerPin, LOW);
display.print("SWITCH STATUS: OFF");
}
display.display();
delay(500); // Sampling interval debounce
}
Adafruit GFX Library and Adafruit SSD1306 Library in your Arduino IDE Library Manager prior to compiling and deploying.

0 Comments