Here we measure water level using JSN SR-04T Waterproof Ultrasonic Sensor and Arduino interfacing.
Summary:
Here we measure water level using JSN SR-04T Waterproof Ultrasonic Sensor and Arduino interfacing.
About Project
JSN-SR0T4 is basically a waterproof ultrasonic distance measurement sensor module that can give 25cm-450cm non-contact distance measurements, with a ranging accuracy of near about to 2mm.
JSN SR-04T sensor module having an industrial-grade integrated ultrasonic sensing probe design, waterproof type, stable performance as well as high precision. It can be also be utilized in horizontal ranging, obstacle avoidance, automated control, analyzing of objects as well as their movement, traffic control, security and other applications.
It utilizes the same transducer to both transmit as well as receive the signal so it requires time to switch from one mode to another.
The sensor itself is enclosed in a waterproof enclosure, which might be helpful if you want to place it outside in harsher environments.
#include<LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 4, 5, 6, 7); // sets the interfacing pins
#define ECHOPIN 3
#define TRIGPIN 2
void setup() {
Serial.begin(9600);
lcd.begin(16, 2); // initializes the 16x2 LCD
pinMode(ECHOPIN,INPUT_PULLUP);
pinMode(TRIGPIN, OUTPUT);
digitalWrite(ECHOPIN, HIGH);
}
void loop() {
lcd.clear();
digitalWrite(TRIGPIN, LOW);
delayMicroseconds(2);
digitalWrite(TRIGPIN, HIGH);
delayMicroseconds(15);
digitalWrite(TRIGPIN, LOW);
int distance1 = pulseIn(ECHOPIN, HIGH, 26000);
int distance=distance1/58;
Serial.print(distance);
Serial.println(" cm");
lcd.setCursor(0,0); //sets the cursor at row 0 column 0
lcd.print("Water Level"); // prints 16x2 LCD MODULE
lcd.setCursor(0,1);
lcd.print(distance);
delay(500);
}