I am trying to measure the height of water inside a column. The column is 50mm in dia and 304mm long. I have mounted the sensor just above the column.
To measure the accuracy of the sensor, I filled the column up to a known value (a) and got the average sensor reading (b). a+b should give me the height of the sensor from the base of the column.
Repeating this for different values of a, I got very different values for (a+b). see attached chart.
My question is
- Is the sensor expected to have error of this order?
- Is my setup of confining the sensor through a column producing such errors.
- Any other ideas to get the water column height. Please note that during the actual test, the water inside will be oscillating (up and down).I am thinking of making a capacitive sensor using aluminium foil. Water will work as the dielectric and the level of water will determine the capacitance.
P.S. I also did some open tests (not through a column) to get the distance of a fixed object, and it was quite accurate.
Any help is appreciated.
Arduino Code
#include <NewPing.h>
#define TRIGGER_PIN 7 // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define ECHO_PIN 8 // Arduino pin tied to echo pin on the ultrasonic sensor.
#define MAX_DISTANCE 200 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.
double DB_ROUNDTRIP_CM = 57.0;
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance.
void setup() {
Serial.begin(9600); // Open serial monitor at 115200 baud to see ping results.
}
void loop() {
delay(100);
unsigned int uS = sonar.ping();
double d = uS / DB_ROUNDTRIP_CM;
Serial.println(d);
}