[Water Level] H ow to measure the water level?

@sihui Thanks for the datasheet. On page 7 it mentions the minimum diameter to be 0.110 inch and on page 9 the dimension T is 0.115 inch.

USA is where i want to buy it. Wonder if this would work.

Yours is case 1351, so page 7 should be correct.
I always found stuff like that in my local Home Depot.

Thanks @sihui and @chris I had built capacitive level sensor. The accuracy was really good even with diesel. But humidity in the cylindrical probe caused a lot of trouble. With careful design, capacitive can also give long life. And it takes no fancy parts, just Arduino 10mm stainless steel rod (outer -ve electrode), and coaxial TV cable (inner electrode).
I also had optimized Arduino capacitive sensor library for 8bit, so that resolution stays good at 2 MHz. I can share code if people are interested. I used MySensors for communication.

How much does MXP51 pressure sensor cost?

It’s around $16 at Digikey. Maybe there are cheaper ones out there if you look around, but I can certainly say it works well, and has done for many years now


:+1: eager to test this out. I do need weather proof water level. $16 is too much though. Ultrasonics are at 1$, but again the cost of climbing up the tanks and replacing sensor every 6 months is more than 16$. :slight_smile:

I need some help at understanding this sensor. On page 5 the plot shows that the pressure is 0 Pa at 2.5V, 2000 Pa at 4.5V and -2000 Pa at 0.5V.

Based on this i made this following code to convert pressure to Tank height. My tank height is 48 inch or 121.92 cm.

var Number  tank_height=121.92 //48 inch or 121.92cm
rule "Tank level3 changed"
when    
    Item Tank_level3 changed
then
        logInfo("Tank_level3", Tank_level3.state.toString)
        // Calc %Full
        // Pressure transducer at pressure 0 voltage 2.5
        // Pressure transducer at pressure 2000Pa voltage 4.5  
        // Pressure transducer at pressure -2000Pa voltage 0.5   
        var sensorVolt=(Tank_level3.state as DecimalType).floatValue
        var slope= (4000)/(4.5-0.5)
        var constantc= 2000-slope*4.5
        var tankpress= slope*sensorVolt+constantc

        //Convert pressure to height using Pressure=rho*g*h and times 100 for cm
        var tanklevel= 100* tankpress/(9.8*1000) 
        var percentanklvl=100*tanklevel/tank_height
        logInfo("Tank_level3 full", percentanklvl.toString)
end

I mouth blowed into the sensor, and the voltage shot upto 4.57V which would approximate to 2000 Pa. This would correspond to 20.4cm which is way less than my tank height of 121cm.

Likewise MXP51 can go upto 10,000 Pa which when divided by density*acceleration would give about 100cm. That is low as well.
Where did i go wrong?

Try an aquarium supply shop

Fundamentally, you have a sensor that doesn’t have the range to go to 120cm. It can only provide a reading of 20cm (2000pa) - which is what you already found out


That sucks. It is not of much use then. Your tank is less than 100cm (limit for MXP51)?

Is there a sensor which can measure depth upto 121cm?

Any view on this sensor, it can go upto 16mBar or 163cm. It mentions for ‘Dry Gases’ only, but applications do list liquids.

https://www.tme.eu/en/katalog/pressure-sensors_100524/#id_category=100524&page=1&currency=USD&s_field=artykul&s_order=ASC&visible_params=2%2C2193%2C111%2C1752%2C2227%2C1397%2C1387%2C98%2C1390%2C32&used_params=2%3A383719%3B1397%3A8460%3B

MPX2100AP

MPX2100DP

Range 0-100 kPa. 1 Bar. 14.5 psi.
Can measure level upto 10 meter in gravity fed water tank.
15$ per piece.
Output is 40 mV/kPA. Water pressure (on Earth) is around 3 kPa per foot (30cm).
On a 5v Arduino, you get 5000/1024 = 4.88 mV per unit. For 3 kPa reading you get 120 mV = Arduino analogRead = 24.6
30/24.6 = 1.22. So basically you need to multiply analogRead by 1.22 to get water level in cm. I hope calculations are correct :wink:

A cheap alternative is mentioned here:

Range is good +/-37 kpa. Bill is only 2$.
However, the sensor MPS20N0040D is designed for dry, non-corrosive air medium. Water might damage it eventually, but not sure how long.

I remember it this way, water pressure (on Earth
 We are not building a moon base yet) is approx. 1 bar for 10 meters
The range is 10 metres or 1000 cm.
You have 1024 points digital read so a value of 1 is: 1000/1048 = 0.9542 cm
You will need to multiply you value by 1.048 to get a value in cm: 0.9542 * 1.048 = 1
@diyha do you agree?

1 Like

Mine is just over 1m deep, so the version I suggested above was fine for me. Clearly you need to select one that has the appropriate range for your application and you seem to have gone for one with 20cm range only. Too much range, and you will have poor resolution, and too little range, and you just can’t read the depth.

Note that you also want to use one that has a differential measurement (ie the DP version) - so not the first one (AP) in the link @diyha provided. If you use absolute measurements, your reading will vary more depending on the weather and altitude. Weather variation is not so much, so probably doesn’t matter, but if you have the option, use the differential one so that it measures relative to atmospheric pressure.

For the formulae that has been provided, if you use the AP version from the link, you will also need to account for altitude, so there will be a bias and this could be quite significant depending on where you live. Again, using the differential sensor should eliminate this.

1 Like

I think the sensor which you are using would do the job for me. I have an ADS-1115 ADC which works on 5V connected to an NodeMCU ESP8266. The MXP sensor has 6 pins, but it is not clear from the datasheet the pin out. The datasheet shows that the package type is MPX5010DP CASE 867C-05 but it does not show the pin out for this. Do you know the PIN out (guess i need Vs, Vout, Ground with he rest 3 unconnected)?

Can this sensor work directly with the ESP8266/Arduino supplying 5V or do i need any other components i.e. resistors or capacitors?

Pin 4 for the larger case that they call Unibody -:

You shouldn’t need anything else - other than the decoupling capacitors recommended in the data sheet -:

You might want to take a look at the referenced AN1646 though - just to see if there are any other recommendations.

I think with my system I also added a 5v regulator on the board as there was quite a long cable length, and I wanted to avoid noise, and additional vdrop. This probably isn’t necessary, and definitely won’t be necessary if the Arduino is close to the sensor.

This is for noise filtering? My usecase is not very sensitive, can i directly connect the sensor to the ADC without using these capacitors?

Mostly, yes, but


I would not recommend it - even if your use case is not sensitive, the manufacturer recommends these capacitors not just so that the design is noise free, but also to ensure that their component will work and be stable and the various conditions that they have specified the device will work.

You might get away with it if you leave them out, but a couple of capacitors will cost you a dollar or so, and should ensure your system will work.

You missed the 40mV per kPa thing. In your calc you are assuming 5000 mV corresponds to 10m / 100 kPa / 1 bar. But its 40*100=4000mV for the model MPX2100. That is 4volt upper seal (Arduino analogRead==819).
Some sensors are 45mV per kPa. Those will have 4.5V corresponding to 10m / 100 kPa / 1 bar (Arduino analogRead==922).

BTW MPX2100 needs 10V. Its convenient to go for MPX5100 series, it needs 5v. The site I was searching at didn’t show 5100, but they are available for 15$ on element14 and mouser.