Exploring Arduino Water Level Sensors

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

In deze les zitten 27 slides, met interactieve quiz en tekstslides.

time-iconLesduur is: 60 min

Onderdelen in deze les

Exploring Arduino Water Level Sensors
By Jonathan Acheson

Slide 1 - Tekstslide

Deze slide heeft geen instructies

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 - Tekstslide

Deze slide heeft geen instructies

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 - Tekstslide

Deze slide heeft geen instructies

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 - Tekstslide

Deze slide heeft geen instructies

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 - Tekstslide

Deze slide heeft geen instructies

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

Slide 6 - Tekstslide

Deze slide heeft geen instructies

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 - Tekstslide

Deze slide heeft geen instructies

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 - Tekstslide

Deze slide heeft geen instructies

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 - Tekstslide

Deze slide heeft geen instructies

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 - Tekstslide

Deze slide heeft geen instructies

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 - Tekstslide

Deze slide heeft geen instructies

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 - Tekstslide

Deze slide heeft geen instructies

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


Slide 13 - Tekstslide

Deze slide heeft geen instructies

Code Explanation

Slide 14 - Tekstslide

Deze slide heeft geen instructies

Code Explanation

Slide 15 - Tekstslide

Deze slide heeft geen instructies

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 - Tekstslide

Deze slide heeft geen instructies

Code Explanation

Slide 17 - Tekstslide

Deze slide heeft geen instructies

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 - Tekstslide

Deze slide heeft geen instructies

Wiring for the Project

Slide 19 - Tekstslide

Deze slide heeft geen instructies

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 - Tekstslide

Deze slide heeft geen instructies

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 - Tekstslide

Deze slide heeft geen instructies

Arduino Code for the Project

Slide 22 - Tekstslide

Deze slide heeft geen instructies

Arduino Code for the Project

Slide 23 - Tekstslide

Deze slide heeft geen instructies

Arduino Code for the Project

Slide 24 - Tekstslide

Deze slide heeft geen instructies

Arduino Code for the Project

Slide 25 - Tekstslide

Deze slide heeft geen instructies

Arduino Code for the Project

Slide 26 - Tekstslide

Deze slide heeft geen instructies

Write down 3 things you learned in this lesson.

Slide 27 - Open vraag

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