Exploring Arduino Water Level Sensors

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

Cette leçon contient 27 diapositives, avec quiz interactif et diapositives de texte.

time-iconLa durée de la leçon est: 60 min

Éléments de cette leçon

Exploring Arduino Water Level Sensors
By Jonathan Acheson

Slide 1 - Diapositive

Cet élément n'a pas d'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 - Diapositive

Cet élément n'a pas d'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 - Diapositive

Cet élément n'a pas d'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 - Diapositive

Cet élément n'a pas d'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 - Diapositive

Cet élément n'a pas d'instructions

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

Slide 6 - Diapositive

Cet élément n'a pas d'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 - Diapositive

Cet élément n'a pas d'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 - Diapositive

Cet élément n'a pas d'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 - Diapositive

Cet élément n'a pas d'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 - Diapositive

Cet élément n'a pas d'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 - Diapositive

Cet élément n'a pas d'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 - Diapositive

Cet élément n'a pas d'instructions

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


Slide 13 - Diapositive

Cet élément n'a pas d'instructions

Code Explanation

Slide 14 - Diapositive

Cet élément n'a pas d'instructions

Code Explanation

Slide 15 - Diapositive

Cet élément n'a pas d'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 - Diapositive

Cet élément n'a pas d'instructions

Code Explanation

Slide 17 - Diapositive

Cet élément n'a pas d'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 - Diapositive

Cet élément n'a pas d'instructions

Wiring for the Project

Slide 19 - Diapositive

Cet élément n'a pas d'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 - Diapositive

Cet élément n'a pas d'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 - Diapositive

Cet élément n'a pas d'instructions

Arduino Code for the Project

Slide 22 - Diapositive

Cet élément n'a pas d'instructions

Arduino Code for the Project

Slide 23 - Diapositive

Cet élément n'a pas d'instructions

Arduino Code for the Project

Slide 24 - Diapositive

Cet élément n'a pas d'instructions

Arduino Code for the Project

Slide 25 - Diapositive

Cet élément n'a pas d'instructions

Arduino Code for the Project

Slide 26 - Diapositive

Cet élément n'a pas d'instructions

Write down 3 things you learned in this lesson.

Slide 27 - Question ouverte

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