Water level sensor

The red water level sensor from starter kits: ten bare traces up a long board and three pins printed S + -. Aliases: water sensor, liquid level sensor.

Half the traces are tied to the supply and the other half, between them, go to the base of an NPN transistor whose emitter is S. Dry, nothing reaches the base and S sits at ground. Dip the bottom of the board in water and the water joins the two sets of traces, a little current flows into the base, and the transistor follows it as an emitter follower. It is an analog output with no comparator, read with analogRead.

Pins

Pin What it does
S The reading: 0 dry, rising with the depth of water.
VCC Supply, 3 V to 5 V. Printed +.
GND Ground. Printed -.

Properties

full is the fraction of the supply S reaches with the traces fully under water, 0.66 by default: about 670 on a 5 V Arduino.

While it runs

Drag the slider to raise the water up the traces, 0 to 40 mm. The pins are at the top, as on the real board, so the jumpers leave upwards and the slider is underneath.

What the model gets right

The shape of the reading. A real one jumps the moment the tip touches the water and then creeps up slowly, because the first millimeter of wet trace turns the transistor on and every millimeter after it only adds a little more base current. The model is that curve: a third of the way up at 3 mm, half at 5 mm, and the top at 40 mm.

What it does not model

The top reading and the curve are typical, not a measurement. A real one moves a lot with how conductive the water is, which is why this is a level indicator and not a gauge. Corrosion is not modeled: like the rain plate, a board powered all the time in water plates itself away, and the advice is to power it from a pin only to take a reading. Nor is the film of water left on the traces after it is lifted out, which keeps a real one reading for a while. S comes out through 100 ohms.

Common mistakes

Reading the number as millimeters. Calibrate it against a ruler in your own water, and expect the top half of the board to tell you very little.

See it in action

Plant monitor reads the water level beside a soil sensor and a rain sensor. Open it at /templates.