Parts list
| Part | Qty | Approx. | Buy |
|---|---|---|---|
| Arduino Uno R3 (CH340 clone) | 1 | ₹450 | Buy Arduino Uno R3 (CH340 clone) |
| Side-mount float switch (PP) | 1 | ₹120 | Buy Side-mount float switch (PP) |
| Active buzzer module (or a 12 V hooter via a relay) | 1 | ₹25 | Buy Active buzzer module (or a 12 V hooter via a relay) |
| 2-core cable to the tank (length as needed) | 1 | ₹150 | Buy 2-core cable to the tank (length as needed) |
| 9 V 1 A adapter | 1 | ₹150 | Buy 9 V 1 A adapter |
| Total | ₹895 |
Affiliate disclosure: “Buy” links may earn FlashReady a small commission at no extra cost to you. Prices are indicative.
Wiring
| Arduino Uno R3 | Part · pin | Wire | Notes |
|---|---|---|---|
| D2 | Float switch (reed, vertical) · WIRE 1 | green | INPUT_PULLUP — no external resistor needed |
| GND | Float switch (reed, vertical) · WIRE 2 | black | |
| D8 | Active buzzer module (high-level trigger) · I/O | orange | |
| 5V | Active buzzer module (high-level trigger) · VCC | red | |
| GND | Active buzzer module (high-level trigger) · GND | black |
Board quirks: Fit the float a few centimetres below the overflow pipe so the alarm sounds before water is wasted. The float switch is just a contact, so long cable to the terrace is fine — but run it away from mains wires and add a 100 nF capacitor from D2 to GND at the Uno if you see false alarms. Some float switches close when the float rises, others open. The sketch expects closed = full. If yours is the other way, flip the float over (most side-mount types are reversible) or invert the test.
Code
// Tank overflow alarm — Arduino Uno R3 + float switch + buzzer module
// Float switch between D2 and GND (closes when the water lifts the float), buzzer module on D8.
constexpr uint8_t FLOAT_PIN = 2;
constexpr uint8_t BUZZER_PIN = 8; // buzzer module I/O (high = on)
constexpr unsigned long CONFIRM_MS = 2000; // ignore splashes shorter than 2 s
unsigned long fullSince = 0;
void setup() {
pinMode(FLOAT_PIN, INPUT_PULLUP);
pinMode(BUZZER_PIN, OUTPUT);
Serial.begin(9600);
}
void loop() {
bool full = digitalRead(FLOAT_PIN) == LOW;
if (full) {
if (fullSince == 0) fullSince = millis();
} else {
fullSince = 0;
}
if (fullSince && millis() - fullSince > CONFIRM_MS) {
// Two short beeps, then a pause — easy to recognise over a TV
for (int i = 0; i < 2; i++) {
digitalWrite(BUZZER_PIN, HIGH);
delay(150);
digitalWrite(BUZZER_PIN, LOW);
delay(150);
}
Serial.println(F("Tank FULL - switch the motor off"));
delay(700);
} else {
digitalWrite(BUZZER_PIN, LOW);
delay(100);
}
}// Tank overflow alarm — Arduino Uno R3 + float switch + buzzer module
// Float switch between D2 and GND (closes when the water lifts the float), buzzer module on D8.
constexpr uint8_t FLOAT_PIN = 2;
constexpr uint8_t BUZZER_PIN = 8; // buzzer module I/O (high = on)
constexpr unsigned long CONFIRM_MS = 2000; // ignore splashes shorter than 2 s
unsigned long fullSince = 0;
void setup() {
pinMode(FLOAT_PIN, INPUT_PULLUP);
pinMode(BUZZER_PIN, OUTPUT);
Serial.begin(9600);
}
void loop() {
bool full = digitalRead(FLOAT_PIN) == LOW;
if (full) {
if (fullSince == 0) fullSince = millis();
} else {
fullSince = 0;
}
if (fullSince && millis() - fullSince > CONFIRM_MS) {
// Two short beeps, then a pause — easy to recognise over a TV
for (int i = 0; i < 2; i++) {
digitalWrite(BUZZER_PIN, HIGH);
delay(150);
digitalWrite(BUZZER_PIN, LOW);
delay(150);
}
Serial.println(F("Tank FULL - switch the motor off"));
delay(700);
} else {
digitalWrite(BUZZER_PIN, LOW);
delay(100);
}
}Compiled for uno on avr 1.8.8 · 3 Nov 2026
How it works
In most Indian homes the motor fills the overhead tank and someone has to remember to switch it off. When they forget, water pours from the overflow pipe until a neighbour shouts. This alarm sounds a buzzer as soon as the tank is nearly full.
A float switch near the top of the tank is just a reed switch and a magnet in a float. When the water lifts the float, the contact closes. The Uno reads it on D2 with its internal pull-up, so the pin reads LOW when the tank is full.
Water sloshes while the tank fills, so a single reading isn’t trusted. The level must stay high for 2 seconds (CONFIRM_MS) before the buzzer on D8 starts beeping. It keeps beeping until the level drops again — usually when someone switches the motor off.
Nothing here touches 230 V, so it’s a safe first project. To switch the pump off automatically you need a contactor and an electrician — that’s covered in the smart pump controller project.
Troubleshooting
The alarm sounds when the tank is empty
Your switch is wired normally-closed. Flip the float upside down on its stem, or change the comparison in the sketch.
It beeps briefly when water splashes
Raise CONFIRM_MS from 2000 to 5000 so the float must stay up longer before the alarm sounds.
Nothing happens when I lift the float by hand
Measure the switch with a multimeter. If it changes, check D2 and GND at the Uno; if not, the reed switch inside is broken.
Upgrades
- Switch the pump off automatically through a relay and contactor — see the smart pump controller project.
- Add a second float at the bottom for a "tank empty" warning.
- Send an alert to your phone with an ESP32 version.



