Introduction: How to Use the Water Level Sensor - Arduino Tutorial

In this tutorial you will learn how to use a water level sensor with the Arduino uno board.

This module is designed mainly for the DIY hobbyist and provide them a low-cost and easy-to-use water level detection scheme. The sensor that I will use for this tutorial can measure water level up to 40mm (4cm).

This is an analog sensor and the data that we will read will be values from 0 to 1024.

Let's get started and find out more about it.

Step 1: What You Will Need

For this project you will need:

  • Arduino uno
  • Breadboard
  • Water Level Sensor

Step 2: The Circuit

The connections are pretty easy!

  • Vcc - Arduino 5V
  • GND - Arduino GND
  • A0 - Arduino Analog pin 0

Step 3: Find Analog Values

We need to find analog values for our sensor.

Upload the following sketch on Arduino by pressing the "Run on Arduino" button and then press the "Connect" button to start serial communication.

Now take a glass of water and slowly put in it the sensor.

My analog values from this procedure are:

  • 0mm - 480
  • 5mm - 530
  • 10mm - 615
  • 15mm - 660
  • 20mm - 680
  • 25mm - 690
  • 30mm - 700
  • 35mm - 705
  • 40mm - 710

As you can see the sensor resolution decreases as the water reaches the maximum level.

On next step we will map those values to print on serial monitor the level of water on mm.

Step 4: The Code

Here's the code, embedded using codebender!

Upload the following sketch on Arduino by pressing the "Run on Arduino" button and then press the "Connect" button to start serial communication.

You can keep playing with that by clicking the "Edit" button and start making your own modifications to the code. For example try to change the delay time.

Step 5: Well Done!

You have successfully completed one more Arduino "How to" tutorial and you learned how to use the water level sensor.

I hope you liked this, let me know in the comments.

There will be more of them, so make sure to click Follow button!


yussufbn (author)2017-07-14

pls i need ypur help on my project. which is "automated poultry feed and water supply" am using water level sensor and pressure load sensor

licheong (author)2016-08-06

Thanks! I'm trying to measure the water level on my balcony, but I wonder if there's any risk of short circuit if the water spills over the top. Is there any way to make the top part of the sensor water-proof?

Waylon194 (author)licheong2017-04-12

I know this post is very old but I just wanted to give an answer.

You have 2 options:

1. Add heat shrink to the top of the sensor, this will prevent rain from getting on the board but it does NOT make it waterproof.

2. Add hot glue/silicon sealing(I am not sure if you can use any type of sealent).

Patrick_74 (author)2016-11-06

Can we use that sensor with gasoline, glow fuel nitromethane?

Hooikraal (author)2016-10-20

Thankyou, that helped.

Nur Anis AmirahH (author)2016-09-15


About This Instructable




Bio: Arduino Tutorials by Team
More by codebender_cc:How to use a magnetic door switch / sensor with ArduinoHow to Measure LUX With ArduinoHow to Control an RGB LED Strip - Arduino Tutorial
Add instructable to: