2.29 Water Sensor Module¶
In this lesson, you will learn how to use a water sensor module. A water sensor module is designed for water detection, which can be widely used in sensing the rainfall, water level, even the liquid leakage.
In this example, we directly connect the pins of Water Sensor Module to pins of Mega 2560 Board. We use analog A0 to get the value of Water Sensor Module, and get the pin「S」of Water Sensor Module to A0, 「-」to GND, 「+」to 5V.
You can open the file
2.29_waterSensorModule.inounder the path of
Or copy this code into Arduino IDE.
After uploading the code to the Mega2560 board, you can open the serial monitor to see the read value of the pin. As the water level rises, the readings increase. Readings vary within the range 「0」~「1023」, but influenced by the environmental condition and the characteristics of water level sensor, the actual reading range may be smaller than the theoretical range. Refer to Part 1-1.5 Analog Read to check the detail code explanation.