Water Level Sensor with Arduino Ethernet

This project implements a network connected water level sensor, measuring the level in the sump pit of my house. It’s connected to the home network and reports the water level by broadcasting UDP packets so that any computer can receive it and take action, such as sending out an alert or storing statistics.

The Arduino Ethernet and the Power Supply installed and connected

Important note
Before we go any further, let me just point out that the pressure sensor, MPX2010DP, used in this project exists in another version, MPX5010DP, that has an output voltage interval much better suited for this project. If only I had checked that I wouldn’t have needed to build any circuits or use any extra components at all.

The pressure sensor MPX2010DP measures the pressure difference between two inputs, from 0 to 10 kPa and outputs between 0 and 25 mV on it’s two output pins. (The MPX5010DP gives you between 0 and 4.7 V output, ideal for direct connection to the analog inputs on Arduino.) This means that we can use it to reliably measure the water level in a tank or pit, without being troubled by changes in air pressure The only thing we need to do is connect input 1 to a hose leading to the bottom of the pit and leave input 2 hanging in the air.

The MPX2010DP operates anywhere between 0 and 16 V and draws less than 10 mA, which means we can run it directly off the 5 V pin on the Arduino. (MPX5010DP operates between 4.7 V and 5.25 V with about the same current draw, so in that case it’s even more ideal) It’s also possible to run the amplifier circuit from the Arduino, if you decide to go down that road. All this also means that you can run a long cable (I used shielded 4-wire telephone cable, but any 3-wire cable should be fine) from your Arduino to your sump pit or water tank.

Circuits and PCBs

Bottom layer of PCB with pads, as PDF

Eagle files

The schematics for the amplifier circuit. Pin assignments for SV1 are identical with those on the MPX2010DP pressure sensor


The amplifier circuit takes the input from the pressure sensor and amplifies the 25 mV maximum output to something more useful, like 5 V. Initially I used the circuit from Practical Arduino, and it worked fine when supplied with 12 V. When powering it with only 5 V it wouldn’t give me enough gain, so I had to rework the resistor values. I also scrapped the fourth amplifier as it didn’t really do anything for me. In the end what I had was an instrumentation amplifier.

There is one trim potentiometer. It can be used to adjust the amplification, i.e. the sensitivity of the sensor, so that you get a good high reading for when the water level is high, and a good resolution in between.

The PCB layout for the amplifier circuit. The lines and pads are a bit on the small side for manual drilling and soldering, but it's worked out well.

For the second sensor – I have two sump pits – I created a PCB. It’s the first PCB ever that I designed myself and the second ever that I made myself, so it’s not exactly perfect. Most notably I didn’t change the size of anything on the board so all lines and connectors are very small, making it a pain to drill and solder.

Arduino Sketch

Arduino sketch WaterLevelSensorUdp_110912

Simple UDP Server to receive data from the Arduino WaterTank sketch – brelovich.se

The program for the Arduino is pretty simple. I read the value from the analog input A0 and send it out as a broadcast UDP message. This allows me to receive the results on any computer in the house and do whatever I like with the results. So far I’m just monitoring the values.

Of course I couldn’t leave it at that. For one thing, I need a way to calibrate the system and I don’t feel like modifying and uploading a new sketch for that, so I decided to create a serial port command line interface, allowing me to modify and read the trigger levels. I also made sure that the values are stored to the EEPROM and read back from there whenever the program starts, so that I won’t have to redo it whenever I need to reset the Arduino.

Simple Java UDP Server displaying the output from the Arduino. If you keep it running it will remember the highest and lowest levels recorded.

Power Supply

The Arduino and the sensors don’t draw a lot of current so any 5V (or higher) power source will do. I decided to a computer power supply from a disused Pico ITX case. I’m using the standby 5V rail to power the Arduino and sensors. This leaves me an assortment of 3.3V, 5V and 12V rails that I can use for future projects. Computer power supplies are nice as you can run your Arduino from the 5V standby rail and power power it on and off  through software. (Pull one of the digital outputs high, connect the green wire to it and then pull the pin low to turn on the power supply. Pull the pin high again to turn it off.)

Putting it all together

The pressure sensor and amplifier circuit, mounted in a splash-proof box. The two green hoses are for the air pressure (upper) and water pressure (lower)

I used small and really cheap, although water resistant electrical connection boxes for the sensor and the electronics that live in the sump pit. For the Arduino I  got a slightly smaller box to hold it and the power supply. I opted for one with a transparent lid so that I can see the electronics. I also got a case with some extra height to leave room for future shield extensions.

Arduino Ethernet and Pico-PSU mounted side by side on a plexi glass shield, fastened in the connection box.

Future plans

The first thing is to get yet another level sensor, for the second sump pit, wired up and to extend the sketch for that. Then there are all kinds of ideas for further sensors, maybe checking the temperature in and outside of the house and why not monitor the fridge and freezer?

I’m also thinking of connecting it to a mobile phone and enable the system to send me a text message whenever something unusual happens, such as the water rising above a specified level.

For now, however, I’ll be quite happy to get both sensors installed and calibrated and have my web server presenting the results. That should just be a few weeks off.


I may very well have missed something here. If you have any questions, please leave a comment and I’ll answer as soon as possible.

24 thoughts on “Water Level Sensor with Arduino Ethernet”

  1. Hi, Nice project. I have had a play with the same circuit. Quick question, do you get varied readings ie up and down as much 399 – 405 etc with no change in the water level or have I got something wired wrong. Regards Colin (Auckland NZ).

    1. Colin,

      Nice to hear from you!

      Yes, I do get some variation in the readings for a constant water level, so that’s probably normal.

      In fact, over time I get much more variation than that, but I suspect that’s due to changes in weather. The sensor is supposed to be differential and compensating for that but since it’s all closed-in I’m not sure how that’s working out.

      It doesn’t seem to be drifting at least, it’s just that the high level, where the pump starts, seems to be varying quite a lot.

      Right now I’m thinking about trying out an ultrasonic sensor for my second install. I’ll try putting a 75 mm pipe down the pit and then stick the ultrasonic sensor at the top. If that works out I should be able to measure the level in centimeters, making calibration a lot easier.

      Also, I’m planning a new program for the Arduino, based on the 1.0 release candidate.

      Watch this space for updates.

  2. Hi Brelovich, I was just about to order all the supplies for the amplifier circuit described in Practical Arduino but came upon your post here talking about the more ideal pressure sensor. Are you saying that no amplifier circuit is needed when using the MPX5010DP?

    How would you go about hooking the sensor directly to the analogue input? Would the -Vout from Pin 4 be the key to this?

    Thanks for any advice you can offer! I am trying to put together a water level logger for my research…I am a biologist hopelessly floundering in the world of electronics!

  3. Hey, I bought a pressure sensor to measure the tire pressure inside cars and I was wondering if you could help me understand why there are two holes? Like, the datasheet says to use a “vacuum” for the other end (MPX5500) and I was wondering if just…. air could be the other side?

    1. There are two holes, because the sensor measures the pressure difference. The ‘vacuum’ side is for the lower pressure. In this case you would leave it open to the outside air and connect the other hole to the tire.

  4. Brelovich,

    This project is really great !!!

    I have been trying to monitor my sump pumps with every different kind of arduino circuit and sensor. I used the MPX5010dp and it is working great. I post my data to Xively and have a high warning that sends me a Prowl notification. Thanks !!!

    Check it out at https://xively.com/feeds/42219


  5. Did you try out the idea with a ultra sonic sensor and a 75mm pipe? I’m trying to figure out the volume in a water tank. The entrance hole to the ~1800 litre tank is a 400mm pipe down the ground approx. 900mm. My initial attempt was with a ultra sonic sensor and it works fairly well but as the water level decreases, I do get more and more read errors due to echoing down the pipe. One idea is to isolate the sensor inside a pipe for less distraction but I haven’t tried it out yet.

    Thats when I started looking for alternative solutions like a pressure sensor. It disappoints me a bit that you had troubles as well and were thinking of a ultra sonic sensor instead.

    I would happily discuss this further if you have the interest and time.


  6. Oh,just saw that post about the ultra sonic sensor. You seem to experience the same problem as me.

    How do you deal with varations in pressure? Does it vary a lot?

  7. I see you share interesting things here, you can earn some additional
    money, your blog has huge potential, for the monetizing method, just search in google – K2 advices how to monetize a website

  8. I read a lot of interesting content here. Probably you spend a lot of time writing,
    i know how to save you a lot of time, there is an online tool that creates high quality, google friendly articles in seconds, just search in google – laranitas free content source

  9. How did you calculate Pressure values from the ADC output?
    Did you use the transfer function for MPX2010DP? I need some help on this.

  10. Do you need unlimited content for your blog ? I’m sure you spend
    a lot of time writing articles, but you can save it for other tasks,
    just type in google: kelombur’s favorite tool

  11. Hi,
    You did a great Job!!. I did my own version . It has a graphic LCD and 3 buttons to get access to Settings : Height (cm/inches), language, %, gallons or liters.
    I may automatically start a pump and turn it Off at any level .
    I can measure diesel, Battery bank (0-100vdc) as well.
    Good Blog.

  12. Hello blogger, i found this post on 11 spot in google’s search
    results. I’m sure that your low rankings are caused by hi bounce
    rate. This is very important ranking factor. One of the biggest reason for high bounce
    rate is due to visitors hitting the back button. The higher your bounce
    rate the further down the search results your posts and pages will end up, so having reasonably low
    bounce rate is important for increasing your rankings naturally.
    There is very useful wp plugin which can help you. Just search in google for:
    Seyiny’s Bounce Plugin

  13. Very informative article, i am regular reader of your blog.
    I noticed that your blog is outranked by many other blogs
    in google’s search results. You deserve to be in top ten. I
    know what can help you, search in google for:
    Omond’s tips outsource the work

  14. Hi, I’m building a system to measure the water level of a tank. I am using the differential pressure sensor MPX5050DP, but once calibrated works well, but after a while the sensor loses calibration and measuring less pressure. I’ve noticed that water gets to the measuring tube and I think this is the problem. How have you avoided getting water in the tube that is connected to sensor ?.


  15. Reading your content is big pleasure for me, it deserves to go viral, you need some
    initial traffic only. If you want to know how to get it search for: blackhatworren’s strategies

  16. Hi,

    Can you please post a pic of how you have connected the two green hoses are for the air pressure (upper) and water pressure (lower) as I am looking forward to make one.

    Thank You.

Leave a Reply

Your email address will not be published. Required fields are marked *