Float switch

A float level switch: a reed switch in a stem and a magnet in a float, which closes the reed when the water lifts it.

A plastic float on a sealed stem. Aliases: float sensor, water level switch, liquid level switch, tank level switch, sump switch, ZP4510, side-mount float switch.

Pins

Pin What it does
1 One wire of the reed switch.
2 The other. Which is which does not matter.

Wire it like a button: one wire to a pin with INPUT_PULLUP, the other to ground.

Properties

model is vertical (the stem kind most kits have, through the lid or the bottom of the tank) or horizontal (the side-mount kind with a hinged float). Electrically they are the same reed; the choice draws the right one.

contact is NO or NC. As shipped the switch is normally open: open with the float hanging down (dry), closed when the water lifts it. The listings say "it can be easily converted from normally open to normally closed by inverting the float": take the clip off and turn the float over on the stem. A side-mount one is reversed by mounting it the other way up. NC is that.

level is the starting water level in millimeters, 0 to 60. The slider on the part moves it; the float switches at 30 mm.

What the model gets right

A reed switch: closed, the two wires are a few milliohms apart; open, nothing passes. Normally open by default, and reversed with the float turned over, as the common listings describe.

What it does not model

The contact rating. The ZP4510 listings give 10 W at most, switching 100 V DC and 0.5 A, carrying 1.0 A, breakdown 220 V DC. That is a signal contact: a pump belongs on a relay or a MOSFET, never straight through the float. Here the switch passes whatever the circuit asks, where a real one welds shut or burns open.

Also not modeled: the few millimeters between where a float switches rising and where it switches falling, the chatter that waves and ripples make right at the switching level, and reed bounce. The switching point is one level, the middle of the scale; the listings do not give it to the millimeter, and it moves with the liquid's density.

Common mistakes

Running a pump through it. Half an amp at most; use a relay.

Forgetting which way around the float is. If the alarm sounds when the tank is empty, the float is upside down for your sketch: turn it over, or swap HIGH and LOW.

Acting on every change. Water slops about at the switching level; a sketch should wait for the reading to hold before it sounds an alarm or starts a pump.

See it in action

Sump alarm sounds a buzzer and lights a red LED when the water lifts the float. Open it at /templates.

The water level controller uses two, a low mark and a high mark, to fill a tank with a pump on a relay, and stops on a stuck float or a dry run.