Wireless Water Level Indicator using LoRa and ESP32

Wireless Water Level Indicator:

Wireless Water Level Indicator

Wireless Water Level Indicator using LoRa and ESP32- In today’s article, you will learn how to make a long range Wireless Water Level Indicator using a waterproof Ultrasonic Sensor JSN SR04T/AJ-SR04M and a pair of LILYGO TTGO LoRa32 modules.

Wireless Water Level Indicator

TTGO LoRa32 is 868MHz and is based on the LoRa SX1276 chip combined with ESP32 WiFi + Bluetooth and an I2C supported 0.96-inches OLED display module. So many things on this tiny board, its quite impressive. You don’t have to do any soldering, just upload the desired code and start monitoring anything you want.

Wireless Water Level Indicator

When these modules are not in line-of-sight means when there are lots of obstacles in between then the range is 77 meters.

Wireless Water Level Indicator

And when both the modules are in line-of-sight then the wireless communication range is more than 1Km. I practically demonstrated this in my getting started video on the LoRa32. So, if you have got any questions, regarding its technical specifications, how to install the required libraries, and how to write your first program, then I recommend you should read my getting started article on the TTGO LoRa32 Modules.

HC-SR04 Vs Waterproof Ultrasonic Sensor:

Wireless Water Level Indicator

HC-SR04 and the waterproof JSN SR04T are both popular ultrasonic sensors that are commonly used in distance measurement applications. However, there are some differences between them that may make one a better choice depending on your specific needs.

The HC-SR04 is a low-cost ultrasonic sensor that can measure distances from 2cm to 4 meters with an accuracy of about 3mm. It has a working voltage range of 5V DC and consumes very low power. The HC-SR04 is easy to use, it can be easily interfaced with microcontrollers, and can be easily found in the market.

The JSN SR04T, on the other hand, is a more advanced ultrasonic sensor that has a longer sensing range of up to 6 meters and a higher accuracy of up to 1mm. It operates at a wider voltage range of 3-5V DC and has a built-in temperature compensation feature that helps to improve accuracy even in varying temperatures. However, the JSN SR04T is relatively more expensive and may be harder to find in the market.

In short, if you need a low-cost ultrasonic sensor with a shorter range and don’t require high accuracy, then the HC-SR04 may be a good choice. However, if you need a more advanced ultrasonic sensor with a longer range and higher accuracy, and you are willing to spend more, then the JSN SR04T could be a better option. For more technical specifications, features, and applications; read my article on the Waterproof Ultrasonic Sensor.

A few days ago, I created an IoT-based water level monitoring system using the same waterproof ultrasonic sensor. In that system, the water pump would automatically turn on and off. However, this time, I don’t want the water pump to automatically turn on/off. I want the control of the water pump to be in my hands and the hands of my family members, and I also don’t want us to be dependent on the internet.

Wireless Water Level Indicator

The switch for the water pump is installed here and next to it I can install my water level indicator or monitor. Then, all the family members can check the water level in the water tank and turn the water pump on/off accordingly. So, this is exactly, what I am going to do. So, without any further delay, let’s get started!!!

Amazon Links:


Official product link

Waterproof Ultrasonic Sensor

Other Tools and Components:

Top Arduino Sensors:

Super Starter kit for Beginners

Digital Oscilloscopes

Variable Supply

Digital Multimeter

Soldering iron kits

PCB small portable drill machines

*Please Note: These are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!

Wireless Water Level Indicator, Circuit Diagram:

Transmitter side circuit diagram:

Wireless Water Level Indicator

The 5v and GND wires of the Waterproof Ultrasonic Sensor are connected to the 5V and GND pins on the LoRa32 module. Whereas the Trigger and Echo pins are connected to the GPIO pins 12 and 13 respectively.

TTGO LoRa32 Pins Diagram:

Wireless Water Level Indicator

You can see the SSD1306 Oled display module SDA and SCL pins are connected to the Pins 04 and 15. And the SX1276 LoRa transceiver module MOSI, SCLK, CS, DIO, RST, and MISO pins are connected to pins 27, 5, 18, 26, 14, and 19. All the other pins are clearly labeled. You can see the 5V and 3.3V pins are available on both sides. We have got three GND pins. And all these other GPIO pins can be used for connecting input and output devices.

Receiver Side Circuit Diagram:

Wireless Water Level Indicator

On the receiver side, we don’t need to do anything as the LoRa and Oled display module are already wired up. Now, let’s go ahead and take a look at the transmitter and receiver side programming.

Altium Designer + Altium 365 + Octopart:

Arduino LoRa Free SMS

Altium 365 lets you hold the fastest design reviews ever. Share your designs from anywhere and with anyone with a single click. it’s easy, leave a comment tagging your teammate and they’ll instantly receive an email with a link to the design. Anyone you invite can open the design using a web browser. Using the browser interface, you’re able to comment, markup, cross probe, inspect, and more. Comments are attached directly to the project, making them viewable within Altium designer as well as through the browser interface. Design, share, and manufacture, all in the same space with nothing extra to install or configure. Connect to the platform directly from Altium Designer without changing how you already design electronics. Altium 365 requires no additional licenses and comes included with your subscription plan.

Get real-time component insights as you design with Octopart built into Altium 365. Octopart is the fastest search engine for electronic parts and gives you the most up-to-date part data like specs, datasheets, cad models, and how much the part costs at different amounts etc. Right in the design environment so you can focus on your designs. Start with Altium Designer and Activate Altium 365. Search for electronic parts on Octopart.

Wireless Water Level Indicator Programming:

If you already have an ESP32 board installed, then there shouldn’t be any problem, you just need to install these libraries.




But if you don’t have an ESP32 board installed, then you need to install it first, and the complete process is explained in the article Getting started with ESP32 WiFi + Bluetooth Module.

Anyway, once you install the ESP32 board then you can go to the Tools menu, Board, ESP32 Arduino, and from the boards list you can select TTGO LoRa32-OLED.

Wireless Water Level Indicator

Transmitter Side LoRa32 Code:

If you watch my previous videos or read my articles on the LoRa32 and IoT based Water Level monitoring system, then you would know how I combined the two codes.

You can clearly see, I am using the same pins definitions. I am using the same local address and destination address. If you want to monitor multiple water tanks then you will have to use those addresses. You can read my article on how to use multiple LoRa transmitters with a single LoRa receiver.

This set of instructions is used to calculate the water level distance and then using the map function we convert the distance information into water level percentage.

Then we make a message consisting of the distance and water level percentage. You can see I am using comma as the delimiter. It will help me in splitting the message to retrieve the distance and water level percentage values. Anyways, finally I send the message, and at the same time I also print this message on the Oled display module. Now, let’s go ahead and take a look at the receiver side programming.

Receiver Side LoRa32 Code:

On the receiver side we have got the same libraries and the same pins definitions. So, let’s go to the loop() function.

We simply read the packet, and then using the getValue() function we simply split the message using comma as the delimiter and the retrieved values are stored in variables distance and waterLevelPer. And then finally, these values are printed on the Oled display module.

getValue() function is a user-defined function and its job is to split the message. You can select any character as the delimiter. So, that’s all about the programming. I have already uploaded these programs and now let’s start our practical demonstration.

Wireless Water Level Indicator Practical Demonstration:

Wireless Water Level Indicator

I have powered up the transmitter side using my designed 5V and 3A power supply and my created 4S lithium Ion Battery. This setup makes the transmitter side completely portable. You can use any 5V regulated power supply. And additionally, you can also connect a lithium-ion battery, LoRa32 has an onboard charging circuit. So, if in case there is any power failure the communication won’t be interrupted.

You can also use a solar panel. All you need is to connect your solar panel to this 5V and 3A power supply, it can take input voltages up to 28 volts, and at the output, it gives regulated 5V and 3A. So, during the day time, its going to use Solar energy and during the night time or cloudy weather, it’s going to use a lithium-ion battery as the power source.

Wireless Water Level Indicator

Since nothing is connected on the receiver side except the LoRa and Oled display module, so we can use a single cell lithium ion battery or even a cell phone charger or any other 5V power supply.

Anyways, you can already see the distance and water level percentage on the receiver side. Let me move my hand in front of the Ultrasonic Sensor and you will see a change in the distance and water level percentage.

Wireless Water Level Indicator

When I started to move my hand in front of the Ultrasonic Sensor the distance and Water Level Percentage values started to change, as you can see in the image above.

Wireless Water Level Indicator

Let’s think of this Bucket as the Water Tank and we have to measure the water level inside this Tank. The Ultrasonic Sensor is in its place. So, let’s go ahead and fill this Water Tank.

Wireless Water Level Indicator

So, that’s all about the Wireless Water Level Indicator.

Watch Video Tutorial:



Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button