# Fluid Level Measurement using Transducer, mounted on bottom of the Tank

Hi All,

I am using BSU-P7-1000B-W200 sensor , 2 wires (red & black ), mounted on bottom of tank to measure the fluid level.

I am plugging the black lead on the 3,5 V and the red on pin 7 of an Arduino Uno to ping and read the echo, using pulseIn() to measure the ToF, converted to distance in cm.

I am constantly getting out of range data (like 4 to 5m instead of 3 cm I am expecting).

Did anyone face this kind of issue in the past? If yes, appreciate if you share your experience.

Thank you!

To get any sensible answers, you need to provide a lot more information like the code you are using, a circuit diagram and where you got the idea in the first place.

Others might disagree, but I think this is a hard way to do it and at the very least, you will need some fancy maths to get reasonable results, if it works at all.

What size tank, fluid levels, tank construction material, thickness of the tank bottom?

What information do you need? Accurate level/volume or just full or empty?

Most methods in practical use will have overhead ultrasonic sensors or some sort of pressure sensor or even electromechanical systems like floats and pulleys and an encoder

Your sensor part number seems to come back to:

Which makes absolutely no sense.

If you want to measure volume of water in a tank you can do it using a pressure sensor in several different approaches but you need to state your objective clearly, a credible link to the sensor planned and your code sample.

Ron

Ron

Which bit doesn't make sense? The manufacturer's site describes Piezo Element, dia. 6.6 mm, thickness 2.0.

I have a gut feeling that this just isn't going to be up to it.

The poster is talking about expecting 3-cm - depth of fluid? -that's a puddle in a sizeable tank, but if he/she doesn't supply some better information then this is going nowhere

Hi Folks,

Thanks for your good questions...

Here are some details:
1- Objective : make my own propane level measurement. I want to mount the sensor on the bottom and measure the remaining level (knowing the tank high, the level will give the remaining %)

2- The sensor is BSU-P7-1000B-W200 from Bestar, bought from Arrow indeed

3- The program is inspired by Arduino Ping program, adapted to my 2-wire sensor ... below:

``````const int pingPin = 7;
void setup() {
// initialize serial communication:
Serial.begin(9600);
}
void loop() {
// establish variables for duration of the ping, and the distance result
// in centimeters:
long duration, cm;
// The PING))) is triggered by a HIGH pulse of 2 or more microseconds.
// Give a short LOW pulse beforehand to ensure a clean HIGH pulse:
pinMode(pingPin, OUTPUT);
digitalWrite(pingPin, LOW);
delayMicroseconds(2);
digitalWrite(pingPin, HIGH);
delayMicroseconds(5);
digitalWrite(pingPin, LOW);

// The same pin is used to read the signal from the PING))): a HIGH pulse
// whose duration is the time (in microseconds) from the sending of the ping
// to the reception of its echo off of an object.
pinMode(pingPin, INPUT);
duration = pulseIn(pingPin, HIGH);
// convert the time into a distance
cm =duration / 7 / 2; //speed of sound is 1480 m/s in water, that is 6.7 micro s /cm
Serial.print("ToF in ms: ");
Serial.print(duration);
Serial.print("--- Level in cm: ");
Serial.print(cm);
Serial.println();
delay(5000);
}
``````

4- Schema : do not have but, actually really simple :

• The Sensor red lead is connected to Arduino pin 7. The black wire is connected to 3,5 V. The sensor is mounted at the bottom (now testing with a glass of water). The Pin 7 is used to ping and echo the sensor. The thickness of the tank (glass of water) is 1 CM.

Hope this helps.

tigger:
Ron

Which bit doesn't make sense? The manufacturer's site describes Piezo Element, dia. 6.6 mm, thickness 2.0.

I have a gut feeling that this just isn't going to be up to it.

The poster is talking about expecting 3-cm - depth of fluid? -that's a puddle in a sizeable tank, but if he/she doesn't supply some better information then this is going nowhere

Fair enough question. The thread starter mentioned one of these, PIEZO ELECTRIC CERAMIC SENSOR of which even the data sheet cover page has words misspelled. Here nor there. I have a few similar I used for a shock and vibration project I did. While I have no clue what the fluid in the tank is this is not the right type of sensor for the application. Placing in in the bottom of a water filled tank will only get it wet. Sensors like this generate their own voltage but only when excited like a shock or vibration and their output is momentary. Viewing one on a scope they resemble a spike so not like I can squeeze it applying constant pressure and maintain a voltage out proportional to the applied pressure.

Anyway that is why I said it makes no sense. You can't use the described sensor to measure fluid level.

Ron

What you are describing us an ultrasonic sensor less the echo. The best way to measure the level in a propane tank is weigh it or keep it on a scale. The liquid level of propane maintains a pretty constant pressure as the liquid turns to gas so measuring pressure isn't good. There are temperature strips which I have seen used on the sides of tanks but the best method is weight.

Using what you have how do you ping through a steel tank and get an echo? How do you ping through anything and get an echo like a glass of water? I just don't see this working. Also your code uses the same pin for Output and Input where normally we use a ping (Output) and an echo pin (Input). For example:

``````const int pingPin = 7; // Trigger Pin of Ultrasonic Sensor
const int echoPin = 6; // Echo Pin of Ultrasonic Sensor

void setup() {
Serial.begin(9600); // Starting Serial Terminal
}

void loop() {
long duration, inches, cm;
pinMode(pingPin, OUTPUT);
digitalWrite(pingPin, LOW);
delayMicroseconds(2);
digitalWrite(pingPin, HIGH);
delayMicroseconds(10);
digitalWrite(pingPin, LOW);
pinMode(echoPin, INPUT);
duration = pulseIn(echoPin, HIGH);
inches = microsecondsToInches(duration);
cm = microsecondsToCentimeters(duration);
Serial.print(inches);
Serial.print("in, ");
Serial.print(cm);
Serial.print("cm");
Serial.println();
delay(100);
}

long microsecondsToInches(long microseconds) {
return microseconds / 74 / 2;
}

long microsecondsToCentimeters(long microseconds) {
return microseconds / 29 / 2;
}
``````

Also the data sheet for your piezo reflects a Fr (Frequency of resonance) of 1000±200 KHz. (1.0 MHz) or 1.0 uSec.

I just don't see this working? Where did you come up with it?

Ron

Ron

Thanks Ron

I've tried using a piezo for picking up the vibration/sound of a large contactor operating and got nowhere with it, just not sensitive enough.

lemine hasn't made it clear whether the transducer is on the exterior surface or the interior surface of the bottom of the tank.

No way is it going to work on the interior and now we know it's liquid propane that's another reason to rule that out.

I can't see that there is enough power to get through 1-cm of glass or what will be a large steel tank.

Given that it's propane, I don't think I would want to be experimenting and would look at commercial solutions.

Propane gas suppliers generally have systems that give tank levels and alarms. Oil tank systems are quite cheap and use ultrasonics and wireless.

I once worked with large CO2 fire extinguishers in really heavy wall cylinders. The suppliers used some method that detected the liquid level externally (too large to weigh). It was a portable probe that ran down the side of the cylinder.

There might be some mileage in temperature sensing on the exterior as with any gas evaporating from a container, it takes heat from the container to the point where you can see condensation forming on the outside.

What we still don't know is how big the tank is.

I would be surprised, assuming this is a refillable tank, that there isn't already something in place to measure tank contents.

I would agree that weighing is quite feasible and some strain gauges would be a lot easier to implement.

Personally, I wouldn't spend too much more time with this piezo approach which without sounding too rude, from the datasheet, looks like something you might find in a toy.

I've tried using a piezo for picking up the vibration/sound of a large contactor operating and got nowhere with it, just not sensitive enough.

Off topic but played that game, been there and done that. At one point I was involved with the MK 48 ADCAP program which is a large torpedo and has a two speed fuel system controlled by a two speed valve. Anyway when the voltage to the valve body was increased at a certain point the valve internal solenoid made a click. So we would ramp the voltage while plotting it and had an accelerometer on the valve body which picked up the click also being recorded. Yes, it takes a good high quality accelerometer, we used mostly Endevco and B&K which weren't cheap.

Anyway I don't see using a toy making this work for many of the listed reasons.

Ron

The transducer is mounted at the bottom outside the tank obviously (else would be sunk, not to mention the leakage when getting the wires outside to plug into the arduino -:))...

The theory behind is that exciting the sensor (Ping through Pin 7) will generate a wave (this is 1MHz frequency sensor) that is supposed to get though the Tank (or glass in my test) and propagate at speed of sound through the fluid (water in my test). When reaching the top of the fluid, part of the energy (wave) is supposed to reflect back. I am assuming the sensor will detect and generate the pulse back to the Aurduino (Pin 7, used to listen to the echo). Time between ping and echo is the ToF that will be translated to distance, that is my fluid level.
This doc can help and TI seems to have tested my sensor, just that It uses TI TDC1000, while I am using Arduino microcontroller : http://www.ti.com/lit/an/snaa266a/snaa266a.pdf?ts=1587752287037

You Guys are right in mentionning the 2 technics used for the purposed of measuring the fluid level : weightage or pressure strip. I thought of both of them, but both have logistic constraints and less fun to make (this is relative offcourse).

Good to read you anyway. We have to deep dive.

Have at it, I won't be the one to dissuade your pursuit.

Ron

Ron

The Mk 48 looks quite a beast - no messing with that!

lemine

I'd still be interested to know what sort/size of tank you are dealing with.

Is it a tank for heating systems? Commercial? Domestic?

You probably don't need me to tell you to look after the safety side of things. Measuring the level/volume of a water tank is one thing, propane is another.

If you do get your approach to work, let us all know.

You will probably need to beef up your transducer. Piezo transducers are used on the bottom of tanks used for ultrasonic cleaning and are very well bonded to the tank surface.

A slightly wacky idea might be to use the resonance of the tank as the volume changes, a bit like tapping a container and judging from the sound what the content is.

As Ron says, nothing ventured nothing gained.

Hi Ron and Tigger,

Will definitively continue the research/experience and I’ll remain looking for your and others ideas. Will keep sharing my findings of course…

@Tigger - Tank will be Metal. But, this ultrasound non contact sensor based and that should get across any material I guess. For the dimension, 30cmX60cm will be the typical gas cylinder I am using, though I don’t think size (to the extent of the meter, which I already very high) will really matter. As far as the security is concerned, as the sensor is outside the tank and the voltage is light (3,5 V), I do not expect much risk on the front. Any insight on this topic, kindly share.

OK. That's a cylinder rather than a tank and a small one. I presume it's a refillable one used with a regulator and a tool like a torch or a burner, sometimes supplied by companies like Calor.

I wouldn't be too confident that the transducer you have will have the power to penetrate much.

Ultrasound is used in all sorts of diagnoses, but probably with much more power.

If it were mine and I have several, I would weigh it.

A strain gauge base would be just as satisfying to do but without a lot of guesswork.

Refillable cylinders usually come stamped with the empty weight - the tare weight - and sometimes the gross weight (full). Weighing is the standard method.

Add on the weight of fittings like regulators.

Quite easy to transmit the weight data by wireless (XBee for example)

It’s a Cylinder indeed and It’s refillable.

Pls check the first part of this video: How to use inexpensive transducers for ultrasonic measurement - YouTube

Hello lemine,

Did you ever figure out how to get this project working correctly? I am working on a project almost identical to yours and would like to know if you figure out how to get this working properly.

Thanks

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