Float switch (reed, vertical)
Reed float switch wiring with INPUT_PULLUP, normally-open vs normally-closed, mounting for overhead tanks and sumps, and its tiny contact rating.
Community draft — report a mistake
3.3 V or 5 V? It's just a switch. Wire one lead to a GPIO with INPUT_PULLUP and the other to GND — works on every board at any logic level.
A float switch is a magnet in a floating ring sliding on a stem that holds a reed switch. When the water lifts the float past the reed, the contact closes (or opens, depending on how the float is mounted).
It’s the most reliable, cheapest way to know “tank full” or “sump empty” — no corrosion like resistive probes, no echoes like ultrasonic sensors. Use two: one near the top for overflow, one near the bottom for dry-run protection.
Signal only. Its contact is tiny. The microcontroller reads it and decides; any pump is switched through a relay module driving a contactor.
Prices are indicative (Oct 2026) and vary by seller.
Pinout
| Pin | What it does |
|---|---|
WIRE 1 | One side of the reed contact — to the GPIO |
WIRE 2 | Other side of the reed contact — to GND |
Common errors
Reading is reversed
Flip the float on its stem to change normally-open to normally-closed, or invert in code.
Random triggers when the pump starts
Long wires pick up noise. Use INPUT_PULLUP plus a 10 kΩ external pull-up, a 100 nF capacitor to GND, and debounce in code.
Switch welded shut after wiring it to the pump
The reed contact is rated for signals (around 10 W). Never switch a pump or any mains load through it — it only tells the microcontroller the level.