Electronics and water don't usually mix - which is why liquid level sensing projects can be a little challenging. You can DIY a sensor but keeping it clean and un-oxidized can be a pain. The Optomax Digital liquid level switches are a clever solution for when you need a small sensor to detect liquid/water: super easy to use and very durable too!
Inside the plastic sensor casing is an infrared (IR) LED and matching photo transistor. When in the open air, the IR light bounces back to the sensor so you know its nice and dry. When the sensing tip is immersed in liquid, the IR light escapes, and the transistor turns off. The sensor can detect the presence or absence of almost any liquid type; oil or water based. It is insensitive to ambient light and is not affected by foam when in air or by small bubbles when in liquid.
The microcontroller-friendly logic level output is push-pull type, and can sink and source up to 100mA at a supply voltage range of 4.5 to 15.4VDC - so you can even use it to directly control a transistor or perhaps even a small relay.
Simply connect the Blue/Black wire to ground, the Red wire to 4.5-15.4VDC and look at the output with your multimeter or microcontroller. When dry the output is the same as the red wire. When wet, the output is 0V. Note they're pretty sensitive, any liquid on the sensor (e.g. droplets on the surface) can trigger it.
Comes in a chemically resistant Polysulfone housing material – the standard choice for most applications – for external sensor mounting and for use in standard operating temperature ranges (-25 to 80°C).
Wire length (not including sensor): ~240mm / ~9.5"