ESP32 Projects

I Built a Solar Powered Water Tank Level Sensor Version 2 with Xiao ESP32C3 + BLE

Last Updated on September 13, 2026 by Engr. Shahzada Fahad

Description:

This is Version 2 of my Solar Powered Water Tank Level Sensor.

In this version, the system does not require WiFi.



Solar powered Water Tank Level Sensor Version 2 using Bluetooth and Xiao ESP32C3
Solar powered Water Tank Level Sensor Version 2 with Bluetooth monitoring.

You can monitor your water tank level wirelessly using Bluetooth and a smartphone application.

Bluetooth app for real-time Water Tank Level Sensor monitoring
Bluetooth app for wireless water tank level monitoring.

Amazon Links:

Xiao ESP32C3

A02YYUW Waterproof Ultrasonic Sensor (UART version)

SSD1306 Oled display

5V SPDT Relay

Other Tools and Components:

ESP32 WiFi + Bluetooth Module (Recommended)

Arduino Nano USB C type (Recommended)

*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!

You can easily implement this system in your home without any tension.

You can also sell this system on Amazon or other online platforms.

You can download the complete project from my Patreon page:

Arduino Code

Mobile Application Source Code

Circuit Diagram

PCB Design Files

Gerber Files

BOM

Pick and Place Files

Later in the article, we will also open this application in Android Studio.




Android Studio project for a Bluetooth Water Tank Level Sensor monitoring app
Android Studio project for the Bluetooth water tank monitoring app.

On the hardware side, everything remains exactly the same. I am still using my newly designed Development board which works perfectly with the Xiao Series of controller boards like Xiao ESP32C3, Xiao ESP32C5, Xiao ESP32C6.



Custom development board for Xiao ESP32C3 water tank level monitoring project
Custom development board for the Xiao ESP32C3 water tank monitoring system.

The only change is that I modified the code inside the Xiao ESP32C3, and I also designed my own smartphone application.



XIAO ESP32C3 controller board for solar powered Water Tank Level Sensor
XIAO ESP32C3 controller board for the Water Tank Level Sensor project.

In Version 1, we were monitoring the water level using the Blynk mobile app. For that system, WiFi was required.



Monitoring water level using the Blynk IoT app with an ESP32 water tank level sensor
Monitoring the water tank level in real time using the Blynk IoT app.

The advantage of that system was that we could monitor the water level from anywhere in the world.

But then a very interesting question came from many viewers.

What if someone does not use WiFi at all?

So I decided to create a second version of this system.

In this version, we can still monitor the water level wirelessly, but without relying on WiFi connectivity.




Wireless water tank level monitoring using a Bluetooth smartphone app
Monitor the water tank level wirelessly using a Bluetooth app.

So first, let’s test the system, and after that we will discuss the technical details.

As you can see, I have made this application very user friendly.



Water Tank Monitor application for real-time Bluetooth water level monitoring
Water Tank Monitor application for wireless water level monitoring.

At the top, you can see the title “Water Tank Monitor.”

Below that, you can see the application status. Right now, the status is connected.



Water level monitoring on a cell phone using an ESP32 project
Monitor the water level on a cell phone using an ESP32 project.

Here you can monitor the water level percentage in the tank.

Water tank level monitoring system showing the water level percentage
Monitor the water level percentage in the tank in real time.

This shows the pump status. If the value is 1, it means the water pump is ON. And if the value is 0, it means the water pump is OFF.

Below that, you can also see the actual distance in centimeters.

And below that; you can see the lower and upper limits of the water tank.

I already explained these limits in detail in Version 1 of this project.



Water Tank Level Sensor connected to a smartphone app for real-time monitoring
Water Tank Level Sensor with a smartphone app for wireless monitoring.

You can use this “Connect to BLE” button to connect the application with the hardware. If the status shows disconnected, you can press this button to connect the application to the hardware.

Pump control buttons in a smartphone app for the ESP32 water tank level sensor
Pump control buttons for ON and OFF control in the smartphone water tank monitoring app.

These are the pump control buttons. Using these buttons, you can turn the pump ON or OFF.

And this AUTO button can be used in the future to switch between manual mode and auto mode.




Pump control buttons in a cell phone app for water tank monitoring
Pump control buttons in the cell phone app for water pump control.

Here at the bottom, you can enter your own lower and upper limits. The advantage of these limits is that you can use this system with any size of water tank. So you do not need to go into the code to change these values. You can set these limits in real time.

Let me show you how it works.



Changing water tank parameters in real time through a cell phone app
Changing water tank parameters in real time through a cell phone.

As you can see, when I pressed the button, the value immediately changed on the display.

Water tank upper limit setting for the Water Tank Level Sensor system
Setting the upper limit for the water tank level.

In the same way, I can also change the upper limit.

And let me tell you something important. These limits will not change unless we change them manually.

Even if you restart the controller,

Water tank lower and upper limits stored in EEPROM memory
Water tank limits are stored in EEPROM memory for persistent settings.

These values will not be lost.



Water tank level values stored in EEPROM memory on the ESP32
Water tank level values stored in EEPROM memory.

Because these values are saved in the EEPROM memory.

Now you understand how the application works.

So let’s go ahead and test the system.

Water Tank Level Sensor project practical demonstration with real-time water level monitoring
Practical demo of the Water Tank Level Sensor project.

You can think of this bulb as a water pump.

The lower and upper limits are already set.

Now watch as I move this tablet. Think of it as the water level. The bulb is ON because the water level is below 20%.

It will remain ON until the water level increases above 85%.

Automatic water pump ON and OFF system using a Water Tank Level Sensor
Automatic water pump ON and OFF control based on water tank level.

Now, the water pump will remain off until the water level decreases below 20%. As you can see, the entire system is working as expected.

Water level decreases below 20 percent and the automatic water pump turns ON
Water level below 20 percent automatically turns the water pump ON.

Software Setup:

Next, I am going to show you my software setup and how to upload the program.

Right now, you can see that I am using Arduino IDE version 2.3.6.

Arduino IDE 2.3.6 and ESP32 board package 2.0.11 for XIAO ESP32C3
Arduino IDE 2.3.6 and ESP32 board package 2.0.11 for XIAO ESP32C3.

And I am using the ESP32 board package version 2.0.11 or I can also use a higher version.

If you use an older version, you may not find the Xiao ESP32C3 in the boards list.

Uploading the Code:

I have this code, which you can download from my Patreon page.

Water level monitoring code for an Android application using Bluetooth
Water level monitoring code for the Android application.

Water Level monitoring Smartphone App:

To open the application, first you need to install Android Studio.

You can find many videos on YouTube that show how to install Android Studio.

After opening it, you will see an interface like this on your screen.

Opening a water level monitoring project in Android Studio
Opening the water level monitoring project in Android Studio.

After that, you need to download this app from my Patreon page.

Android app source code download for water level monitoring project
Download the Android app source code for the water level monitoring project.

Then extract the downloaded file.

Next, you need to copy that folder…

  1. Next, go to the C Drive.
  2. Then open the Users folder.
  3. After that, open the OK folder.
  4. Now go to the AndroidStudioProjects folder.
  5. And paste the copied project folder here.

Next, connect your mobile phone to the system.

Now go back to Android Studio.

Click the Open button.

You should see the project folder here.

How to open an Android application project in Android Studio
Opening the Android application project in Android Studio.

If you don’t see it, simply press the refresh button.

The folder will appear immediately.

Now select the folder and click the OK button.

From here you need to show some patience.

Water level monitoring project Android application design in Android Studio
Designing the water level monitoring Android application in Android Studio.

If you are using Android Studio for the first time, it may take some time because it will start downloading and installing some required files.

Once everything is finished, you will be able to see the application files.

Android application designing and programming in Android Studio for ESP32
Designing and programming the Android application in Android Studio for ESP32.

You should now be able to open these files.

To run this application on your mobile phone, click on the plus (+) button.

Then select your mobile phone.

Selecting a phone device in the Android Studio emulator
Selecting your phone in Android Studio to run the application.

After that, simply run the application.

Now wait for the processing to complete.

And there you go… the application has opened.

Run an Android application directly on your cell phone from Android Studio
Running the Android application directly on a cell phone from Android Studio.

Right now the status is disconnected.

So let’s go ahead and connect it.

You can see the status immediately changes to connected.

Professional Android application in Android Studio for ESP32
Professional Android application for ESP32 designed in Android Studio.

And now we can see the water level percentage in real time.

Let me change the distance by moving my hand near the sensor.

Water level monitoring on a smartphone using a Bluetooth application in Android Studio
Water level monitoring on a smartphone using a Bluetooth Android application.

This is amazing… I can see the changes instantly on my mobile phone.

While working on the application, you do not always need to use your mobile phone.

You can also test the application directly on your computer.

Once your application is ready, simply stop the program.

During testing, the application is automatically installed on your mobile phone.

Now let’s run the application directly from the mobile phone.

And as you can see, it successfully connects to the system.

Water level decreases below 20 percent and the automatic water pump turns ON
Water level below 20 percent automatically turns the water pump ON.

So, that’s all for now.

Support me on Patreon:

If you enjoy my work and find these projects helpful, please consider supporting me on Patreon. With just $1, you can get access to all project source codes, schematics, and extra resources that I share with my supporters. Your support helps me continue creating new electronics tutorials, experiments, and open projects for the community. Thank you so much for being part of this journey and for supporting my work!

Watch Video Tutorial:

Solar Powered Water Tank Level Sensor with Xiao ESP32C3 + BLE


Discover more from Electronic Clinic

Subscribe to get the latest posts sent to your email.

Engr. Shahzada Fahad

Engr. Shahzada Fahad is an Electrical Engineer with over 15 years of hands-on experience in electronics design, programming, and PCB development. He specializes in microcontrollers (Arduino, ESP32, STM32, Raspberry Pi), robotics, and IoT systems. He is the founder and lead author at Electronic Clinic, dedicated to sharing practical knowledge.

Related Articles

Leave a Reply

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

Back to top button

Discover more from Electronic Clinic

Subscribe now to keep reading and get access to the full archive.

Continue reading

Electronic Clinic
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.