Ultrasonic Sensor Using IoT

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 18

Department of Electrical and Electronics

Engineering

Under the guidance of


Prof.Shripadaraj M. Inamdar
Prof.Kirankumar N. Hittanagi

Internship Co-ordinator : Internship Associate:


Ravindra Motekar Ranganath Gaonkar
(2VD18EE406)
IoT Based Water Level
Indicator Using Ultrasonic
Sensor
INTRODUCTION
 Today we will be working on a Water level indicator whose data can be
monitored through a webpage over a local area network. The water level
will be detected by using an ultrasonic distance measurement sensor.
 In this project, we will use an ultrasonic sensor for detecting the level of
water.
 For making the project more user friendly, we will be integrating it with a
local webserver through which you can monitor the data from any device
connected to the same Wi-Fi as your ESP board.
Ultrasonic Sensor Work and Use
 Before understanding the working of the project, let us
first see how an ultrasonic sensor works. A typical HC-
SR04 ultrasonic sensor used in this project is shown
below.
 Ultrasonic sensor is an electronic device that measures
the distance of a target object by emitting ultrasonic
sound waves and converts the reflected sound into an
electrical signal.
 Ultrasonic waves travel faster than the speed of
audible sound (i.e. the sound that humans can hear).
Ultrasonic sensors have two main components: the
transmitter (which emits the sound using piezoelectric
crystals) and the receiver (which encounters the sound
after it has traveled to and from the target).
APPLICATIONS
 Contactless Temperature measurement.
 IoT based Inventory management.
 Robot navigation.
 factory automation.
 Water-level sensing
 Flood Detection and Monitoring system.
Ultrasonic Sensor for Measuring Water
Level
 So, now as we know the working of the ultrasonic
sensor, it is pretty straightforward to understand the
working of the project.
 We just have to read the values from the sensor and
convert it to CMs and after doing all that, we have to
publish the data in a local webserver that will be
created by our NodeMCU board after getting
connected to Wi-Fi.
Required Components
 ESP8266 NodeMCU board: This will be the heart of
our whole project.
 HC-SR04 Ultrasonic Sensor: This will be used for
sensing the level through ultrasonic sound waves as
explained earlier.
 Breadboard: All the connections will be made on the
breadboard itself for making it simple.
 Jumper wires: As we are using a breadboard, jumper
or hookup wires are the way to go for connections.
Interfacing Ultrasonic Sensor with
NodeMCU
 As we are not using many components, the IoT water
level indicator circuit diagram used in this project is
fairly simple.
 We just need to connect the HC-SR04 Ultrasonic
sensor to our NodeMCU module.
 The rest of the work will be done via the software part
itself.
Here is the circuit diagram for the connection.
 I used a breadboard to connect my ultrasonic sensor
with the NodeMCU and then used connecting wires to
make the connection. The testing set-up of mine looks
like this below,
Programming NodeMCU to Read Water
Level and Display on the Webserver
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
int TRIGGER = D3;
int ECHO = D2;
// Replace with your network credentials
const char* ssid = "Comet";
const char* password = "evilzebra";
ESP8266WebServer server(80); //instantiate server at port 80 (http port)
String page = "";
int data;
void setup(void){
pinMode(TRIGGER, OUTPUT);
pinMode(ECHO, INPUT);
delay(1000);
Serial.begin(115200);
WiFi.begin(ssid, password); //begin WiFi connection
Serial.println("");
// Wait for connection
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.print("Connected to ");
Serial.println(ssid);
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
server.on("/", [](){
page = "<head><meta http-equiv=\"refresh\" content=\"3\"></head><center><h1>Web
based Water Level monitor</h1><h3>Current water level is :-</h3> <h4>"+String(data)
+"</h4></center>";
server.send(200, "text/html", page);
});
server.begin();
Serial.println("Web server started!");
}
void loop(void){
digitalWrite(TRIGGER, LOW);
delayMicroseconds(2);
digitalWrite(TRIGGER, HIGH);
delayMicroseconds(10);
digitalWrite(TRIGGER, LOW);
long duration = pulseIn(ECHO, HIGH);
data = (duration/2) / 29.09;
server.handleClient();
}
IoT Based Water Level Indicator Testing
and Working
 This is the webpage that we have created using our
NodeMCU board. It contains a heading that is, Web-
based Water Level Indicator, below which is printing
the live data coming through the HCSR04 Ultrasonic
sensor. The water level values are printed in CMs, the
less the value, the less empty the container, and vice
versa.
CONCLUSION
This project involved in designing and development of
automatic water level control system had exposed to the
better way software and hardware architecture that
blends together for the interfacing purposes.The system
employs the use of advance sensing technology to detect
the water level.
THANK YOU

You might also like