Please see my post about the improved level sensor here.
One of the daily chores of aquarium keepers is adding water to the tank to compensate for evaporation. For reef aquariums with intense lighting, the amount of evaporation can be substantial. In my 5 gallon nano-reef, I add 1-2 cups every day. This task is not only boring and repetitive, it is also stressful for the aquarium. The sudden change in salinity of adding 1-2 cups (or 2-4 cups, if I forgot a day) is bad for the tank inhabitants. The solution is to design an automatic top-off system. Here's how I did it:
I built a non-metallic water level sensor from two plastic fiberoptic cables and some spare plastic parts. The ends of the fiberoptics are directed towards each other at about a 60* total angle. The imaginary point of intersection is a few mm in front of the sensor head. The sensor works by sending light out one fiberoptic and sensing how much light returns via the other. When the water level is within 1cm of the sensor head, the amount of light returned is very high since the surface of the water is a good reflector. As soon as the water rises above the sensor head, the amount of returned light drops to near-zero.
This sensor works very well with only one problem: bubbles. If air bubbles start to collect on the fiberoptic ends, they can reflect enough light to cause a false-positive even when the sensor is underwater. I modfied the sensor after taking this photo by cutting away excess material, and making the fiber ends more flush with the sensor's plastic. So far, these modifications seemed to have worked very well.
The sensor is mounted on the aquarium's rim. The white plastic adjustment screw locks the sensor in place after moving it to the desired water level.
The light sending/receiving is accomplished with an off-the-shelf part. It's a Keyence FS-V11. These are used in factories to sense the status of parts on a conveyor belt, etc. It's a very cool little device, and is adjustable to have a custom light/dark threshold. The Keyence's output drives a solid-state relay, which controls power to the outlet. The outlet supplies power to a small water pump (Aqua-lifter AW20) that draws water out of a store-bought container, and drips it into the aquarium. The pump is slow, which is good, since it will affect the tank's salinity gradually.
Interestingly, the sensor has a sort of built-in hysteresis. The water forms a meniscus with the sensor head, and as the level drops, the meniscus keeps the sensor submerged as the level drops below the sensor head. Finally, the meniscus breaks, and the sensor "sees" the water surface. The pump is activated, and the level rises until it meets the sensor head. This provides a nice on/off cycle action.