We are going to construct a water level monitoring system which utilizes GSM network to send the status about the current level of water in a tank from 0 to 100% to owner’s phone. This project utilizes ultrasonic sensor to detect precise level of water present in the tank. We are using an Arduino board as brain for this project and a GSM modem to send and receive SMS.
We will see:
- How ultrasonic sensor can measure water level?
- Circuit diagram of water level indicator.
- Circuit description.
- Arduino code for water level indicator.
- How to send SMS to the circuit.
- GSM water level indicator prototype.
The proposed project can convey precise level of water in a tank in percentage from 0 to 100% by just sending an SMS command to the circuit. The circuit will respond with an SMS to owner’s phone instantly. In this way one can avoid claiming up to roof mounted tank to check water level every morning / evening. This project offers great convenience to elderly people who don’t live with their younger generation.
Some apartments and houses especially the old one might have poorly maintained or very narrow stairs to reach roof mounted tank which could result in serious injury in case of a slip or rush.
This project utilizes non-contact method to measure level of water in the tank. Traditional contact based method like inserting electrodes into drinking water is not recommended since no electrode is ideal and there is risk of rusting and it is a common sense that consuming water with rust contamination in long run may cause health hazard. Moreover, electrode method can only show few levels of water in a tank and does not show water level in percentage.
The proposed project overcomes these issues and offers more convenience to apartments, houses and commercial buildings.
How ultrasonic sensor can be used for measuring water level?
Ultrasonic method to measure level of liquids in a tank is relatively an old method now; it is widely used in industries where liquids must not come in contact with the sensor. Here is a patent which describes how to measure liquids using ultrasonic setup:
In the patented diagram we can see a single transducer which is mounted directly above the liquid transmits and receives ultrasonic waves and we are getting pulses which are processed by a microcontroller to determine exact level of water / liquid in the tank. Measuring liquid levels is exactly same as measuring distance between the sensors and a solid, the measurement will be most accurate when the liquid stays still on the surface and there are several factors which could affect the measurement which are mentioned in the patent in depth.
In this project we are using HC-SR04 which has two ultrasonic transducers instead on one, one of them transmit ultrasonic wave and other receives it. We will also receive pulses from ultrasonic sensor in this fashion:
We need to pull the trigger pin high for 10 microseconds by doing so one of the ultrasonic transducer will send acoustic bursts (8 pulses) at 40 KHz frequency. The 8 pulses propagate through air and reflect off an obstacle in this case water and reach the other transducer.
Meanwhile, as soon as the sensor finished sending 8 acoustic bursts, the echo pin turns high and when the reflected waves reaches back to the sensor the echo pin turns low. A microcontroller will measure how long echo pin stayed high i.e. time taken between sent and received waves. Using some elementary math and speed of sound in air, we can calculate precise distance between the sensor and the liquid.
The measured distance between the sensor and liquid can be converted in to a user friendly quantity like percentage.
Circuit Diagram for Water Level Indicator:
Disconnect Tx and Rx pins before uploading code to Arduino.
The proposed circuit consists of just three components the Arduino board, the GSM modem and the ultrasonic sensor. The whole circuit can be powered from 9V supply with at-least 1A of current. The GSM board may consumes 1A at peak so it must be power from a 9V / 1A supply, additionally Arduino can also powered from the same 9V supply either through DC jack or via Vin pin.
The Tx and Rx of Arduino is connected with Rx and Tx of GSM respectively and ground connection is established between the two boards. The Trigger and Echo pins are connected to pin numbers 2 and 3 of Arduino respectively. The ultrasonic sensor HC-SR04 is powered from 5V output pin of Arduino.
Don’t forget to disconnect Tx and Rx pin from Arduino before uploading the code, otherwise you will get upload error.
You need to enter the following details in the code:
- You have to measure your water tank’s two heights in CM.
- You have to enter your country code and phone number to which you will receive tank’s water level.
How to mount ultrasonic sensor and measure tank height:
How to measure your tank correctly?
In any roof mounted water tank there are two heights 1) the actual water holding capacity height 2) total height of the tank.
The water holding capacity is nothing but the height up to which you can fill the tank, above this height there are overflow tube and pump inlet tube through which your tank gets filled.
The overflow tube prevents water going in reverse / back to inlet tube and it will also prevent water reaching the ultrasonic sensor since the sensor mentioned here is not water resistant. You need to enter these two heights in centimeter in the code, only then the circuit will able to reply with correct water level for your tank’s size.
For demonstration purpose I am going to use a mini water storage tank which measures 30 cm in height. I also marked imaginary water holding capacity height of 25 cm; this will emulate a real life water tank.
You should mount the ultrasonic sensor on top of the tank’s lid and sensor’s two transducers should parallel to surface of the water.
How to operate this circuit (send SMS and receive reply)?
- With the completed setup turn ON the circuit, you will receive an SMS after one minute saying that the circuit is ready to receive requests from you. If you receive this SMS, your GSM module is latched to a cellular network and working fine.
- To check your tank’s water level you should send /status/ to the GSM module’s (SIM card) phone number.
- The circuit will measure and reply an SMS to your phone number which you entered in the code.
- Please note that your SMS should start and end with “/” and “status” should be in small letters, capital letters get rejected.
Also see: IoT Based Water Level Monitoring System
If you have any questions regarding this project, feel free to comments us below. You will get a guaranteed reply from us.