Author Topic: MPX5010DP For Measuring Water Level in a Rain Barrel  (Read 3688 times)

Cube

  • Administrator
  • Contributor
  • *****
  • Posts: 86
    • View Profile
    • The Venturii Adventure
MPX5010DP For Measuring Water Level in a Rain Barrel
« on: June 30, 2016, 03:38:02 AM »
I've been playing with a MPX5010DP Differential Pressure Sensor, using it to monitor the water level in a rain barrel. Now that we're getting a fair bit of rain and that I have a water pump system set up to water my lawn and plants from stored rain water, knowing how much rain water is in the barrel farm is important. Originally I was going to simply use a number of float switches evenly spaced on some sort of stick to give 25%, 50%, 75%, 100% "full" readings, but I stumbled across the idea of monitoring the water levels a different way, which seemed so simple it just might work. Other posts on the Internet showed how people had used sensors in the MPX family to measure water level readings, and I recall having purchased 5 of the required sensors several years ago, but never actually did anything with them. Now that I have 7 45 gallon barrels full of water, my interest in the subject was substantially renewed.

The setup was surprisingly straight forward. According to the datasheet, the MPX5010DP produces a signal in the 0-5V range proportional to the amount of pressure sensed on one of the two ports of the device. There has been a number of questions about what the 'other' port on the sensor is for. Being a differential pressure sensor, it is measuring the difference in air pressure between two hoses. One port is the for the positive side, the other port is for the negative (called vacuum) side. In my application I simply leave the vacuum side open to the atmosphere since that is my control in this experiment. For the pressure side, I have taken a length of 1/8" ID clear plastic tubing, pushed it through a section of 3/4" copper pipe long enough to stand on the bottom of a rain barrel, and taped the tube to it. What this accomplishes is it keeps the clear plastic tubing more or less straight, necessary for a good linear reading, and also makes sure that the opening of the plastic tubing is at the bottom of the barrel. The other end of the tube is clamped onto the pressure side of the MPX5010DP, and the analog output is connected to an Analog Input on a Venturii VDAC board.

According to the datasheet, the manufacturer recommends several capacitors for decoupling from the power supply, but the rest is done by the sensor. I didn't have the exact values recommended in the datasheet, but did install several capacitors next to the sensor for the same purpose. Immediately thereafter I began to get readings on the VDAC.

Observations:

  • The sensor works very well for this purpose. I was able to monitor the water levels and see immediate changes when water was added to one of the barrels or removed (they are all inter-connected at the bottom and so self-levelling.)
  • Due to the length to tubing between the barrel and the sensor, the apparatus is very sensitive to outside air (ambient) temperature changes! As the temperature increases, the air pressure that is detected inside the tubing increases. Conversely, as the air temperature decreases, so too the air pressure measured inside the tubing decreases.

My next step is to reduce the length of the tubing as much as possible to help mitigate the effect of air temperature on the reported air pressure. Once that has been stabilized somewhat, the  next step will be to calibrate the setup to read the pressure as a percentage of barrels being full. For example, as I type this the VDAC is reading a value of 530/1024 of the 5v analog input. Using some maths, 5V / 1024 Steps * 530 Measured Steps in the 10-bit ADC = 2.588 VDC. The datasheet gives the output formula as:

Code: [Select]
V[sub]out[/sub] = V[sub]s[/sub] * (0.09 * P + 0.04) +/- 5%.
It is three thirty in the morning, but if I re-arrange that formula to solve for P,

Code: [Select]
2.588 = 5 (0.09 * P + 0.04)
2.588 / 5 = 0.5176
0.5176 = (0.09 * P + 0.04)
0.5176 / 0.09 = 5.751
5.751 = P + 0.04
5.751 - 0.04 = 5.71
P = 5.71 kPa

With the barrels full to overflowing, my reading is 5.71 kilo-pascals. Discarding the temperature swing, I could call this the 100% full measurement. I would then need to empty the barrels down to the point where the jet pump starts to cavitate (suck in air), measure the air pressure at that water level and call that reading 0% full. Then going forward, I could convert all the pressure readings into percent of full and have a very accurate reading on how much water I have stored in the barrels.

Taken a step further, I could measure the volume of the barrels and convert that percent to gallons or liters. Considering their value, the slightly higher price-per-sensor of these guys, in light of the granularity they give, the simplicity of the implementation and usefulness of the data they provide makes them an excellent value for this purpose.
Venturii - Integrate Everything