SEN18 Water level sensor working and Arduino interface

The necessity of detecting the presence of water is clear to anyone who has ever had a water heater explode or attempted to build submersible electronics. You may achieve it with the help of this water level sensor.

How SEN18 water level sensor works

The water level sensor’s operation is rather simple. A potentiometer-like variable resistor, the series of exposed parallel conductors, changes resistance in response to the water level. The difference in resistance reflects the separation between the water’s surface and the sensor’s top.

The resistance decreases inversely with increasing water height:

Better conductivity and lower resistance are produced by submerging the sensor in more water, which increases its depth. Because of weak conductivity and higher resistance, the less water the sensor is submerged in, the better. By the resistance, the sensor generates an output voltage that, when measured, allows us to ascertain the water level.

Sensor physical appearance

This sensor can gauge water level, keep an eye on a sump pit, track down rain, or find leaks. Ten copper traces on the sensor are divided into five power traces and five sensing traces. There is one sense trace between each pair of power traces due to the interlacing of these traces.

Water level sensor pinout

It only requires 3 pins to attach the water level sensor, making it very simple to operate.

S: Analog input on your Arduino will be connected to the S (Signal) pin, which gives an analog output.

VCC: The sensor is powered by the + (VCC) pin. It is advised to supply the sensor with 3.3V to 5V of electricity. Please be aware that the analog output will change depending on the voltage applied to the sensor.

GND: is a link to the ground.

Material required

S. NoItemsUnits
1Arduino Uno1
2WiresAs per requirements
3Water sensor1

Circuit connection

Connecting the Arduino and water level sensor is the next step.

Powering the sensor up is the first step. The module’s + (VCC) pin can be connected to the Arduino’s 5V supply, and the – (GND) pin can be connected to the ground.

But a well-known drawback of these sensors is that they only last a short time in damp environments. Constantly applying power to the probe dramatically accelerates corrosion.

To get around this, we advise that you only power the sensor when you need to capture readings rather than leave it on all the time.

Connecting the VCC pin to an Arduino digital pin and setting it to HIGH or LOW, depending on your needs, is a simple way to achieve this. Therefore, we will join the VCC pin to the Arduino’s digital PIN seven.

Last but not least, join your Arduino’s A0 (Signal) pin to the S sensor pin.

Code

Upload the subsequent sketch to your Arduino after completing the circuit.

// Sensor pins
#define sensorPower 7
#define sensorPin A0

// Value for storing water level
Int val = 0;

Void setup() {
	// Set D7 as an OUTPUT
	pinMode(sensorPower, OUTPUT);
	
	// Set to LOW so no power flows through the sensor
	digitalWrite(sensorPower, LOW);
	
	Serial.begin(9600);
}
Void loop() {
	//get the reading from the function below and print it
	Int level = readSensor();
	
	Serial.print(“Water level: “);
	Serial.println(level);
	
	Delay(1000);
}
//This is a function used to get the reading
Int readSensor() {
	digitalWrite(sensorPower, HIGH);	// Turn the sensor ON
	delay(10);							// wait 10 milliseconds
	val = analogRead(sensorPin);		// Read the analog value form sensor
	digitalWrite(sensorPower, LOW);		// Turn the sensor OFF
	return val;							// send current reading
}

Open a Serial Monitor window after uploading the program to view the Arduino’s output. When the sensor is not in contact with anything, you should see a value of 0. You may carefully lower the sensor into a glass of water to watch it detect moisture.

The + (VCC) and S (signal) pins of the sensor are connected to the Arduino pins declared at the beginning of the sketch. The current water level is stored in a variable called Val that we define next. We now define the power connection to the sensor as output in the Setup section before setting it low to prevent any power from flowing through it at first. Additionally, we set up

FAQs

  1. What is the water level sensor’s operating range?

Ans:- Three different ultrasonic water level sensor ranges—3 feet, 12 feet, and 48 feet—are offered to accommodate a range of applications. The special 3 ft range ultrasonic water level sensor is perfect for measuring flow in tiny flumes and weirs.

2. Why do we need indicators of water level?

Ans:- Electric substations, manufacturing facilities, chemical plants, and other liquid storage systems all use the water level indicator circuits. This straightforward system has a wide range of potential applications, including leak detection, rainfall detection, and monitoring of a sump pit (to regulate pump activation).

3. How exact is the level of the water?

Ans;- Measurement of Current as a Percentage in Water Level. To determine how much is in the tank, ultrasonic sensors use sound waves that bounce off the surface of the liquid. The resolution of these liquid-level sensors can reach 0.1 inches. (2.5mm) and 0.25% of the detected range accuracy (current reading).

4. What kinds of water sensors are there?

Ans:- There are several different types of water sensors, including float sensors, pressure transducers, ultrasonic sensors, and bubblers.

5. What is the function of the readsensor()? 

Ans:-After We run the read Sensor() function periodically at one-second intervals in the loop section, it will show us an overview of the result. The current water level can be obtained using the readSensor() function while making a water level sensor. You just turn the sensor ON, wait 10 ms, read the analog value from the sensor, turn the sensor OFF, and then output the analog value.

6. Explain the calibration of the water level sensor? 

Ans:- It is advised that you calibrate your water level sensor for the specific type of water you intend to monitor to get reliable results. Pure water is not conductive, as you are aware. Water is conductive because of the minerals and impurities in it. As a result, depending on the type of water you use, your sensor may be more or less sensitive.

See what readings your sensor is truly giving you before you start saving data or setting off actions. Use the aforementioned sketch to note the readings your sensor produces when it is totally dry when it’s slightly submerged in water, and when it’s completely submerged.

6. Can you create a water level indicator at home?

Ans:- If you can collect all the necessary materials, including LEDs, a water sensor, and sensing wires. So creating a straightforward water level indicator is not difficult.

1 thought on “SEN18 Water level sensor working and Arduino interface”

Leave a Comment