IOT Project: Smart Water Tank with Real-Time Dashboard | Home Automation
ฝัง
- เผยแพร่เมื่อ 28 ธ.ค. 2024
- This video is about a project on Internet of things. It involves measuring the water level of my overhead water tank using Raspberry Pi and an ultrasonic distance sensor HC-SR04. Raspberry Pi is programmed to take the water level readings every minute and send the data to a remote custom Web Application hosted in a far off location. The custom Web Application provides a real-time update of the water tank level.
Link to the live dashboard (Web App) for remote monitoring:-
helloworld.co....
Read Full Article:-
helloworld.co....
The source code of the project can be downloaded from:-
github.com/jit...
The Web Application integrates with following APIs / Libraries to generate the GUI:-
FusionCharts APIs to display animated tank widget.
www.fusionchar...
PHPlot library to plot the readings on a graph.
phplot.sourcefo...
#IOT #HomeAutomation #RaspberryPi
👉 Complete Playlist of Robotics projects
• AI Robot: Object Track...
Home Automation
👉 IOT Project: Raspberry Pi GPIO controls over wifi
• IOT Project: Raspberry...
I am a user of this project and after a few months of use I can assure you that I am very happy with how it works. Just one observation: in large tanks with top filling, while the water is entering the waves are produced, they give erroneous readings to the ultrasonic sensor (since the waves do not bounce in a straight line). During the emptying, with calm water, the readings are perfect and stable. I will try to place some kind of cone-shaped plastic bottleneck in the sensor area to see if reception improves during filling.
After you give cone-shaped plastic in the sensor area, the readings are stable eventhough the water is flowing??
Yes
Loving the graphics! :)
Thanks a lot 😊
one the best channel i came across so far, excellent video editing and technical information conveyed is easily understandable.. Great work!!
Thank you
Hi Guys! I m newbie, follow the logic from tutorial and try to understand the connection im between script and script . I made it works =) thank you jitesh for answering all my email.
By the way, It took me 3 days to finally solved the puzzle lol. There is no clear tutorial. Basically do trial and error. When u out of a way. Email jitesh. He will replied you with some guidance. =)
loving the idea, such humble sharing
Thanks a lot
How did you water proofed ultrasonic sensor?. water content will be there on walls of tank.
I got lost in 2:45 I don’t know what to do with the circuit
the circuit is made to achieve the resistance configuration between blue and black wire as shown in the diagram at 2:54
@@jitesh_helloworld do i use only 1 k ohm and 2 k ohm?
@@msharialosimi9782 yes. thats right. the resistors make a voltage divider circuit to reduce the 5V signal to 3.3V, which is compatible with echo pin. Read more about it here
thepihut.com/blogs/raspberry-pi-tutorials/hc-sr04-ultrasonic-range-sensor-on-the-raspberry-pi
@@jitesh_helloworld hi, i have one question and sorry to bother you me we did everything except the website for bottle we need your help
Pl ask
Nice tutorial sir. Can you help me what those resistors do ? why the configuration one in series one in parallel ?
That's simply a voltage divider circuit to make 5v pin of RPi compatible with 3.2v pin of sensor
Raspberry Pi works on about 3V/5V, and the ultrasonic sensor has around 4 pins to be connected. I see you have used an ethernet cable to tackle it, good job with that. But since you're running the cable between Pi at home and the sensor on the tank site, wouldn't the long cable result in voltage drop, erroneous readings and miscellaneous interferences. What's the length of the ethernet cable you're using and the VCC supplied through it?
Haven't faced any issues .. I'm using approx 25-30 meter cable. Quality of the cat 6 cable cores is quite good. One core is supplying 5V VCC from Raspberry Pi to sensor.
no cable is needed. You just make sure that your wifi signals reaches up to your tank and install rasp-pi on the tank lid just insert a 5 volt supply to it there and it will get connected to the internet.
This is really good man.
Thanks
I need something for nodemcu, that can show graph on Alexa echo show.any help
this is exactly what I have been looking for. thanks a bunch.
Awesome!!! can you do a video of this project with esp32 also ?
Thanks for the videos, helpful, but please how can i use it for oil tank like Diesel or Petrol or is there a sensor for that, Thanks
Ultrasonic sensors can work with any liquid surface. Water, petrol, diesel whatever. I have tried the water proof sensor JSN-SR04T with raspberry Pi. It works just fine. You consider that also
@@jitesh_helloworld Thanks for the response, really helped you are the best
Can be used for deisel tank
Would it be possible to add some kind of full-empty notification or alarm? It would be ideal.
The low_level_warning() actuates a GPIO when certain level is reached. You can add a hardware alarm or send an email. A notification via Web Application also requires some modification in the PHP script to send emails.
Great Job, Thank you.
Much needed solution, Great job !!
I guess using Raspberry Pi would not be the cost effective solution. Did you try with Arduino or any other cost effective solution.
Thanks.. You can reduce the cost by using ESP32 in place of Raspberry Pi. It has built in wifi and much less cost.
A JSN-SR04T can be better sensor for this application. Though the sensor can not measure distance below 21cm, but it can withstand water/humidity.
Sure it could be. But considering the cost (mere 150/-) and range (upto 400cm), i guess HC-SR04 is not a bad choice. Its been a month now since i have deployed it and it is working satisfactorily.
Hello , what's the specification of the raspberry pi ? which variant to use 2GB/4GB?
You can use any one. Any model of Pi 3 or Pi 4
@@jitesh_helloworld hello sir I have made the data base as ler the instruction in the git hub provided by you but I am facing problem in creating a website and connect it to the data base and raspberry pi.
Hello sir I have hosted a local server as per the instruction in the github but I am facing issue in connecting the raspberry pi to the server. So how should I determine the IP to be used in the server? And how to get login and password. ??
Can we use esp8266 instead of rashberrypi?
Hi JItesh bro can you please give us step by step tutorial, i was wondering in side the box what is the use of relay switch and how the light bulb turned on when water level is low. Please provide step by step that would be helpful us
Hi there. Just wait for about 10 days, Im coming up with something.
@@jitesh_helloworld hi Jitesh bro many thanks I'm 100% the full tutorial would help many people here. Great work you are doing please continue it.
Hi bro full tutorial please
Good content, instant subscribe from an IoT newbie (me) !
Thank you 😊
How resistant to humidity is the sensor? Does it stop working after certain amount of time because of that?
I live in an area with lots of humidity, and a water tank multiplies that.
To answer myself, turns out that there are waterproof ultrasonic sensors. The model of the one I saw is JSN-SR04T, altought I am sure that there must be others.
Correct. You can use JSN-SR04T sensor. It has same pin connections as the one shown in this video
Nice project and smart
Thank you
have you looked at running the app and display stack locally on your RPi ? I'd prefer to have ti all locally.
Yes. I built my prototype that way. Totally done thing
@@jitesh_helloworld will have to try... always option to package the app as a docker container that could be deployed onto Home Assistant/HAOS
Nice suggestion.. It occurred to me but didn't pursue.. If you happen to achieve it, pl share
Hello. I am testing the code with both the JSN-SR04T and HCSR-04 sensors but from about 220 cm, both give me wrong data (very high). What could it be due to? I need a distance of about 3 meters.
Max range of these sensors is around 400 CM.. You can test them with other test codes available on internet also. Let me know if that works
How has your project fared? I want to do this, but im afraid it the sensor will rust
Its working fine. The sensor is very cheap (2-3 dollars max) and reliable. Even if it rusts in 6-8 months, you can replace it. But as long as you wrap it up nicely (except the transducer part), it will last longer
Anyone else having issues with condensation forming on the sensor? I have the sensor inside the tank just under lid. In the early mornings when temperature decreases, water drops form on the sensor and causing readings to be stuck at 18. Currently using the JSN-SR04T sensor.
How did you protect the sensor from the humidity inside the tanks and from the hi temperatures on sunny days.
Just wrapped it up nicely with plastic (shown in video at 2:39) and placed it inside a plastic container to protect it from water splashes . Working temperature range of this sensor is approx -25° C to +70° C. I guess it is a pretty good range for a low cost sensor. Its already sustaining the summer heat for past one month and performing well.
I have pg and want to install this smart water tank system. I think about sonoff devices but they have no distance sensor to detect water level in tank.. Would u suggest me some distance measuring sensor which can join with wifi switch socket ,,,, so that i can make a scene if water tank is low,, pump start
you can use the water proof distance sensor JSN-SR04T. But you need to integrate it with some wifi programmable device. In my case I have used a Raspberry Pi. Read this helloworld.co.in/article/smart-water-tank
I have a question why we should use resistors?
voltage divider ckt to bring down 5V to approx 3.3 V .. As needed to work with echo pin
Is it possible to install sensor at 13-15 ft tank height .
Max range of this sensor is 400 CM which is approx 13 FT.. So yes you can go ahead
Nice project sir, thanks for sharing... I am really interested to try this project
Good luck
I considered using an ultrasonic sensor to measure the water height (as shown in this video) and it works well in this setting - but if I should installed it in an actual rain water tank, the sensor will get wet (from humidity and condensation in the tank) and it will just end up corroding. Does anyone know a way around this ?
I plan to use a water pressure sensor (4-20mA sensor) to measure the water pressure instead - this way I can determine how much water is in my rain tank.
Just wrap it up nicely with plastic except the transducer part. As long as it is not submerged into water, it continues to work well even in humid environment. I have used it this way for past 6 months
I covered the points where there was a soldering iron with the sensor with hot glue, I put it in a watertight electrical box (with the sensor holes) and so far I have not had any problems with humidity or condensation.
Do ultrasonic sensor detects normal water instead of any added colors?
Yes it does. Color doesn't matter.
I have a doubt ,Here you are saying that the sensored data will be measured and data will be inserted in the db So what kind of data will be measured ??
Its "sensor data".. that means the distance reading obtained through ultrasonic sensor. This reading (data) is the distance of sensor from the water surface.
Thank you so much sir !!
Hi Jitesh bro,
I tried to implement same for my final year project but im getting some issues.
1. I have created database name water_level
2. I copied the web_host to XAMPP htdocs
3. i have created folder call sensor and copied the sensor.py to Raspberry Pi
4. amended my ip address in sensory.py
however when i run the python script im getting error either Waiting For Sensor To Settle or from urllib.request import urlopen module request not found
Please help with this issue.
Sure. Email me
jitesh@helloworld.co.in
very nice project...very cool
Thank you :)
my water tank is on the 8th floor I live on the 4th floor can the 5v signal from the sensor travel a 15meter distance? from the tank to raspberry pi in my flat? i know this is a very simple question but still..
Yes it should work. I tested it upto 25 meters using a CAT 6 Lan cable. Works well...
This seems to be nice project. May I know the front end and back end used in this project.
Thanks.. Web application is developed in php, html and JavaScript.. Backend Mysql.. And a python script on Raspberry pi..
@@jitesh_helloworld thankyou
Can I use ESP 8266 instead of raspberry pi
Yes you can. It can collect data from sensor and make a web request as http client to webserver for uploading the data
Thanks for the video =)
hi !! great job! can we call this a digital twin dedicated to describing the current state of the vase?
Thanks. Yes you can 😊
Do you have a detailed step by step instructions? And congratulations for your project.
Thanks Rivelino. Its been pending for some time now.I will soon write about it and share the link. Till then you can check the mini instructions to use the sample code on github readme. github.com/jiteshsaini/Smart-Water-Tank
Hi Trevor, i will soon do that and post a link here. Till then, you can ask anything specific which needs elaboration.
Nice Project Sir 👌👍👌
I would Like to represent this project in my College 😁😊
Thanks Avadhut. Please go ahead and let me know
How did you build the dashboard?
Details are here helloworld.co.in/article/smart-water-tank
Hi 👋 sir I m a 12 class student going to engineering college this year can u tell me a platform or a good book to start with raspberry pi home automation and robotics projects?I just know python 3.
The best way to learn is by start building small projects using a raspberry pi. You already know Python, so I won't be a problem at all. Start with simple programs to control GPIO pins and Pi camera using Python. Soon you will be craving for advanced stuff. You can see the beginner examples at projects.raspberrypi.org/en/projects
Again, learning with experimentation is the best way. Internet is full of treasures, whatever you need to know is available on first page of google search.
@@jitesh_helloworld 👍thank you so much sir 😀👍🙏
@@jitesh_helloworld in beginning are paid Udemy/ Coursera courses worth buying?
I won't recommend. There is enough free quality stuff available.
@@jitesh_helloworld ok great sir 👍👍🙏🙏
hello.. i want this system installed on my home water tank.. please guide
Pl check out the source code on GitHub and circuit diagram as shown in video. You may need to modify the IP addresses in the source code as per your network. With a little effort you can set it up. All the best
Hello, I love the protect, I have many tanks in my farm and they are far from each other, is there a wireless way con connect each sensor to the pi? Thanks amazing content
Glad you liked it... You can setup an extended wifi zone by using boosters. Then u can use the sensor along with low cost processing board (pi zero OR ESP 32 wifi enabled boards) on each tank. These individual boards can trasmit the sensor data to a remote server through wifi link.
@@jitesh_helloworld what about SDR. Rádio?
Yes you can. Once the depth data is calculated you can transmit it using any method.
Another question please bro, in which file did you put the full and empty tank value of your sensor distance ? for me 20 cm tank is full, 190 tank is empty, thanks.
For the purpose of tank animation, you need to configure lowerLimit and upperLimit values in "tank_animation.js" file. In you case, total height of the tank is 20+190. So, lowerLimit can be 0 and upperLimit can be 210 cm.
Thanks for sharing ❤️
Where are you from?
Exceptional
thanks
@@jitesh_helloworld Can you try to make a Raspberry Pi project with sonar to plot(running plot) underwater surface and under water body in general ? I have seen a few projects that use a car reversing sensor with a convertor circuit to interface with RPI GPIO pins similar to this fish finder th-cam.com/video/XgexF9UJBGU/w-d-xo.html and sonar plotter th-cam.com/video/nWLPmjaNJ6I/w-d-xo.html
a good sensor is necessary for this. Programming RPi shouldn't be difficult
Excellent work. Where to get a sensor from?
Thanks..It's easily available online. Commonly available
Read Full Article:-
helloworld.co.in/article/smart-water-tank
Watch the next video.
th-cam.com/video/ETrYPMRdL-E/w-d-xo.html
The Web part is provided as a service. You can access your online widget by creating an account here.
helloworld.co.in/iot/
Thanks a lot...... Very very helpful
Thanks
Can you please tell me ,How much cost required to do this project?
What is the main moto of this project Whenever water tank became empty it notifies you ?? Please explain
Main motto is to experiment and learn. Btw, presently i am using it to provide low water level alert through a speaker. It also alerts if a tap is left open for a long time by monitoring the gradual decline of water in the tank.
these sensors are not good detector of water and it will fail as water drops spread while filling time and in winter summer moisture accumulating on sensor
Hey bro! Love that project. Rather than using a online website for the graphics can i get the same information in an app if i develop it also rather than using a ultrasonic sensor like that which other sensor can we use so that it is more reliable??
Yes you can make an app. The app need to fetch the data from raspberry pi over LAN either through socket programming or reading mysql database running locally on pi. In case, the app needs to work over internet, you need to figure out the data exchange mechanism. As far as reliability is concerned, this 150/- rs sensor is working for past 6 months, every minute, without any problem. Seems to be quite reliable
@@jitesh_helloworld On the same subject of the type of sensor, This project provides the data I need from my tanks but my tanks are much bigger - they are 20ft tall. Is this still the right sensor or is there another one that would suit my needs? Where can I see the options for sensors and their parameters that will work with this project? Thank you.
Nice project, thanks for sharing. do you use a raspbarry Pi 3 B+ without SD card?
I used Raspberry Pi 3B+ .. Of course with SD card
Thanks, This is working well, But How can I can I change the time zone ?. I did edit the line in the phplot.php file to my local timezone but the graph is still plotting 3.5 hrs ahead.
Paste that line in graph.php and see
Thanks... Tried that.
date_default_timezone_set("Africa/Johannesburg") ;
Ive put that in the graph.php, but did not change anything.
Ok.. so I checked.. Pl change the timezone in 'insert_data.php' file. This file is responsible for storing level value in database along with time info. This should solve your issue. Let me know.. I will update the code to make this setting easy for others too.. Thanks
Thanks, that fixed it.
Much appreciated
Hi, Jitesh, very interesting your project and I have a question, in the video you show the case when the raspberry pi and the server are in different locations and in the example code I see the case when the rpi and the server are in the same LAN. Is any other change that I need to perform (appart from IP) if I use for example an AWS EC2 server (cloud) and RPI ? Thanksin advance
Thank you. Nice observation. So the code is to assist you to replicate the setup in your LAN in case you do not have access to external webspace.. No change is required in the code apart from the IP, as you correctly brought it out. Just ensure the the raspberry pi is connected to internet while you try to upload data to external server. Just copy the 'web_host' folder in the your AWS server and prepare a mysql database with name 'water_level' and import the 'water_level.sql' file so that you have the database setup which the application will require. Ensure the database credentials are entered correctly in 'db_params_wt.php' file (inside 'watertank' folder). All the best and let me know if you are able to set it up
@@jitesh_helloworld Thanks, I implemented your code in rpi and server and you can see there in 18.191.62.162; however I have two: problems, 1. The cylindric volume always shows "700 liters" and 2. The graphic shows only the old data (2020). I realized that the data is comming well to the mysql database in AWS. Regards
@@preparatemasperu5232 Solution is as follows:-
1. change the tank dimensions in "web_host/watertank/util_functions_wt.php" as per your tank
2. The dates are shown for old data(2020) because the sample database you imported contains only those dates. To get current dates you can simply uncomment the commented out part in "function show_dates()" of file "web_host/index.php" and delete the existing code.
Hi Bro. which is the raspberry pi model you have used here ?
It's Raspberry Pi 3 B. However any Raspberry Pi model will work for this project.
Hi Jitesh, great job! Can I ask, can you create actions when the tank level reaches a certain point, such as 25% to automatically send you an alert to your phone or email? So you know, instead of checking the url to see the level?
Also is rasberry pi better to use than an Arduino Uno, which I have seen others use? How do you know what code to use?
Yes, it is possible to send email alerts. You can do it on the server side application by integrating PHPMailer library.
You can use other microcontrollers such as ESP32 & Arduino with built-in wifi to achieve the same. However, you need to write the code for interfacing the sensor and uploading the data to remote server.
Stay tuned for a few days, I am working on a Web Service to address these issues. Will upload a video soon
Hi Wonderful project!! I have a couple of question, when you put it inside the tank is dark, does the sensor still measure the distance correctly? Also I noticed the water on your PoC was blue, if the water is transparent as originally is, does still measure it? Thank you! Great great stuff!
Thanks.. color of water / darkness inside tank has got nothing to do with the functionality of the sensor. The sensor emits sound waves which gets reflected from water surface. Yes, it will work for transparent water also.
@@jitesh_helloworld very clever , very good project!
Thankyou
How much cost required to buy required things like sensor or remaining?
Thank you so much!!! is there a way to adjust for the water tank height? mine has a height of 1.39 mts but I can´t find the way to change that. I am trying to do this project to only show the tank gauge using a esp8266, if you help me to guide me, I will pay you via pay pal or patreon if you have a patreon account. I appreciate your help.
Hi email me on jitesh@helloworld.co.in
Yes you can do it
dose the source code which is placed in the youtube video still work
Yes it works.
How to make thise Web page?
check this github link github.com/jiteshsaini/Smart-Water-Tank
Hello sir . I have followed all the instruction given in the git hub provided by you. But I am facing troubles in connecting the raspberry pi output to the data base . Please sir help me
You need to find out the ip address of web host where the database is running.. Then replace the IP address in python script with this one. Simple commands such as ifconfig on linux and ipconfig on windows will tell you that
@@jitesh_helloworld sir I have changed the IP but it's still showing error and not getting connected.
@@vedaantbhangle3624 check ur mail
@@jitesh_helloworld thank you sir but I have mailed you my last doubt.
Replied. Good it's working for you.
good job bro, what about the distance between pi and the sensor ?
Thankyou.. the distance is around 25 meters. Connected through lan cable. Not experienced any issues so far.
@@jitesh_helloworld thank you, It was to find out if the distance can influence the voltage
@@Samir-ah CAT 5 had resistance of 0.75ohm per 15meters
Super nice project, but I am looking for this for Arduino uno mega2560. If anyone can help, please let me know.
Thanks a lot.
Commendable
Thankyou Sir 😊
Please remove background music in your future videos. :)
Nice..can we have a book written with practical projects like this?
Thanks.. i guess in today's era of digital information, best way is to join/subscribe the communities & blogs which interests you to remain updated. The information gets continuously added/updated, so a single book might not be able to do the justice
Okay.
Please dear i want to create this program on visual studio csharp and arduino how do this please?
Hi. implement the sensor interface sketch in Arduino. Use the Ethernet shield to send the data over lan. For that you can create a simple socket program. Now implement the other side of socket program in c sharp and recieve the data. Integrate the data in on gui created through c sharp
@@jitesh_helloworld But sorry dear i don't know how to connect you'r arduino project with c# and creating a socket between both of them! have you any tutorial about this?
dear i need this project please if you help me i'm glad to be❤
@@hastyarblbas1519 my project is based on Raspberry Pi not arduino. You can look at the code of this project here github.com/jiteshsaini/Smart-Water-Tank
Thank so much for idea
Hey , great project just wanted to know , can I create this project using tinkercad?
If yes , please give some tips on how to do it.
Thanks!
Hi, just explored the term and found that you can do some 3D stuff using it. If it can interact with a mysql database then of-course you can. Just work out how to read the value from a database and supply it to a widget provided by tinkercad
@@jitesh_helloworld Thanks man , I am facing some difficulty in the web host part , can you help me out with that please , is there any way I can contact you through email or whatsapp?
jitesh@helloworld.co.in
Amazing
Thanks
@@jitesh_helloworld mostly welcome
There is a techincal problem in this code. If you will run this program continuously for around 8 to 9 hours it crashes and system becomes offline. I am 100% sure about this as I have done research on this and this was happening with me but I solved this problem. No body in youtube will tell you about this problem because they them self even don't know why it is happening and how to solve this.
Water inside the bottle is blue and outside without color
Strange !!!
@@jitesh_helloworld This sensor will work in the dark 🌑?
Yes it will.. BTW there is eternal darkness inside a closed water tank
Hi Jithesh, I would like to collaborate with you on this project.
Regards,
Senthil
email me jitesh@helloworld.co.in
Hello bro...can you tell me exactly function of that relay...btw nice video bro from Malaysia
Thanks.. That relay board is connected to the GPIO pins to actuate any external appliance.. The bulb you saw in the video is triggered via relay
@@jitesh_helloworld okee tq bro
Sir can you send me this project documentation?
helloworld.co.in/article/smart-water-tank
genius!
Glad you liked it. Thanks
excelente
Please, Your Excellency, return the project using it ESP32 and IDE
Hi there! Thanks for sharing. For those who are gonna try it, it didn't work for me with clean water. Thanks anyway!
Thanks.. It should work with clean water also.
Can this be resolved by putting something like floating plastic plate on water surface under sensors?...Just wondering if that helps.
No need. water surface reflects just fine
Is it possible to collect or download the time series water level data for study use for example?
I need your Whatsapp or email Sir if possible. Thank you
Yes it is possible. The data is stored in a database and can be exported. Msg your email id here, I will reply.
#sotaog working on the same concept
Genius
Thanks
Likes 💗💗
👍
Bonjour Mr Jitesh,
Merci pour la vidéo.
SVP, je vous sollicite d'étudier la possibilité de refaire le code python en utilisant la librairie: "GPIOZERO".
Merci d'avance.
Je suis sûr que vous auriez vu cela:-
gpiozero.readthedocs.io/en/stable/recipes.html#distance-sensor
il ne devrait pas être difficile d'étendre le code gpiozero donné dans le document
@@jitesh_helloworld Bonjour Mr Jitesh,
Merci beaucoup pour votre réponse.
Justement, c'est à ce code que je fais allusion pour obtenir votre confirmation.
Dans votre code, comment intégrer cette ligne de code et à quel endroit?
Merci d'avance pour votre assistance.
@@abdellahdrissi6552 is suffirait je pense juste de changer les déclarations sur le script pyhton, faire juste attention aux pin utilisé pour ECHO TRIG et ALARM
sir what cost i can make? can i make for school project.. even i want to contact you
Cost of hardware is not much.. Raspberry Pi and ultrasonic sensor... Around 3000/- .. You need to setup a webserver on any pc for the web GUI.. Drop an email on jitesh@helloworld.co.in
Does the same codes in Raspberry Pi work with ESP32 microcontroller or there is modification needed?Kindly send me your email.Thank you.
Raspberry pi code is in python. For ESP 32 you need C code. So it won't work.
jitesh@helloworld.co.in