Water Level Sensor Works with Arduino - Electronic and Telecommunication Engineering

Post Top Ad

Responsive Ads Here

Water Level Sensor Works with Arduino

Share This



     If you have ever had a water heater explode or ever tried to make submersible electronics, then you understand how important it's miles to come across when water is around.

   With this Water Level Sensor, you could do just that!

   This sensor may be used to measure the water degree, display a sump pit, locate rainfall or locate leakage.


Hardware Overview

    The sensor has a chain of ten uncovered copper lines, five of which can be energy traces and five are feel strains.

    These strains are interlaced so that there may be one feel trace among each  energy lines.

    Usually these strains aren't related however are bridged by using water while submerged.









     There’s a Power LED on the board for you to light up when the board is powered.


How Water Level Sensor Works?


    The running of the water stage sensor is quite truthful.

    The collection of exposed parallel conductors, together acts as a variable resistor (similar to a potentiometer) whose resistance varies consistent with the water degree.

   The alternate in resistance corresponds to the space from the pinnacle of the sensor to the surface of the water.







   ðŸ‘‰The more water the sensor is immersed in, consequences in better conductivity and could result in a lower resistance.

   ðŸ‘‰The less water the sensor is immersed in, effects in bad conductivity and could bring about a better resistance.

  👉The sensor produces an output voltage consistent with the resistance, which through measuring we are able to decide the water stage.


Water Level Sensor Pinout

  💬  The water degree sensor is exquisite smooth to apply and pleasant has 3 pins to attach.






💬 S (Signal) pin is an analog output on the way to be associated with one of the analog inputs to your Arduino.

💬 + (VCC) pin additives power for the sensor. It is recommended to power the sensor with amongst 3.3V – 5V. Please examine that the analog output will range depending on what voltage is furnished for the sensor.

💬 – (GND) is a ground connection.


Wiring Water Level Sensor with Arduino


   Let’s hook the water degree sensor as a top notch deal because the Arduino.

First you want to deliver strength to the sensor. For that you may be part of the + (VCC) pin on the module to 5V at the Arduino and – (GND) pin to ground.

   However, one typically recognized issue with those sensors is their short lifespan at the same time as exposed to a moist environment. Having energy finished to the probe constantly speeds the price of corrosion drastically.

To triumph over this, we recommend which you do now not power the sensor continuously, however strength it handiest while you are taking the readings.

   An smooth way to accomplish that is to connect the VCC pin to a digital pin of an Arduino and set it to HIGH or LOW as steady with your requirement. So, we’ll be a part of the VCC pin to the virtual pin #7 of an Arduino.

   Finally, join the S (Signal) pin to the A0 ADC pin for your Arduino.







Water Level Sensing Basic Example

Once the circuit is built, add the following cartoon for your Arduino.


👉 ARDUINO CORDING 👈 



// 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 energy flows through the sensor
digitalWrite(sensorPower, LOW);
Serial.Begin(9600);


void loop() 
//get the reading from the characteristic underneath and print it
int degree = readSensor();
Serial.Print("Water stage: ");
Serial.Println(level);
put off(1000);


//This is a characteristic used to get the studying
int readSensor() 
digitalWrite(sensorPower, HIGH); // Turn the sensor ON
put off(10); // wait 10 milliseconds
val = analogRead(sensorPin); // Read the analog cost form sensor
digitalWrite(sensorPower, LOW); // Turn the sensor OFF
return  val; // ship contemporary reading
}



   You need to see a value zero when the sensor isn't always touching anything. To see it feel water, you may take a glass of water and slowly put the sensor in it.





Explanation:

  The sketch starts offevolved with the declaration of the Arduino pins to which the sensor’s + (VCC) and S (signal) pins are linked.

#define sensorPower 7
#define sensorPin A0

Next, we define a variable val that shops the contemporary water degree.

int val = 0;


Now in the Setup phase, we first claim the power connection to the sensor as output, then we set it low so no power flows thru the sensor first of all. We additionally setup the serial monitor.

pinMode(sensorPower, OUTPUT);

digitalWrite(sensorPower, LOW);
Serial.Begin(9600);

In the loop section, we name readSensor() function repeatedly on the c language of 1 2nd and print the back cost.


Serial.Print("Water stage: ");

Serial.Println(level);
put off(1000);


The readSensor() characteristic is used to get the modern water level. It turns the sensor ON, waits for 10 milliseconds, reads the analog value shape sensor, turns the sensor OFF and then returns the analog fee.


        int readSensor() 

digitalWrite(sensorPower, HIGH);

        delay = 10;

val = analogRead(sensorPin);

digitalWrite(sensorPower, LOW);

return  val;


Calibration

   To get accurate readings out of your water degree sensor, it's far endorsed which you first calibrate it for the unique type of water that you plan to screen.

   As you realize natural water isn't conductive. It’s definitely the minerals and impurities in water that makes it conductive. So, your sensor may be extra or less sensitive relying at the type of water you use.

    Before you begin storing facts or triggering events, you ought to see what readings you're surely getting from your sensor.

   Using the comic strip above, note what values your sensor outputs whilst the sensor is absolutely dry -vs- while it's far partially submerged within the water -vs- while it's miles absolutely submerged.

    For example, the usage of the equal circuit above, you’ll see the close to the following values within the serial display while the senor is dry (0) and when it's miles partially submerged inside the water (~420) and whilst it's miles absolutely submerged (~520).






     This check may additionally take a few trial and errors. Once you get an awesome manage on these readings, you may use them as threshold in case you intend to cause an movement. In the next example, we are going to do simply that.


No comments:

Post a Comment

Post Bottom Ad

Responsive Ads Here

Pages