• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Homemade Circuit Projects

Get free circuit help 24/7

  • 1000+ Circuits
  • Privacy Policy
  • About Us
  • Contact
  • Disclaimer
  • Videos – Circuit Test Results
You are here: Home / Water Level Controller / Ultrasonic Wireless Water Level Indicator – Solar Powered

Ultrasonic Wireless Water Level Indicator – Solar Powered

Last Updated on August 14, 2020 by Swagatam 40 Comments

An ultrasonic water level controller is a device which can detect water levels in a tank without a physical contact and send the data to a distant LED indicator in a wireless GSM mode.

In this post we are going to construct a ultrasonic based solar powered wireless water level indicator using Arduino in which the Arduinos would be transmitting and receiving at 2.4 GHz wireless frequency. We will be detecting the water level in the tank using ultrasonics instead of traditional electrode method.

Overview

Water level indicator is a must have gadget, if you own a house or even living in a rented house. A water level indicator shows one important data for your house which is as important as your energy meter’s reading, that is, how much water is left? So that we can keep track of water consumption and we don’t need to climb upstairs to access the water tank to check how much water left and no more sudden halt of water from faucet.

We are living at 2018 (at the time of writing of this article) or later, we can communicate to anywhere in the world instantly, we launched an electric race car to space, we launched satellites and rovers to mars, we even able land human beings on moon, still no proper commercial product for detecting how much water left in our water tanks?

We can find water level indicators are made by 5th grade students for science fair at school. How such simple projects didn’t make into our everyday life? The answer is water tank level indicators are not simple projects that a 5th grader can make one for our home. There are many practical considerations before we design one.

• Nobody wants to drill a hole on water tank’s body for electrodes which might leak water later on.
• Nobody wants to run 230 / 120 VAC wire near water tank.
• Nobody wants to replace batteries every month.
• Nobody wants to run additional long wires hanging on a room for water level indication as it is not pre-planned while building the house.
• Nobody wants to use the water which is mixed with metal corrosion of the electrode.
• Nobody wants to remove the water level indicator setup while cleaning the tank (inside).

Some of the reasons mentioned above may look silly but, you will find less satisfactory with commercially available products with these cons. That’s why penetration of these products are very less among the average households*.
*On Indian market.

After considering these key points, we have designed a practical water level indicator which should remove the cons mentioned.

Our design:

• It uses ultrasonic sensor to measure the water level so no corrosion problem.
• Wireless indication of water level real time at 2.4 GHz.
• Good wireless signal strength, enough for 2 story high buildings.
• Solar powered no more AC mains or replacing battery.
• Tank full / overflow alarm while filling the tank.

Let’s investigate the circuit details:

Transmitter:

The wireless transmitter circuit which is placed on the tank will send water level data every 5 seconds 24/7. The transmitter consists of Arduino nano, ultrasonic sensor HC-SR04, nRF24L01 module which will connect the transmitter and receiver wirelessly at 2.4 GHz.

A Solar panel of 9 V to 12 V with current output of 300mA will power the transmitter circuit. A battery management circuit board will charge the Li-ion battery, so that we can monitor the water level even when there is no sunlight.

Let us explore how to place the ultrasonic sensor at water tank:

Please note that you have to use your creativity to mound the circuit and protect from rain and direct sunlight.

Cut a small hole above the tank’s lid for placing the Ultrasonic sensor and seal it with some kind of adhesive you can find.

placing ultrasonic sensor in a water tank

Now measure the full height of the tank from bottom to lid, write it down in meters. Now measure the height of water holding capacity of tank as shown in the above image and write in down in meters.
You need to enter these two values in the code.

Schematic diagram of Transmitter:

ultrasonic transmitter connections for the water level control

NOTE: nRF24L01 uses 3.3V as Vcc do not connect to 5V output of Arduino.

Power supply for transmitter:

ultrasonic water level controller power supply design

Make sure that your solar panel’s output power i.e. output (volt x current) is greater than 3 watts. The solar panel should be 9V to 12V.

12V and 300mA panel is recommended which you can find easily on market. Battery should be around 3.7V 1000 mAh.

5V 18650 Li-ion charging module:

The following image shows a standard 18650 charger circuit

The input can be USB (not used) or external 5V from LM7805 IC. Make sure that you get the correct module as shown above, it should have TP4056 protection, which has low battery cut-off and short circuit protection.

The output of this should to be fed to XL6009’s input which will boost to higher voltage, using a small screw driver output of XL6009 should be adjusted to 9V for Arduino.

Illustration of XL6009 DC to DC boost converter:

That concludes the transmitter’s hardware.

Code for Transmitter:

// ----------- Program Developed by R.GIRISH / Homemade-circuits .com ----------- //
#include <RF24.h>
#include<SPI.h>
RF24 radio(9, 10);
const byte address[6] = "00001";
const int trigger = 3;
const int echo = 2;
const char text_0[] = "STOP";
const char text_1[] = "FULL";
const char text_2[] = "3/4";
const char text_3[] = "HALF";
const char text_4[] = "LOW";
float full = 0;
float three_fourth = 0;
float half = 0;
float quarter = 0;
long Time;
float distanceCM = 0;
float distanceM = 0;
float resultCM = 0;
float resultM = 0;
float actual_distance = 0;
float compensation_distance = 0;
// ------- CHANGE THIS -------//
float water_hold_capacity = 1.0; // Enter in Meters.
float full_height = 1.3; // Enter in Meters.
// ---------- -------------- //
void setup()
{
Serial.begin(9600);
pinMode(trigger, OUTPUT);
pinMode(echo, INPUT);
digitalWrite(trigger, LOW);
radio.begin();
radio.openWritingPipe(address);
radio.setChannel(100);
radio.setDataRate(RF24_250KBPS);
radio.setPALevel(RF24_PA_MAX);
radio.stopListening();
full = water_hold_capacity;
three_fourth = water_hold_capacity * 0.75;
half = water_hold_capacity * 0.50;
quarter = water_hold_capacity * 0.25;
}
void loop()
{
delay(5000);
digitalWrite(trigger, HIGH);
delayMicroseconds(10);
digitalWrite(trigger, LOW);
Time = pulseIn(echo, HIGH);
distanceCM = Time * 0.034;
resultCM = distanceCM / 2;
resultM = resultCM / 100;
Serial.print("Normal Distance: ");
Serial.print(resultM);
Serial.println(" M");
compensation_distance = full_height - water_hold_capacity;
actual_distance = resultM - compensation_distance;
actual_distance = water_hold_capacity - actual_distance;
if (actual_distance < 0)
{
Serial.print("Water Level:");
Serial.println(" 0.00 M (UP)");
}
else
{
Serial.print("Water Level: ");
Serial.print(actual_distance);
Serial.println(" M (UP)");
}
Serial.println("============================");
if (actual_distance >= full)
{
radio.write(&text_0, sizeof(text_0));
}
if (actual_distance > three_fourth && actual_distance <= full)
{
radio.write(&text_1, sizeof(text_1));
}
if (actual_distance > half && actual_distance <= three_fourth)
{
radio.write(&text_2, sizeof(text_2));
}
if (actual_distance > quarter && actual_distance <= half)
{
radio.write(&text_3, sizeof(text_3));
}
if (actual_distance <= quarter)
{
radio.write(&text_4, sizeof(text_4));
}
}
// ----------- Program Developed by R.GIRISH / Homemade-circuits .com ----------- //

Change the following values in the code which you measured:

// ------- CHANGE THIS -------//
float water_hold_capacity = 1.0; // Enter in Meters.
float full_height = 1.3; // Enter in Meters.
// ---------- -------------- //

That concludes the transmitter.

The Receiver:

ultrasonic water level receiver controller schematic

The receiver can show 5 levels. Alarm, when the tank reached absolute maximum water holding capacity while filling tank. 100 to 75 % - All four LEDs will glow, 75 to 50 % three LEDs will glow, 50 to 25 % two LEDs will glow, 25% and less one LED will glow.
The receiver can be powered from 9V battery or from smartphone charger to USB mini-B cable.

Code for Receiver:

// ----------- Program Developed by R.GIRISH / Homemade-circuits .com ----------- //
#include <RF24.h>
#include<SPI.h>
RF24 radio(9, 10);
int i = 0;
const byte address[6] = "00001";
const int buzzer = 6;
const int LED_full = 5;
const int LED_three_fourth = 4;
const int LED_half = 3;
const int LED_quarter = 2;
char text[32] = "";
void setup()
{
pinMode(buzzer, OUTPUT);
pinMode(LED_full, OUTPUT);
pinMode(LED_three_fourth, OUTPUT);
pinMode(LED_half, OUTPUT);
pinMode(LED_quarter, OUTPUT);
digitalWrite(buzzer, HIGH);
delay(300);
digitalWrite(buzzer, LOW);
digitalWrite(LED_full, HIGH);
delay(300);
digitalWrite(LED_three_fourth, HIGH);
delay(300);
digitalWrite(LED_half, HIGH);
delay(300);
digitalWrite(LED_quarter, HIGH);
delay(300);
digitalWrite(LED_full, LOW);
delay(300);
digitalWrite(LED_three_fourth, LOW);
delay(300);
digitalWrite(LED_half, LOW);
delay(300);
digitalWrite(LED_quarter, LOW);
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(0, address);
radio.setChannel(100);
radio.setDataRate(RF24_250KBPS);
radio.setPALevel(RF24_PA_MAX);
radio.startListening();
}
void loop()
{
if (radio.available())
{
radio.read(&text, sizeof(text));
Serial.println(text);
if (text[0] == 'S' && text[1] == 'T' && text[2] == 'O' && text[3] == 'P')
{
digitalWrite(LED_full, HIGH);
digitalWrite(LED_three_fourth, HIGH);
digitalWrite(LED_half, HIGH);
digitalWrite(LED_quarter, HIGH);
for (i = 0; i < 50; i++)
{
digitalWrite(buzzer, HIGH);
delay(50);
digitalWrite(buzzer, LOW);
delay(50);
}
}
if (text[0] == 'F' && text[1] == 'U' && text[2] == 'L' && text[3] == 'L')
{
digitalWrite(LED_full, HIGH);
digitalWrite(LED_three_fourth, HIGH);
digitalWrite(LED_half, HIGH);
digitalWrite(LED_quarter, HIGH);
}
if (text[0] == '3' && text[1] == '/' && text[2] == '4')
{
digitalWrite(LED_full, LOW);
digitalWrite(LED_three_fourth, HIGH);
digitalWrite(LED_half, HIGH);
digitalWrite(LED_quarter, HIGH);
}
if (text[0] == 'H' && text [1] == 'A' && text[2] == 'L' && text[3] == 'F')
{
digitalWrite(LED_full, LOW);
digitalWrite(LED_three_fourth, LOW);
digitalWrite(LED_half, HIGH);
digitalWrite(LED_quarter, HIGH);
}
if (text[0] == 'L' && text[1] == 'O' && text[2] == 'W')
{
digitalWrite(LED_full, LOW);
digitalWrite(LED_three_fourth, LOW);
digitalWrite(LED_half, LOW);
digitalWrite(LED_quarter, HIGH);
}
}
}
// ----------- Program Developed by R.GIRISH / Homemade-circuits .com ----------- //

That concludes the receiver.

NOTE: if no LEDs are glowing, which means the receiver can’t get signal from transmitter. You should wait 5 seconds to receive the signal from transmitter after turning on the receiver circuit.

Author’s prototypes:

Transmitter:

ultrasonic transmitter prototype

Receiver:

ultrasonic receiver prototype

If you have any questions regarding this solar powered ultrasonic wireless water level controller circuit, please feel free to express in the comment, you can expect to get a quick reply.




Previous: How to Make Simple Boost Converter Circuits
Next: How to Design a Flyback Converter – Comprehensive Tutorial

About Swagatam

I am an electronic engineer (dipIETE ), hobbyist, inventor, schematic/PCB designer, manufacturer. I am also the founder of the website: https://www.homemade-circuits.com/, where I love sharing my innovative circuit ideas and tutorials.
If you have any circuit related query, you may interact through comments, I'll be most happy to help!

You'll also like:

  • 1.  Programmable Automatic Starter Circuit for Diesel Water Pump
  • 2.  Ultrasonic Fire Alarm Circuit using Air Turbulence Detection
  • 3.  Car Tank Water Sensor Circuit
  • 4.  Control Two Submersible Pumps Alternately
  • 5.  Make this Touch free Faucet Circuit for Hands-free Tap Control
  • 6.  Making a Multi-function Water Level Controller Circuit

Please Subscribe (Only if you are Genuinely Interested in our Newsletters)


 

Reader Interactions

Comments

    Your Comments are too Valuable! But please see that they are related to the above article, and are not off-topic! Cancel reply

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

  1. Search Related Posts for Commenting

  2. Anand Mallik says

    Can this circuit be used to control the motor as soon as the tank gets full.
    If yes then how to connect. If not then kindly suggest me a circuit for the same.

    Regards,
    A. Malik

    Reply
    • Swagatam says

      Yes it is possible! Disconnect the “FULL” green LED negative pin from the ground, and connect it to the base of a relay driver stage:

      https://homemade-circuits.com/wp-content/uploads/2012/01/Relaydriver.png

      Reply
  3. Sunilkumar Biradar says

    Are these commercially available.pls share contact details. Thanks in advance

    Reply
    • Swagatam says

      yes available through amazon, ebay etc

      Reply
  4. Kuldip Verma says

    Where I can purchase

    Reply
  5. Suresh says

    Can we add two or more receiver to the 1 transmitter

    Reply
    • Swagatam says

      yes it may be possible

      Reply
  6. Shivaprasad says

    The ultrasonic sensor, HC-SR04, will be continuously exposed to the very humid atmosphere in the tank. Will the sensor be able to survive this humid environment for more than a few months?

    Reply
  7. Marcel says

    Will this also work with tubes smaller than 1 meter?
    I am testing with a Dopper bottle and set the size as follows:
    float water_hold_capacity = 0.14; // up to 14 centimeter can be with water
    float full_height = 0.19; // the maximum size of the Dopper bottle
    The Transmitter is registering the correct measurements in the serial monitor.
    The problem I have is, that the LED / LED’s never turn on (except on startup of the Arduino).
    The buzzer is working because I have added a testing code in the void setup() to check it for 5 seconds.

    How should I change the code of the receiver for this bottle?

    Reply
    • Swagatam says

      Sorry, I have no idea regarding code modification.

      Reply
  8. Marcel says

    Should the LED/LED’s always be on, or will it/they only be on when filling the tank/bottle?
    When I use the serial monitor for the receiver, I get the question marks again.

    Reply
    • Swagatam says

      You can keep it always ON so that you can continuously get the information about the level of the liquid. I am not Arduino expert so I can’t troubleshot the issue!

      Reply
  9. Marcel says

    I followed the circuit design and uploaded the codes. However, when I open the serial monitor, I only get question marks: ? ????????
    In the monitor I set the baud rate to 9600 which is the same as in the code. What am I doing wrong?

    Reply
    • Swagatam says

      I checked the code in my Arduino ID and it is compiling perfectly:

      Done Compiling!
      Sketch uses 5998 bytes (18%) of program storage space. Maximum is 32256 bytes.
      Global variables use 369 bytes (18%) of dynamic memory, leaving 1679 bytes for local variables. Maximum is 2048 bytes.

      Reply
    • Marcel says

      Solved: I build the circuit without the buzzer and the LEDS. Now, I get normal output in the serial monitor.

      Reply
      • Swagatam says

        Glad it is solved!

        Reply
  10. Mohammad Mohiuddin says

    Could you please add a LCD display in receiver end in this project where showing the date, time, motor status and water level (as percentage e.g. 5%, 10% ……. 100%).

    Reply
    • Swagatam says

      Sorry, My arduino coding is not good, so I won’t be able to help you in this regard, however there are some information in the following links, which you can refer and try the procedures by yourself:
      https://www.homemade-circuits.com/introduction-i2c-lcd-adapter-module/

      https://www.homemade-circuits.com/learning-basic-arduino-programming-tutorial-for-the-newcomers/

      Reply
  11. Anupam Das Gupta says

    Hi Swagatam,
    I am Anupam Dasgupta from Dhubri, Assam. The project is very nice and in my mind I was actually looking for such a project for my overhead water tank. Though everything is fine in the code, I could not follow one thing. The messages that will be send from the transmitter section are :
    text_0[] = “STOP”;
    text_1[] = “FULL”;
    text_2[] = “3/4”;
    text_3[] = “HALF”;
    text_4[] = “LOW”;
    But, in the receiver section, the messages that will be received shows;
    if (text[0] == ‘S’ && text[1] == ‘T’ && text[2] == ‘O’ && text[3] == ‘P’) etc.etc.
    would you kindly explain it.
    With regards.

    Reply
    • Swagatam says

      Hi Anupam, I am sorry I won’t be able to provide any suggestions, because my Arduino coding knowledge is not good at this moment.

      Reply
      • Mark says

        sir what is the design if it’s just battery as power source instead of solar power? Because i want to design a portable device that could measure the volume of liquid inside the tank using ultrasonic sensor. Hope you could help me, thank you!

        Reply
        • Swagatam says

          Mark, As indicated in the 2nd diagram, you can use a 9V battery instead of a solar panel….

          Reply
          • Mark says

            Is the 9V battery connected to a transmitter and another battery to the receiver sir? And what should be the design if i don’t use LEDs? Just like an ultrasonic sensor that indicates a volume sensor. Hoping for your response sir thanks!

            Reply
            • Swagatam says

              Yes, since the units are to be operated remotely, the power sources will need to be separate.

  12. Ramana says

    Hi Swagatam,
    This is Ramana, from Hosur, Tamilnadu. I am very much impressed on your Ultrasonic Water level controller. But my doubt is whether 2nos. of Audrino is required(one each for Transmitter and Receiver or one is enough). Also if you can clarify the total Parts list for this project it would be very helpful. Please share your response.
    Thanks in advance, please keep innovating with new projects.
    Regards,
    Ramana

    Reply
    • Swagatam says

      Thanks Ramana, I am glad you liked the concept.
      Yes you will require two separate Arduino boards as shown in the transmitter/receiver set ups. The parts will be exactly as given in the two diagrams.

      Reply
  13. Anand Mallik says

    Sir I like this project but one thing I want to know that can motor be connected for automatic filling of overhead tank.
    Waiting for your kind reply.
    Regards,
    Mallik

    Reply
    • Swagatam says

      Hi Anand, yes it is possible by configuring a set-reset relay circuit with the upper GREEN LED, and the lower RED LED.

      Reply
      • Mark says

        Sir good day. Can you help me design a cricuit that uses ultrasonic sensor to measure a liquid volume in a tank without the use of arduino? It must be dc powered also sir. Thank you

        Reply
        • Swagatam says

          Hi Mark, sorry presently we do not have a non-Arduino version of the above concept…

          Reply
  14. tala says

    hi guys i need 2v input solar panel charger, is there any recommendation

    Reply
    • Swagatam says

      you can try this:

      https://www.homemade-circuits.com/solar-wind-2-input-hybrid-battery/

      Reply
    • Younus says

      Hello Mr Girish.

      I am Younus from Australia.

      I would propose to ask you to design and make a Prototype for our Project.

      Its a portable oil Level Detection hand held unit capable to measure level remotely from a small opening say 2 inch steel pipe till a depth of say 80-100 meters with measuring accuracy of 0.1% Maximum.

      Preferably using Ultrasonic waves but not necessary if have a robust and cheaper version.

      We can discuss in detail If you can Possibly spare some time please.

      Thanks and Regards
      Younus.

      Reply
  15. gurucharan gupta says

    thanks for making user friendly circuits. can we buy circuit or pcb made by you because we don’t have knowledge of electronics

    Reply
    • Swagatam says

      I appreciate your interest very much, however no longer manufacture PCBs or circuit modules, so can’t help in this regard.

      Reply
  16. Ashok says

    what is max distance between sender and receiver?

    Reply
    • Swag says

      Not sure about the exact distance, but since it works using radio frequency on ISM bands, the distance can be significantly long:

      https://en.wikipedia.org/wiki/ISM_band

      Reply
  17. Manjujain says

    Sir what would be the cost over all approximately to this project

    Reply
    • Swag says

      Could be below Rs.1000/-, you can confirm it by searching in online stores.

      Reply
  18. Sheikh Yousufh says

    Ultrasonic Wireless Water Level Indicator and controller using solenoid with arduino i have 2 over head tank please give me circuit diagram with code mail id yousufh2@gmail.com

    Reply


  19. COMMENT BOX IS MOVED AT THE TOP


Primary Sidebar

Electronic Projects Categories

  • 3-Phase Power (15)
  • 324 IC Circuits (19)
  • 4017 IC Circuits (51)
  • 4060 IC Circuits (25)
  • 555 IC Circuits (92)
  • 741 IC Circuits (18)
  • Amplifiers (49)
  • Arduino Engineering Projects (82)
  • Audio Projects (83)
  • Battery Chargers (75)
  • Car and Motorcycle (87)
  • Datasheets (45)
  • Decorative Lighting (Diwali, Christmas) (31)
  • DIY LED Projects (81)
  • Electronic Components (97)
  • Electronic Devices and Circuit Theory (35)
  • Electronics Tutorial (99)
  • Fish Aquarium (5)
  • Free Energy (34)
  • Games (2)
  • GSM Projects (9)
  • Health Related (17)
  • Heater Controllers (23)
  • Home Electrical Circuits (98)
  • Incubator Related (6)
  • Industrial Electronics (26)
  • Infrared (IR) (39)
  • Inverter Circuits (94)
  • Laser Projects (10)
  • LM317/LM338 (21)
  • LM3915 IC (24)
  • Meters and Testers (54)
  • Mini Projects (153)
  • Motor Controller (64)
  • MPPT (7)
  • Oscillator Circuits (12)
  • PIR (Passive Infrared) (8)
  • Power Electronics (32)
  • Power Supply Circuits (65)
  • Radio Circuits (9)
  • Remote Control (46)
  • Security and Alarm (56)
  • Sensors and Detectors (115)
  • SG3525 IC (5)
  • Simple Circuits (72)
  • SMPS (30)
  • Solar Controllers (60)
  • Timer and Delay Relay (51)
  • TL494 IC (5)
  • Transformerless Power Supply (8)
  • Transmitter Circuits (38)
  • Ultrasonic Projects (12)
  • Water Level Controller (45)

Follow Homemade Circuits

Facebook
Twitter
YouTube
Instagram
My Facebook-Page
Quora

Feeds

Post RSS
Comment RSS

Circuit Calculators

  • AWG to Millimeter Converter
  • Battery Back up Time Calculator
  • Capacitance Reactance Calculator
  • IC 555 Astable Calculator
  • IC 555 Monostable Calculator
  • Inductance Calculator
  • LC Resonance Calculator
  • LM317, LM338, LM396 Calculator
  • Ohm’s Law Calculator
  • Phase Angle Phase Shift Calculator
  • Power Factor (PF) Calculator
  • Reactance Calculator
  • Small Signal Transistor(BJT) and Diode Quick Datasheet
  • Transistor Astable Calculator
  • Transistor base Resistor Calculator
  • Voltage Divider Calculator
  • Wire Current Calculator
  • Zener Diode Calculator

© 2021 · Swagatam Innovations