Exploring Arduino Water Level Sensors

Exploring Arduino Water Level Sensors
By Jonathan Acheson
1 / 27
next
Slide 1: Slide
ArduinoHigher Education (non-degree)

This lesson contains 27 slides, with interactive quiz and text slides.

time-iconLesson duration is: 60 min

Items in this lesson

Exploring Arduino Water Level Sensors
By Jonathan Acheson

Slide 1 - Slide

This item has no instructions

Learning Objective
At the end of the lesson you will understand the functionality of Arduino water level sensors, learn how to wire and code them, and be able to create a water level indicator project.

Slide 2 - Slide

This item has no instructions

Overview of Arduino Water Level Sensor
Arduino water level sensors are electronic devices designed to detect and measure the water level in a tank or container. They are commonly used in automated systems for water management and monitoring.

Slide 3 - Slide

This item has no instructions

How Does a Water Level Sensor Work?
Water level sensors work on the principles of conductivity or ultrasonic technology. Conductive sensors use the electrical conductivity of water to detect its presence, while ultrasonic sensors emit and receive ultrasonic waves to measure the distance to the water surface.

Slide 4 - Slide

This item has no instructions

Hardware Overview
The sensor has ten exposed copper traces, five of which are power traces and the remaining five are sense traces. These traces are interlaced so that there is one sense trace between every two power traces.

Normally, power and sense traces are not connected, but when immersed in water, they are bridged.

Slide 5 - Slide

This item has no instructions

Hardware Overview
There is a Power LED on the board, 
which will light up when the board is 
powered.

Slide 6 - Slide

This item has no instructions

How does it work???
The operation of the water level sensor is fairly simple.

The power and sense traces form a variable resistor (much like a potentiometer) whose resistance varies based on how much they are exposed to water.

Slide 7 - Slide

This item has no instructions

How does it work???
The operation of the water level 
sensor is fairly simple.
The power and sense traces form
 a variable resistor 
(much like a potentiometer) whose 
resistance varies based on how
 much they are exposed to water.

Slide 8 - Slide

This item has no instructions

How does it work???
The more water the sensor is immersed in, the better the conductivity and the lower the resistance.
The less water the sensor is immersed in, the poorer the conductivity and the higher the resistance.
The sensor generates an output voltage proportional to the resistance; by measuring this voltage, the water level can be determined.

Slide 9 - Slide

This item has no instructions

Wiring a Water Level Sensor
Let’s hook up the water level sensor to the Arduino.

To begin, connect the + (VCC) pin on the module to 5V on the Arduino and the – (GND) pin to ground.

Slide 10 - Slide

This item has no instructions

Wiring a Water Level Sensor
One well-known issue with these sensors is that they have a shorter lifespan because they are constantly exposed to moisture. Moreover, constantly applying power to the sensor while immersed in water significantly accelerates the rate of corrosion.

Slide 11 - Slide

This item has no instructions

Wiring a Water Level Sensor
To avoid this, it is recommended that the sensor be turned on only when taking readings.

One easy way to do this is to connect the sensor’s power pin to a digital pin on an Arduino and set it to HIGH or LOW as needed. So, we’ll connect the + (VCC) pin to the Arduino’s digital pin #7.

Slide 12 - Slide

This item has no instructions

Wiring a Water Level Sensor
Finally, connect the S (Signal)
 pin to the Arduino’s A0 ADC pin.


Slide 13 - Slide

This item has no instructions

Code Explanation

Slide 14 - Slide

This item has no instructions

Code Explanation

Slide 15 - Slide

This item has no instructions

Code Explanation
After uploading the sketch, open the Serial Monitor window to view the output. When the sensor is dry, it will output a value of 0; however, as the sensor is immersed in water, the output will gradually increase.


Slide 16 - Slide

This item has no instructions

Code Explanation

Slide 17 - Slide

This item has no instructions

Arduino Project – Water Level Indicator
We’ll reuse the previous example’s circuit. We only need to add some LEDs this time.

Connect three LEDs to digital pins #2, #3, and #4 using 220 ohm resistors.

Connect your circuit as shown below:


Slide 18 - Slide

This item has no instructions

Wiring for the Project

Slide 19 - Slide

This item has no instructions

Arduino Code for the Project
After constructing the circuit, upload the following sketch to your Arduino.

This sketch defines two variables: lowerThreshold and upperThreshold. These variables represent our thresholds.


Slide 20 - Slide

This item has no instructions

Arduino Code for the Project
If the output falls below the lower threshold, the red LED will light up, if it rises above the upper threshold, the green LED will light up, and if it falls somewhere in the middle, the yellow LED will light up.

Slide 21 - Slide

This item has no instructions

Arduino Code for the Project

Slide 22 - Slide

This item has no instructions

Arduino Code for the Project

Slide 23 - Slide

This item has no instructions

Arduino Code for the Project

Slide 24 - Slide

This item has no instructions

Arduino Code for the Project

Slide 25 - Slide

This item has no instructions

Arduino Code for the Project

Slide 26 - Slide

This item has no instructions

Write down 3 things you learned in this lesson.

Slide 27 - Open question

Have students enter three things they learned in this lesson. With this they can indicate their own learning efficiency of this lesson.