Project time!
Can we hack a cheap blood pressure monitor and use it as a versatile fluid level meter?
And which problems do we have to overcome?
Gr ezi YouTubers.
Here is the guy with the Swiss accent.
With a new episode and fresh ideas around sensors and microcontrollers.
Remember: If you subscribe, you will always sit in the first row.
In my video about fluid level sensors, I forgot to cover the maybe best possibility because
I had never heard of it.
Many commenters wrote about it and its advantages.
But how does this marvelous sensor work?
And why did they think it is so good?
We insert a small open pipe to the bottom of a tank and add a pressure sensor on the
other side.
The theory says that the fluid enters the tube from the bottom and, because the top
is closed by the sensor, creates a pressure proportional to the weight of the fluid above
it.
And the weight of the fluid is proportional to the level of the tank.
And the best: The sensor can be placed outside the tank in a safe, dry, and non-corrosive
area.
Most other sensors have to be somehow inside or close to the tank and can corrode, for
example.
For me, this was an intriguing solution.
In addition, it seems to be cheap and straightforward to build.
Unfortunately, like most things in life, it has at least one severe flaw: The system must
be airtight for the whole lifespan.
If not, the tube would fill up from the bottom, and the results would become inaccurate over
time.
After my video about measuring the pressure during beer brewing, creating airtight devices
became horrifying for me.
Fortunately, the viewers suggested an even better solution: We can avoid this long-term
airtightness need if we add a pump to the equation.
How does it work?
We insert the same tube till the bottom of the tank.
At the top of the tube, we add a pump in parallel to the pressure sensor.
If we run the pump, it blows out all water inside the tube by creating the same pressure
as the weight of the fluid.
Precisely the same as with our former completely airtight sensor.
Now we switch the pump off and measure the pressure.
Like that, our system only has to be airtight for a few seconds.
Cool!
But how can we stop the pump exactly when no more water is left in the tube?
Fortunately, this is not needed because the air exits the tube if there is too much.
This is why these sensors sometimes are called bubbling sensors.
So we just have to leave the pump on for a few seconds.
Done.
Now we have another problem: Unfortunately, not only the weight of the water creates pressure.
Also, the air above the tank adds to this weight and increases the pressure.
This obviously leads to wrong results.
So we have to add a second sensor for the weight of the air and subtract it from the
pressure measured at the bottom of the tank to get a better result.
Sounds complicated!
Fortunately, there is an easier fix if we use a differential sensor like that.
How does it work?
Let s assume we apply pressure from the outside that bends a membrane inside the chip.
If we measured this movement, we should get the pressure.
What would happen if we added the same pressure on both sides?
The membrane would not move because it moves with the difference between the two pressures.
Cool.
An analog computer!
If we leave the bottom pipe open, our membrane automatically subtracts the ambient pressure
from the pressure coming from the top.
And the ambient pressure is precisely the weight of the air above our tank.
So we saved a second sensor and a line of code.
Did you ever see a chip with six holes?
Now you know what they are for: The ambient air can enter and create the correct pressure.
Simple!
To build a sensor, we could order a pump, a sensor and a few meters of a plastic tube.
But I found this article in the German Make journal where the author used a blood pressure
monitor to create such a sensor.
Such a device obviously contains a pump and a pressure sensor.
And it also contains a valve to let the air out in a controlled way to measure the blood
pressure.
What if we could hack such a device and use it for our purpose?
Now I have a problem: This meter belongs to my wife, and she would not like it if I used
it for my experiments.
So I had to purchase a cheaper one to take it apart.
And really, it has the three components: The pump, the valve, and the sensor with an attached
computer and display.
The sensor looks similar to the one we saw before.
Electronics are the usual cheap stuff that cannot easily be hacked because we do not
know what is below this plastic blop.
Anyway, we can use the sensor from before and add an Arduino or an ESP32 if we need
WiFi.
Or a LoRa node if the sensor is used in a remote location.
And even better: I found these popular sensor modules, which can be attached to our Microcontroller.
That is precisely what my doctor prescribed!
A closer look reveals that they use a similar pressure sensor and an HX710 chip.
HX710?
Sounds like HX711, the famous 24bit ADC used in most strain gauge projects.
And really, the HX710 is the smaller brother of the HX711.
And the pressure sensor?
I ordered these MPS20N0040D sensors.
Unfortunately, I never found an original datasheet, but at least we have this information: The
chip contains four resistors arranged as a Wheatstone bridge if pins 1 and 6 are connected.
Now everything makes sense.
The strain gauges have the same setup, which is why they used this HX710 chip.
The only thing that cost me quite some time was that this drawing is from the bottom and
not the top.
So pay attention.
Pin 3 is not where you would expect it.
These sensors are suitable for 40kPa or a water level of 4028mm.
For oil, it would be more because it is lighter than water.
So we should be able to measure four-meter high water tanks with such a sensor.
However, when I tested these sensor modules, I quickly found that they saturate at a much
lower pressure.
So I thought my software was wrong.
But no, it was not the software; it was the cheapness of the manufacturer of these modules.
Why?
The full-scale value of the sensor is 50-100mV.
And the HX710 has a fixed gain of 128.
So the output voltage at 50mVx128=6.4V is 6.4 volts, and at 100mV, 12.8 volts much more
than the 5 volts supply voltage.
So you only can measure up to around 1-meter of water with this setup.
Why do I think it was the cheapness of the manufacturer?
Because with the HX711, you can select the multiplication ratio.
If you select 64 or 32, you are much better off.
So I had to build my own sensor consisting of a pressure sensor and an HX711.
Now I am nearly ready to go.
What else do we need?
First, of course, we have to switch the motor.
I use a simple N-channel FET for this purpose.
And because I can, I add a second one to drive the solenoid.
Now I can open the valve and tare or zero the sensor before starting.
Fortunately, my clear tube from the garden center has the same diameter as the original
adaptor and can be inserted into the hole of the blood pressure monitor.
Now I only have to solve the last problem: I do not have a deep tank at home.
The tank I intend to use the sensor is in a remote place, and I have no access to it
at the moment.
What can I do?
Again, I chose a simple solution and bought the smallest tank available: A 30mm tube of
2 meters in length.
Fortunately, the diameter of a tank is not relevant for our measurements!
I printed a 3D part to close the bottom, inserted the measuring tube till it reached the bottom,
filled the tube with water, and I was ready for the test.
The software is simple: I open the valve and switch the motor off.
Now I tare the system.
Like that, it should show close to 0 cm.
Then the valve closes, and the pump runs for a few seconds.
During this time, pressure is reported.
As soon as the pump starts, we see a problem with my setup: Water overflows at the top
because the added pressure empties the measuring tube.
The measuring tube was filled because the valve was open.
This water is pushed out into the tank, and it overflows.
So I have to fill up after every measurement to ensure that my tests are repeatable.
This does, of course, not happen if your tank is bigger.
As we see, the pressure does not stay the same during the pumping.
There is a maximum somewhere in the middle, and then it is reduced.
I do not entirely understand why.
Maybe it needs more pressure to blow the water out of the measuring tube.
Anyway, after seven seconds, I stop the pump, wait for 200ms, and read the final pressure.
Then I open the valve.
That s it.
The first time I did this, I noted the number and divided it by 200 cm, my tank size.
Then, according to the manual, I inserted this number into this line.
Now my pressure meter is calibrated and should show the water level in cm.
Exactly what I wanted.
As assumed before, I had to switch the gain to 64.
With 128 also the HX711 goes into saturation below the 2 meters level, BTW.
What is its accuracy?
For our case where we tare the sensor before we start, the linearity error and maybe the
temperature coefficient of the sensor's sensitivity are the most crucial factors.
The HX711 also has a gain drift with changing temperatures.
So let s calculate with +/- 1% full scale.
Full scale, in our case, is 40kPa or 408 cm.
So its accuracy is +/- 4cm.
My measurements showed differences of a few cm from measurement to measurement.
If you need more precision, you probably have to change the pressure sensor for a better
one.
All-in-all we were successful with our project.
We got a cheap and reliable fluid level meter with a certain precision.
You can use a blood pressure monitor as a basis or buy the products and create your
own design.
Just a small remark: Why would I suggest going with the Blood pressure monitor?
Because of this tiny part and these flexible tubes.
They are airtight.
Do not expect you could 3D-print such a part.
As said before: 3D-printed parts are not airtight.
If you go without this blood pressure monitor, you have to find another possibility to attach
at least three parts: The measuring tube, the pump, and the sensor.
Or four if you want to add a solenoid.
The next steps are to put the parts into a case, add a LoRaWAN node, and go for tests
at the remote location.
This was all for today.
As always, you find all the relevant links in the description.
I hope this video was useful or at least interesting for you.
If true, please consider supporting the channel to secure its future existence.
Thank you!
Bye