Variation of pressure with pressure sensor

Thread Starter

Guytas

Joined Apr 29, 2021
32
Hello everyone. I'm collecting rain water into three 1100 liters tubs for a total of 3300 liters. I have a pump that pushes that water in the garden. I also covered every tub with a few layers of black plastic to prevent the light from getting in the tubs. This is pretty good to keep the water relatively clean but, I cannot see how much water I have in the tubs. So I used a raspberry pi with ultrasonic sensors to get the water level. This was working so, and only last a few week each time as the humidity was destroying the sensor. I tried a few things, but lately I decided to go with Pressure sensor.

At first I had unstable reading with the sensor. But with the help of several of you guys, I was finally (yesterday) able to fix it. Now I have steady reading without any error... I'm so happy about that. Thanks to you guys.

The smallest pressure sensor I found was a 0-10 PSI . I only need 0-2 PSI as the tubs height is about 120 cm. I understand that 70.4088 cm will equal to 1 PSI. Regarding the height of the tubs, I should never have more than 1.7 PSI

So I've installed the 0-10 PSI at the lowest point of the tubs, and I run the wires through the wall of the shed and connected that to an Arduino Micro. This cable is less than a meter long. In this arduino, I read the voltage from the sensor. It should be from 0.5 volt to 4.5 volts to match 0 to 10 PSI. But that is not totally exact. When I remove all pressure at the sensor, I read about 0.44966. For now, I didn't check if the 10 PSI will be 4.5 volts or 4.44966.

From that point, the arduino sends this data to a raspberry pi 4 via the uart. And this raspberry pi is getting data from a atmospheric pressure sensor and a few thermometers DS18B20

Here is the big question... I read the pressure every 5 minutes but during the day, this pressure is varying. At first, I thought that it was varying in relation to the atmospheric pressure but it seems not to be. It seems to be related to the outside temperature and something else may be. Is the pressure is really changing? or is it the sensor that react to the temperature. See the graph:

Capture d’écran de 2022-07-05 17-05-44.png
The top left graph is the pressure from the pressure sensor, underneath, it's the temperature in the shed, The top right is the atmospheric pressure, and underneath it's the temperature outside, but about 12 feet above the sensor.

The reason I'm trying to understand this is to be able to correct this pressure to a fairly strait horizontal line. I'm recording how much rain we gat and how much water we use to water the garden.

Note that during the whole day, we did not add or remove any drop of water from the tanks

I hope someone can understand what is going on here.
Thanks
 

MisterBill2

Joined Jan 23, 2018
13,707
Years ago I learned very much the hard way that cheap pressure sensors are also temperature sensors and mechanical strain detectors. And as your entire measurement span is only 20% of the sensor range the effects of noise are greater. Compensating for sensor thermal drift is tedious at best, compensating for mechanical strain shift is hopeless.
 

Sensacell

Joined Jun 19, 2012
3,096
Invest in a new sensor that has a span range that is closer to what you actually need.
Get one with differential pressure inputs so you can reference it against atmospheric pressure.

Here's my take on the problem.
 

MisterBill2

Joined Jan 23, 2018
13,707
Invest in a new sensor that has a span range that is closer to what you actually need.
Get one with differential pressure inputs so you can reference it against atmospheric pressure.

Here's my take on the problem.
Actually, most pressure transducers are already referenced to local atmospheric pressure. THey are GAGE pressure calibrated, the other more expensive calibration is absolute pressure, referenced against a vacuum. Differential pressure transducers always cost more because of needing two pressure connection ports. For reading water dpth gauge pressure calibration is OK.
 

Thread Starter

Guytas

Joined Apr 29, 2021
32
As you can see with my charts, even considering the atmospheric pressure would not have corrected it. As we can see, the temperature has a bigger effect that the atmospheric pressure.
 

Thread Starter

Guytas

Joined Apr 29, 2021
32
Invest in a new sensor that has a span range that is closer to what you actually need.
Get one with differential pressure inputs so you can reference it against atmospheric pressure.

Here's my take on the problem.
I’ve watched the video. Very nice. But this will have the same problem as the ultrasonic sensors... the humidity. The speaker and microphone will not last long in humidity. That is exactly the reason I moved to pressure sensor.
 

MisterBill2

Joined Jan 23, 2018
13,707
It is also possible to have an air column above the liquid and monitor the air pressure in the tube as the level changes. This reduces the corrosive effects of some liquids.
Of course, since the temperature effect on the sensor output is fairly large, it may also work to add a temperature sensor and compensate.
The big question is "how much accuracy do you want??"
30 years ago I bought pressure transducers accurate to 0.1% of best straight line, but they cost $650 at the time. Those particular products also did not drift enough to need re-calibration after a year, and so the clients who purchased machines that used those transducers understood why I selected that model.
For measuring water level in a rain barrel you could also use a float and several switches and know if it was almost full or almost empty.
 

Ian0

Joined Aug 7, 2020
6,671
How about a sight glass? Attach a vertical piece of transparent pipe, the same height as the barrel to the output pipe.
 

MisterBill2

Joined Jan 23, 2018
13,707
I have seen optical sensors attached to sight glass tubes, and also to glass tube flow-meters. That could work with the computer interface. But once again, "how much accuracy does the TS need for a rain-barrel?"
From the initial posts it seems the need is to know "almost empty" or not.
 

Ian0

Joined Aug 7, 2020
6,671
My central heating tank has a cork float to which is attached a piece of string, which goes around a pulley and then to a counterweight. The pulley works a rotary gauge.
Substitute the rotary gauge for a potentiometer.
 

Thread Starter

Guytas

Joined Apr 29, 2021
32
How about a sight glass? Attach a vertical piece of transparent pipe, the same height as the barrel to the output pipe.
The external light produces a lot of lime. This is why I explained that I covered all the tubs with several layers of black plastic sheet.
 

Thread Starter

Guytas

Joined Apr 29, 2021
32
My central heating tank has a cork float to which is attached a piece of string, which goes around a pulley and then to a counterweight. The pulley works a rotary gauge.
Substitute the rotary gauge for a potentiometer.
I thought about that. Actually, I made the whole project, printed the plastic case, and everything. But I prefer to stay away from moving parts. The pressure gauge is perfect solution. Just need to find the proper calibration in relation to temperature. So far, when I add the pressure to the temperature in celcius divided by 200, I almost get a strait line. I'm getting almost to the point that I can detect changes as small as 20 liters. This is pretty good.
 

Tonyr1084

Joined Sep 24, 2015
7,197
First, a friend (long time ago back when I had friends) wanted to make his own thermometer. He used a plastic bottle with a sealed lid. Stuck a pen straw (without the ink) in it. Using food coloring red and water he expected that with temperature rise he'd see the water rise up the tube. The exact opposite occurred. He asked me "Water expands when it warms, doesn't it?" Well, yes, it does. But so does the plastic bottle. The expansion of the plastic bottle meant there was more room (volume) inside the bottle, and thus the reason why the water level fell when it warmed as opposed to it rising as he expected.

Do you have plastic rain barrels? That seems to account for some of the difference in reading, though I doubt your barrels are expanding that much.

I like the idea of a sight tube. Some years ago I learned the hard way about HHO - and no - moderators - I'm not going there. Nor is this a hijacking. My point is that to keep my reactors full and to know when water was low I used clear plastic tubing to sight the water level in the storage tank. While HHO didn't result in solving the energy crisis - the sight tube DID prove effective in monitoring the water level.
 

Reloadron

Joined Jan 15, 2015
7,074
Least I forget to mention it, really nice job with the graphs and they pretty much demonstrate that temperature is the main contributing factor to the error you are seeing. Good pressure gauges, especially really good differential pressure gauges do not come cheaply. They range from expensive to really expensive to cardiac arrest looking at the price. Names like Rosemount and Emerson come to mind at over $3,000 USD per unit. For your application and less selling a body organ to buy a sensor I have used sensors from Honeywell in their SCX series which offer temperature compensation but even those are not inexpensive. Sensors like this also require signal conditioning on the outputs.

The basic sensors off the boat while not a dream solution for many applications are, for the most part, suitable for your intended goal and application. You need to ask yourself how much error can I live with?

When I remove all pressure at the sensor, I read about 0.44966. For now, I didn't check if the 10 PSI will be 4.5 volts or 4.44966.
All of that can be corrected in your code. If you really want you can go as far as generating correction curves but need to ask yourself when is good enough good enough. How accurately do you really want to measure the level in a rain barrel? That's what this will all boil down to. You can't make a silk purse from a sow's ear but do you need a silk purse? :)

Also keep in mind that an Arduino using a 10 bit A/D is only at best going to resolve about 4.88 mV on a good day.

Just My Take....
Ron
 

MisterBill2

Joined Jan 23, 2018
13,707
I went back to the first post, and I see it is rain water in the barrels. You DO NOT get lime buildup from rain water. Then I read about correcting for atmospheric pressure. Unless you have transducers that are "Absolute Pressure" transducers, they are already referenced to the ambient air pressure, and so will truly report the liquid pressure due to the water level. So there is one variable that is contributing to the variations.
With uncompensated pressure transducers, both the gain and the offset vary with temperature.
For the transducer with the 0 to 10 PSI range, and an output of nominally 0.5 v to 4.5 volts and thus 4 volts for ten PSI, using only 20% of the span, so the whole range is about 0.8 volts between full and empty.Looking at the sensor voltage range in post #1it seems that the output varies just a very few millivolts, perhaps 20 millivolts total variation. That is well within the expected thermal effect on the reading that I would expect from a cheap transducer.
I think that the A/D converter is a ten bit device, with zero to 1024 binary as the full scale. 20% of that is about 105 counts between full and empty, which should be good enough. But we do not know the input voltage range for the whole count. That matters a great deal. If the input voltage range is zero to ten volts and your spread is 0.8 volts empty to full, then you are only using 8% of the range.
 

Thread Starter

Guytas

Joined Apr 29, 2021
32
Do you have plastic rain barrels? That seems to account for some of the difference in reading, though I doubt your barrels are expanding that much
I like your little story. Thanks. But yes they are in plastic. They are in the shade but yes in plastic. One way to verify if that makes a difference in size is the measure the exact height of the water (which I'll do). If the tubes get larger, the height of the water will go down (and this is the case). In which case, the pressure sensor will be right. I'm going to monitor that.
On a second though, the water temperature is varying of about 0.5 at the most during the day. The plstic around the water is mostlikely staying at the water temperature...
 

Thread Starter

Guytas

Joined Apr 29, 2021
32
You DO NOT get lime buildup from rain water
OK, then I don't know how it's called but the first year that I didn't have the black plastic, they came full of green stuff on every wall inside the tank. After searching on the net it was recommended to cut 100% any light. Which I did. And for the last three years, it has been clear completely. So whatever it was, I got rid of it ;-)

think that the A/D converter is a ten bit device, with zero to 1024 binary as the full scale. 20% of that is about 105 counts between full and empty
Yes but I thought to use the INTERNAL reference at 2.528 thus monitoring only voltages from 0 to 2.528 in which case I'm going to use 67.8% of its range. (total height to monitor is 120cm)
 

Reloadron

Joined Jan 15, 2015
7,074
Yes but I thought to use the INTERNAL reference at 2.528 thus monitoring only voltages from 0 to 2.528 in which case I'm going to use 67.8% of its range. (total height to monitor is 120cm)
Yep, you thought wisely. :)

My best guess as to the green stuff is Algae:
Algae is an informal term for a large and diverse group of photosynthetic eukaryotic organisms. It is a polyphyletic grouping that includes species from multiple distinct clades.

Simply put cover with black plastic and algae goes away. :) No algae = good, algae = bad. I love simple. OK, problem solved. Nice idea using the low reference voltage.

Ron
 

MisterBill2

Joined Jan 23, 2018
13,707
I suggest checking to see how many counts you get from the A/D converter. I am not convinced that the reference voltage is the same as the full scale voltage. Check ans see how many counts you get with the full barrel input. That was on the fist posting, but not the A/D counts, I don't think. 2.258 is not a convenient number for a full scale voltage input. So I am saying that we really do not know what voltage represents full scale for the converter. The Full scale voltage matters quite a lot. In fact, without knowing what the full scale, 1024 counts voltage is, there is no way to know what the input voltage actually is.

And I see that "the pressure sensor voltage" rose from 0.793 to0.806 volts. That is an increase of 13 millivolts . A total deviation of about +/- 6.5 millivolts out of about 800 millivolts. That is easily within 1%, which is good for a cheap pressure sensor. The resulting wild curves, then, are being caused by something else, possibly an incorrect correction???
Of course, that 0.783 volts probably also includes the 0.494 volts offset, doesn't it? Or does it?? How much does the offset voltage change with temperature??

So really, without knowing the actual voltage per count, it is all random guesses.

The term "offset Voltage" in this case means the transducer output voltage with atmospheric pressure on the input.
I should have looked at those numbers much more closely earlier.
 

Reloadron

Joined Jan 15, 2015
7,074
I don't think. 2.258 is not a convenient number for a full scale voltage input.
Actually that is correct, just sounds peculiar. The uC is an ATmega32U4. The chip has an internal analog reference of 2.56 volts you simply call out in your code or you can also use an external reference. It would look a little like this. Not sure as to where the 2.258 comes from though. Maybe a Type O? :)

Syntax
analogReference(type)

Type would be (INTERNAL2V5) or (INTERNAL2V56) I forget but similar to that. Anyway the 2.56 volt internal reference is correct. 1.1 volts on the ATmega168 or ATmega328P is common but the ATmega32U4 chip uses an internal 2.56 volts or you can use an external of your liking within the chip's limits.

Ron
 
Last edited:
Top