1
$\begingroup$

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.

enter image description here

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.

enter image description here

My question is

  1. Is the sensor expected to have error of this order?
  2. Is my setup of confining the sensor through a column producing such errors.
  3. 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);
}
$\endgroup$
  • $\begingroup$ I don't understand what your X axis represents. $\endgroup$ – Mark Jun 15 '16 at 4:32
  • $\begingroup$ Sorry about it. The X-axis are the different water levels I've tested for. I have update the chart. $\endgroup$ – nightcrawler23 Jun 15 '16 at 5:45
  • 1
    $\begingroup$ I'm wondering if you might be getting standing waves in the column, like the pipe of a pipe organ. What is the frequency of your sound? $\endgroup$ – Mark Jun 15 '16 at 6:43
  • $\begingroup$ I am using a library NewPing for arduino. Not sure if the library sets the frequency by itself. I however have a delay of 100ms in loop. So that makes the frequency 10Hz. I have added the code. $\endgroup$ – nightcrawler23 Jun 16 '16 at 2:39
1
$\begingroup$

I think the code is just fine. You must however test the code by placing ultrasonic sensor at fixed distance from the wall and testing the distance. Also, it seems you are using SR04 ultrasonic sensor which has a beam angle of 15 degrees and accuracy of 3mm. This might result beam being reflected from water column container. As mentioned in the datasheet SR04 DataSheet, minimum area of measurement must be 0.5 square meters to get correct readings.

$\endgroup$
0
$\begingroup$

Ultrasound sensors like this have a very wide beam spread. In fact the word "beam" is completely inappropriate. So I think you're right, confining it like this is likely to cause problems.

To test this, set the sensor up in free air then put a solid obstacle beside the beam, but a few centimetres clear of it. It'll probably cause stray readings.

If you need to measure in such a narrow column, I'm not sure what you could do... very high frequency ultrasound sensors have a narrower beam, but they are expensive. Maybe you could have some sort of optical sensors, arranged beside the column, and a "float" placed in there to block the sensors...

$\endgroup$
0
$\begingroup$

Is the sensor expected to have error of this order?

In brief, yes. All sensors will have some degree of noise, which is characterized by the manufacturer. To avoid this, you can use a different sensor, or you can apply filtering to a very large dataset to extract the correct measurement. If you have the budget for it, a laser and photodetector of some sort will certainly give you better (less noise) results. Otherwise, you can apply a Kalman Filter or some other probabilistic technique to get a better estimate of the ground truth measurement.

Is my setup of confining the sensor through a column producing such errors.

Since you are using an ultra-sonic sensor, which has a conical "beam", the column will be acting as a wave-guide, and you can expect interference as a result, especially for smaller depths; this will increase measurement noise.

Any other ideas to get the water column height.

I think that the ultra-sonic sensor will work under two assumptions. First, you must apply some sort of filter/technique to estimate the true measurement based on the noisy measurements. I recommend Probabilistic Robotics by Sebastian Thrun for learning how to do this--it is well covered. The second assumption is that you don't need extreme precision.

Another approach to the problem would be to set up a camera, and use computer vision techniques to estimate depth; this is probably as easy as what you are doing, but it will require a different experimental setup.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.