• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here:Home » ESP32 Arduino Water Tank Level Monitoring Using Laser ToF Sensor

By Abhishek Ghosh March 23, 2023 8:26 pm Updated on April 12, 2023

ESP32 Arduino Water Tank Level Monitoring Using Laser ToF Sensor

Advertisement

Guides for building a DIY water level monitoring system using Ultrasonic Sensor and ESP32 or Arduino UNO are quite common. In real life, using an Ultrasonic Sensor for a water tank is often not practical because a water tank can have 1-2 sources of water falling to fill up the tank from the top. Also, with Ultrasonic Sensor, you need to make sure that the position of the sensor is optimum in a way so that there is no reflection. In industrial fluid measurement systems, laser ToF sensor-based systems are not uncommon.

In this guide, we will use a generic VL53L0X Laser ToF Sensor which is cheap (should cost you around $4). The communication is via I²C. There are challenges with these cheap sensors. These devices are rated for a maximum of 3.3V, you might damage it if you connect it to 5V. You may need to add a pullup resistor to 3.3V to fix the “not working” situation. Also, the number of libraries is fewer and the number of tutorials on the internet is too less. The code or circuit diagram which works for me may not work for you. The total cost of an ESP32 dev board and a generic VL53L0X sensor will cost you around $10. If you power the system using a mobile phone charger, still the cost will not go over $15. It may consume some time to make it work but it is worth that effort.

 

Brief Note About Laser ToF Sensors

 

These cheap sensors are of high-end technology. Mostly, flagship devices use this kind of sensor such as Xbox 360, flagship smartphones etc.

Advertisement

---

Time-of-flight (TOF) is the time a particle or wave takes to travel a certain distance. By measuring that time, we can calculate the distance travelled, the velocity or kinetic energy or the composition. These Laser ToF Sensors can also tell you whether water from the inlet is flowing or not. A Raspberry Pi can unlock all possible usage of this sensor.

 

Libraries and Connection

 

This is the datasheet:

Vim
1
https://www.st.com/resource/en/datasheet/vl53l0x.pdf

Mainly there are two main sellers of the VL53L0X sensor module – Adafruit and Pololu. Most of the clone modules support any of these libraries.

Vim
1
2
3
4
# pololu
https://github.com/pololu/vl53l0x-arduino
# adafruit
https://github.com/adafruit/Adafruit_VL53L0X

The VL53L0X and VL53L1X have a range of 200 and 400 cm respectively. Sparkfun sells VL53L1X module. 200 cm is more than 6 feet. Light takes about 3.3 x 10-12 seconds to travel 1cm. So the module is fast and thus you should shut down the power when not in use.

The Sparkfun library is superior to that of Pololu. But the VL53L1X module will cost you more. Library by Adafruit is not closest to advanced.

Connect Vin to the power supply.
Connect GND to common power/data ground.

Connect the SCL pin to the I2C clock SCL pin on your Arduino (On a UNO this is A5). The hardware I2C clock SCL pin for the ESP32 is GPIO 22.

Connect the SDA pin to the I2C data SDA pin on your Arduino (On a UNO this is digital 20). For ESP32, the SDA pin is GPIO 21.

In ESP32, you can set almost any pin as I2C via software. The VL53L0X has a default I2C address of 0x29.

 

Example Code

 

For a basic system, you can test the continuous measurement feature. But Polou has not implemented interrupt in the library.

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* This example shows how to use continuous mode to take
range measurements with the VL53L0X. It is based on
vl53l0x_ContinuousRanging_Example.c from the VL53L0X API.
The range readings are in units of mm. */
 
#include <Wire.h>
#include <VL53L0X.h>
 
VL53L0X sensor;
 
void setup()
{
  Serial.begin(9600);
  Wire.begin();
 
  sensor.setTimeout(500);
  if (!sensor.init())
  {
    Serial.println("Failed to detect and initialize sensor!");
    while (1) {}
  }
 
  // Start continuous back-to-back mode (take readings as
  // fast as possible).  To use continuous timed mode
  // instead, provide a desired inter-measurement period in
  // ms (e.g. sensor.startContinuous(100)).
  sensor.startContinuous();
}
 
void loop()
{
  Serial.print(sensor.readRangeContinuousMillimeters());
  if (sensor.timeoutOccurred()) { Serial.print(" TIMEOUT"); }
 
  Serial.println();
}

In this article, I pointed towards building a basic working model.

ESP32 Arduino Water Tank Level Monitoring Using Laser ToF Sensor

 

Notes

 

If you place the sensor behind glass or clear plastic, there will be a cross-talk effect resulting in errors which required to be calibrated. Naturally, we can send the data as HTTP Post to our own server in the way we have shown how to control a relay with PHP scripts.

Tagged With laser Water Tank Level Monitor
Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to ESP32 Arduino Water Tank Level Monitoring Using Laser ToF Sensor

  • Arduino With DHT 11 Sensor and Arduino Online IDE : Basic IoT

    Arduino With DHT 11 Sensor and Arduino Online IDE is Example of Basic IoT Which Needs No Special Hardware But Arduino, DHT11, Internet Connection & Web Browser.

  • Arduino Temperature Humidity Sensor : New DHT11, DHT21, DHT22 Test Code

    Here is New Test Codes For Arduino Temperature Humidity Sensor DHT11, DHT21, DHT22 Test Code as Hardware (Not Shields). 2 Libraries Needed.

  • ESP32 Arduino With LCD : Connection & Code (I2C, LCD 1602A)

    1602 LCD and I2C module are quite cheaper and easy to setup and code. Here are the Required Connection & Code to Use ESP32 With LCD.

  • How to Control Multiple Relays With Single Arduino ESP32?

    Before How to Control Multiple Relays With Single Arduino ESP32 Testing, You Need to Learn How to Create Multiple MQTT Channels & Fetch Data.

performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • What is Desktop Publishing (DTP)?June 3, 2023
  • Dynamic WebP Image Delivery in WordPress with Bunny CDNJune 3, 2023
  • Advantages and Disadvantages of Ubuntu Server DistributionJune 2, 2023
  • Typography on the WebJune 2, 2023
  • How to Use JuliaMono Font in Urvanov/Crayon Syntax HighlighterJune 1, 2023
PC users can consult Corrine Chorney for Security.

Want to know more about us?

Read Notability and Mentions & Our Setup.

Copyright © 2023 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy

We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
Do not sell my personal information.
Cookie SettingsAccept
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT