At first I wanted to use S2GO RADAR BGT60LTR11 to calculate the water level, but what I got was Bundle A kit. Bundle A includes PSoC™ 6 Wi-Fi BT prototyping kit and three magnetic sensors.
If I did it empirically, I could use PSoC™ 6's CAPSENSE™, but there are already many related projects implemented. So I chose another unorthodox way to implement water level detection.
"Calculating Water Level Height Using Angle Sensors"
Trigonometry tells us that the sine is the ratio of the side opposite to the hypotenuse of an angle. Now that I have the angle sensor, as long as I have an object of fixed length and can float on the water, I can calculate the change of the water level.
As shown below. The water level change equation is R(sin(68.2) - sin(21)).
ROTATE KNOB ANGLE 2GO
Stick
Empty pill box
Double sided tape
Arduino IDE
CodePlease refer to github.
The only thing that needs attention is Arduino sin function use angle in radians but read from TLI5012B is degrees. Need to convert.
DemoDue to space constraints, I only used a small water basin for testing.
Keynote0 degrees must be parallel to the water surface.
Comments