Arduino Water Level Sensor

In this post we will go over how to use a water level sensor with Arduino. We’ll go over sensor basics, how to connect it to an Arduino, programming it in Arduino IDE, and testing.


The water level sensor works due to its exposed traces, which are used to sense the water level. The water level is measured across a full spectrum, meaning is the sensor isn’t simply confirming the presence of water, it is actually measuring the level. Since the sensor is measuring the level, let’s look at the sensor length (since it’s important to make sure it will meet the needs of your project!).

Water Level Sensor Length

The sensor being used as part of this post has a total measuring length of ~1.6in (41mm) (see image on the right showing in inches and mm). This is pretty consistent with other water level sensors sold for Arduino, Raspberry Pi, etc… This is important so you know the total range over which you will be able to measure.

Water level sensor length

Sensor Pins & Connections to Arduino

(+) – Positive pin, goes to +5V. Acceptable voltage is 3.3V – 5V.
(-) – Negative pin, goes to GND
S – Signal pin, goes to the Analog IO Pin A0

Water level sensor pins.
Water level sensor connection to Arduino

Click to enlarge

*Note that Analog IO pins work different than Digital IO pins. Analog pins will provide a numeric value (over a numeric range) associated with the signal being read at the pin. This range will cover all integers from 0 to 1023. The 0 corresponding to a 0 volt signal, and 1023 corresponding to a 5.0 volt signal. In contrast, the Digital pin can only provide two values 0 or 1 (Off or On). This allows you to take action in case you want to have different operating scenarios (maybe level 1 alarm once the sensor starts sensing water and critical level 2 alarm once the sensor reaches 80% of the total length, up to you!).

Arduino Code

Run Arduino Code – Water Level Sensor Testing

All you need to do now is copy the code that was provided above, run it and open the Serial Monitor.

Click to enlarge

Components used in this example

*As an Amazon & Ebay Associate I earn from qualifying purchases.

ComponentLink
Arduino UNOhttps://amzn.to/3uYVAMC
https://ebay.us/veZdKX
Water level sensorhttps://amzn.to/2QeI4Wt
https://ebay.us/JjrZEA

One Reply to “Arduino Water Level Sensor”

Leave a Reply

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