Is there a way to change the value of water level sensor to cm?


I am using a simple level sensor. It's easy to read the analog value of the sensor, and now I'm going to change it to cm to see this value accurately.
Is there a calculation method that changes the value of this sensor in cm?

Thank you.


May you continuously output the analogRead() value while actually submerging the sensor in water.
And mesurement value and calculate the conversion linear function parameter by yourself from the amount of change.

But I don't think this sensor will continue to provide such reliable measurements. :roll_eyes:

I believe those sensors are go no go (alarm, no alarm) water sensors.

Post your sketch to see how we can help.

No. What you want to do is to calibrate your sensor. Start with the very end tip in the water. Record the analog value. Then add water to raise the level 1 cm. and record the value. Continue this process until the water gets to the top of the sensor.
Now you have all the analog values that correspond to 1cm changes.
You can put all the analog value in an array (table) and look up a matching value and the entry number +1 will give you the depth in cm.

1 Like

And of course you do realise that this toy will not function with continuous exposure to water - particularly salty water - for more that a few days, do you not? :face_with_raised_eyebrow:

One more point besides the sensor not last very long under continuous use due to electrolysis: Another variable to worry about is whether the salt content will remain the same. Even carbon dioxide from the air changes the resistivity/conductance of pure water on standing, due to carbon dioxide equilibria in water. Of course, if the water has a very high salt content already, then the CO2 equilibria is likely not an issue.

This kind of sensor is not good for depth sensor. It should be used only for ON OFF detecting. For water depth you will need a pressure sensor like MPX5010DP

Or for up to 2 metres and with acceptable environment conditions, the time of flight sensor.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.