Thursday, July 6, 2017

5 - Arduino: Water level sensor


- Layout for this exercise:

- The goal of this exercise is to use a water level sensor with an Arduino board that could be useful for detecting water level presence in different scenarios like a basement or facility flood, outdoor rain sensors, etc ...

- As seen in the picture the water sensor has got 3 pins connected to the Arduino board in this way:

  • VCC = 5 V
  • GND = GND
  • S (sensor) = A0 (Arduino analog input) 

- Code for the circuit:

- The code takes the reading from the sensor S what is directly connected to the Arduino analog input A0.

- According with the reading value the calibration goes from 0 to more than 700 dividing into four different intervals.

- Starting from "No water" (the sensor is not in contact with water), and after introducing the sensor into a vessel filled with water, the serial output indicates the change immediately and the corresponding water level height:

- Testing the circuit: