Suggestions for aquarium water level project

I’m building an application that will sense when the tank’s water level is approaching the top and turn off the water source to the purifier. I’m thinking I could use one of these cams to sense the water level and perhaps provide an image for an email status message. I have a solenoid operated water valve that I can control from both an Arduino and raspberry pi, so the cam will be integrating with 1 of these boards.
The cam will need to work in full light and dark since the tank lighting is on a timer (Skimming over docs and other posts I thinking possibly IR, but I’m not sure how the response would be through about 6-8 mm of glass).

Will these cams fit my with my requirements? If so what product or products would you suggest?
Thanks.

Hi, can you describe exactly what you’d like to do. E.g. what feature of the cam will you use to detect the water level?

As a minimum I want the camera while looking through the glass to use image recognition to determine when the water level, the meniscus, comes into and leaves the view of the camera. I want to place the camera close to the side of tank near the top with a narrow view range. The camera will be stationary.

Oh, okay, I understand. Mmm, so, color tracking is what you want to use for this. So, the first step will be to mount the camera such that it can see the area you want to see of the tank. You need to have a fixed mounting setup.

Next, what’s the color difference between the empty tank and non empty tank? Additionally, will the lighting be constant. Color tracking won’t work well if the lighting changes a lot of if the contrast between the empty tank and non empty tank is lacking.

The aquarium lights are on a timer, so when they are on, 14 hours a day, the light is constant. The other 10 hours completely dark.

For the 10 hours of dark I could program the system to sleep, not add water, and wait for the lamps to turn back on.

When the lights are on and the camera perpendicular to the tank surface the color difference between air and water would be minimal. There is a color contrast for the for the water surface, 1-2 mm line darker than both the air and water. Would a line be enough color difference?

If the water surface line is not sufficient to trigger a color difference I could angle the camera and take advantage of the refraction difference between air and water. In this case the water would appear a rust red, since it is bending light from red rocks in the tank.

…Short Answer with a little experimentation I think I can make color tracking work.

You could use a bright colored float or a float with markers/tags on it to detect the water level, when water rises the float will show up in the cam’s view, then check if the float is detect above some xy threshold (the center of the image for example), may need a narrow FOV lens for this. Another idea detect a marker on the other side of the tank, I think when water is in the way the cam won’t be able to detect the marker due to water distortions. If that doesn’t work you could just use a mechanical float switch and have it trigger the cam.