Smart Tank Level & Volume Monitoring System. Built with advanced signal processing and precise geometric modeling for horizontal cylindrical tanks.
Eliminates sensor noise via a 7-sample Median Filter and dampens liquid surface ripples using an Exponential Moving Average (EMA) algorithm.
Calculates exact, non-linear volume in horizontal cylinders using the circular segment area formula:
Area = R² · cos&sp;¹((R-h)/R) - (R-h)√(2Rh-h²)
Employs custom clampf and maxf functions to filter out-of-bounds ultrasonic readings, preventing mathematical errors and system crashes.
Provides live monitoring of height (cm) and fill percentage (%) via an I2C 16x2 LCD display, with easily configurable tank dimensions in the source code.
Trig → Pin 9 | Echo → Pin 8 | LCD SDA → A4 | LCD SCL → A5
0.28 for optimized balance between responsiveness and stability.