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.
- Scenario: Use a dry virtual switch for low and high level; include an open-wire fault.
- Expected result: Identify whether the alarm can distinguish normal level from a disconnected wire.
- Checkpoint: Write your prediction, test it in the virtual model and explain any difference.
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.
| Case | What to record |
|---|---|
| Normal input | D2 LOW → alarm ON; HIGH → alarm OFF |
| Boundary | Switch transition → next loop updates alarm |
| Missing or invalid input | Open wire reads HIGH with pull-up and can hide an alarm. This example is not fail-safe. |
| Repeat test | Repeat 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
- Choose whether the switch is normally open or normally closed and test it with a multimeter.
- Mount the float at the required alarm level.
- Connect it to a digital input using a defined pull-up or pull-down arrangement.
- Debounce or filter the switch state and activate the buzzer/LED when the level event occurs.
- 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
- INPUT_PULLUP keeps input HIGH when the switch is open.
- A closed switch reads LOW.
- The output mirrors the simulated high-level state.
Practice sequence
- Use a dry pushbutton simulation; do not put exposed powered wires in water.
- Wire the switch to ground and indicator through resistor.
- Test open and closed states.
- 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.