Water-Level Alarm

A float switch detects a chosen water level and activates a buzzer and warning LED.

← All project briefs

Safety and scope

Keep mains voltage away from the water rig. Any real pump or mains switching must be designed and installed by a qualified person using correctly rated protective equipment.

Plan, predict and test

Suggested virtual study time: about 15 minutes. This is a planning estimate, not a validated construction time.

Preparation: Foundation electricity and basic programming logic. Adult supervision for children. Review a foundation lesson ↗

Use paper, a spreadsheet or a simulator. This is not a verified physical assembly guide.

  1. Scenario: Use a dry virtual switch for low and high level; include an open-wire fault.
  2. Expected result: Identify whether the alarm can distinguish normal level from a disconnected wire.
  3. Checkpoint: Write your prediction, test it in the virtual model and explain any difference.

Knowledge check

Does one normally-open switch reliably detect a broken wire?

A correct answer does not certify the physical system.

Record your validation

Use only virtual inputs and indicators until the actual components, pinouts and electrical limits have been verified.

CaseWhat to record
Normal inputD2 LOW → alarm ON; HIGH → alarm OFF
BoundarySwitch transition → next loop updates alarm
Missing or invalid inputOpen wire reads HIGH with pull-up and can hide an alarm. This example is not fail-safe.
Repeat testRepeat the virtual test, record the actual output and compare with the expected result.

These are test-planning requirements, not recorded hardware results.

Before building: understand the listed components and the relevant low-voltage safety rules. This is a concept brief, not a tested assembly manual.

What it does

Teach digital inputs, pull-ups, threshold events and the difference between sensing and switching a load.

Engineering principle

A float switch changes its contact state as buoyancy moves the float. The contact can be wired to a microcontroller input with a pull-up arrangement. When the switch indicates the target level, the controller activates an LED and active buzzer. An optional relay stage can control a pump, but that is a separate power-control design.

Hardware and components

  • Arduino Uno or NanoReads the switch state and triggers the alarm.
  • Float switchChanges contact state at the chosen liquid level.
  • Active buzzerProduces the audible alarm.
  • LED and current-limiting resistorProvide a visual warning.
  • Optional relay moduleCan switch a properly designed pump-control circuit; it is not a substitute for a correctly rated contactor and protection.

Suggested build sequence

  1. Choose whether the switch is normally open or normally closed and test it with a multimeter.
  2. Mount the float at the required alarm level.
  3. Connect it to a digital input using a defined pull-up or pull-down arrangement.
  4. Debounce or filter the switch state and activate the buzzer/LED when the level event occurs.
  5. Test the alarm with a safe low-voltage water rig before considering pump control.

Learning outcomes

  • Digital input wiring
  • Switch-state logic
  • Pull-up resistors and debounce
  • Alarm output control

Possible upgrades

Add multiple level points, event logging or pump interlocks for a supervised low-voltage demonstrator.

Practice the core principle

This simplified exercise is not the full physical project shown above. Test in simulation first; verify real hardware against its datasheet. Children need adult supervision.

Reference components

  • Arduino Uno
  • Pushbutton (dry simulation)
  • LED
  • 330 Ω resistor

Connection plan

  • D2 → pushbutton → GND (simulated level switch)
  • D8 → LED via 330 Ω
  • LED cathode → GND

Reference sketch

const int level=2, alarm=8;
void setup(){
  pinMode(level,INPUT_PULLUP);
  pinMode(alarm,OUTPUT);
}
void loop(){
  bool highLevel=digitalRead(level)==LOW;
  digitalWrite(alarm,highLevel?HIGH:LOW);
  delay(50);
}

How the code works

  1. INPUT_PULLUP keeps input HIGH when the switch is open.
  2. A closed switch reads LOW.
  3. The output mirrors the simulated high-level state.

Practice sequence

  1. Use a dry pushbutton simulation; do not put exposed powered wires in water.
  2. Wire the switch to ground and indicator through resistor.
  3. Test open and closed states.
  4. Discuss appropriate isolated sensing for an actual tank separately.

Expected result

LED illuminates when the simulated switch closes.

Troubleshooting

Check pull-up mode and common ground.

Independent challenge

Add a second virtual switch representing a lower level.

Related briefs