Monday, November 4, 2024

More results...

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Search in posts
Search in pages

Smartphone Based Liquid Level Monitoring System

efy tested sani theoMeasurement of liquid level in process tanks for monitoring and/or controlling is essential in process industries. In process plants, tanks contain various liquids that are generally costly. Some of the liquids are inflammable and corrosive as well. Therefore, it is very much essential to monitor the level of liquid in a tank so that it doesn’t overflow from the tank.

Various methods are used to monitor the level of liquids, and the selection of technology to be used is based on several factors like:

  • Maximum and minimum temperature
  • Maximum and minimum pressure
  • Tank geometry
  • Nature of liquid
  • Tank construction material

There are no level detectors or switches that can precisely specify the accuracy or reliability of a particular application. One of the most popular level detectors is the ultrasonic level detector. The advantages of ultrasonic level detector include its non-contact use and suitability for various liquids. Ultrasonic level detectors operate by generating an ultrasonic pulse and measuring the time taken for the echo to return.

- Advertisement -

If the detector is mounted at the top of the tank, the pulse travels in air at a speed of 331m/sec at 0°C. Therefore the time of travel is an indication of the depth of empty space above the liquid in the tank. In case of water at 25°C, an ultrasonic pulse travels at 1505m/sec. For testing, we mounted the detector on top of a glass jar and the liquid used was water. The author’s prototype is shown in Fig. 1.

Authors’ prototype of the project
Fig. 1: Authors’ prototype of Smartphone-Based Liquid Level Monitoring System the project

The screenshot of the Android application to monitor the water level in the tank is shown in Fig. 2. The block diagram of the project is shown in Fig. 3.

- Advertisement -
Screenshot of the Android application for Liquid Level Monitoring System
Fig. 2: Screenshot of the Android application for Liquid Level Monitoring System
Block diagram of the project
Fig. 3: Block diagram of the project
Top view of typical HC-05 Bluetooth module
Fig. 4: Top view of typical HC-05 Bluetooth module

Circuit and working

The project consists of two parts: A transmitter unit built around Arduino Uno, an HC-05 Bluetooth module, and an ultrasonic sensor module (HC-SR04). The receiver unit is your Android smartphone with an Android app installed. The circuit diagram of the project (transmitter) is shown in Fig. 5. The major components used in this project are:

Connection diagram of the Liquid Level Monitoring System project (transmitter)
Fig. 5: Connection diagram of the Liquid Level Monitoring System project (transmitter)

Android application. The level monitoring application (levelmonitoring.apk) used here has been built using the MIT App Inventor. When this app is running, the data sent by the HC-05 Bluetooth module is received and displayed on the Android smartphone. The level monitoring application has been tested on Micromax Q372 smartphone with Android Lollipop v5.0.

Arduino Uno. Arduino Uno is an AVR ATmega328P microcontroller based development board with six analogue input pins and fourteen digital I/O pins. The microcontroller has 32kB ISP flash memory, 2kB RAM, and 1kB EEPROM. The board provides the capability of serial communication via UART, SPI, and I2C. The microcontroller can operate at a clock frequency of 16MHz. The HC-05 Bluetooth module and ultrasonic sensor module (HC-SR04) are interfaced with the Arduino Uno.

HC-05 Bluetooth module. It is an easy to use Bluetooth SPP (serial port protocol) module designed for transparent wireless serial connection setup. The serial port Bluetooth module is a fully qualified V2.0 Bluetooth 3Mbps EDR (enhanced data rate) modulation with a complete 2.4GHz radio transceiver and baseband. It uses the CSR Bluecore 04-External single-chip Bluetooth system with CMOS technology and AFH (adaptive frequency hopping feature). The top view of a typical 6-pin HC-05 Bluetooth module is shown in Fig. 4. This project uses only four pins: RXD, TXD, Vcc, and GND pins of the HC-05 module. So, you can use any similar 4-pin Bluetooth module for this project.

HC-SR04 ultrasonic sensor module. The ultrasonic ranging module HC-SR04 provides a 2cm to 400cm non-contact measurement function with accuracy up to 3mm. The module includes an ultrasonic transmitter, receiver, and control circuit.

It has four pins—echo, trig, Vcc, and GND. The basic working principle of the module is as explained here.

Trig(trigger) pin is an input pin. It is made for a high pulse of at least 10µs duration, on receipt of which it automatically sends eight sonic bursts of 40kHz (ultrasonic signals). This signal, after reflecting from the object/water, is received by the echo pin.

The echo pin is an output pin. It goes high for a period of time, which is equal to the time taken for the ultrasonic wave to return to the sensor. The echo pin provides the travelling time of the sound wave in microseconds.

The connection diagram of the ultrasonic module with Arduino is shown in Fig. 5.

The ultrasonic sensor measures the distance between the sensor and object/liquid by sending an ultrasonic wave and calculating the time required for the echo to return. If the time between the trigger and echo is known, the distance of the object can be calculated by simply multiplying half of the time with the speed of sound in air. This principle is used here to detect the level of water in a tank. The working of the sensor is illustrated in Figs 6 and 7.

Empty tank
Fig. 6: Empty tank
Tank filled with water to a certain height (h)
Fig. 7: Tank filled with water to a certain height (h)

As shown in Fig. 6, when the tank is empty, the ultrasonic wave hits the bottom of the tank and gets reflected. As a result, it detects the depth of the empty tank at ‘H’ height.

If the tank is filled with water up to ‘h’ height, the ultrasonic wave is reflected from the water surface, and it detects the depth of empty space ‘y’ above the water, as shown in Fig. 7.

When ‘H’ and ‘y’ are known, the water level ‘h’ can be calculated by subtracting ‘y’ from ‘H,’ that is, h=(H-y). The value of H is calculated only once during the initial calibration when the tank is empty. For our setup, the value of H was 17cm. You can change the value of H in the code to 30cm, 50cm, or any other value depending on the height of the tank.
The value of the water level is sent to the HC-05 Bluetooth module using serial communication. As shown in Fig. 5, RXD and TXD pins of the Bluetooth module are connected to TX and RX pins of the Arduino Uno board, respectively. The HC-05 Bluetooth module sends this data wirelessly to the smartphone via Bluetooth. The data received on the smartphone is displayed on the app. To connect the Bluetooth module with the smartphone, these must be paired.

Construction and testing

Download the ‘smart_water_level.ino’ source code to the Arduino Uno board. The ‘Level Monitoring’ application is installed on the Android smartphone. Next, turn on the Bluetooth on your smartphone.

When you power on the circuit (transmitter side), the HC-05 Bluetooth module gets paired with Bluetooth on your Android smartphone. The default passkey is ‘1234’ or ‘0000’.

After successful pairing, open the ‘Level Monitoring’ app from the smartphone and press the Bluetooth logo. You will get a list of Bluetooth devices detected by your smartphone. You need to select an HC-05 device from the list.

After a successful connection, you will get a ‘Connected’ message on the main screen of the application. The Android application will now start to display the water level data received from the transmitter side.

Assemble the circuit, as shown in Fig. 5, and place the ultrasonic sensor at top of the vessel/container whose liquid level you want to measure. For troubleshooting, you can check voltages at different test points, as shown in Table 1.

A screenshot of the smartphone displaying the water level=9cm during testing is shown in Fig. 8.

Water level (9cm) displayed on smartphone
Fig. 8: Water level (9cm) displayed on smartphone

Download Source Code


Saikat Patra is passionate about electronics and MCU based embedded system applications

Shibendu Mahata is M.Tech (Gold Medallist) in Instrumentation and Electronics Engineering from Jadavpur University. He loves designing MCU based real-time embedded signal processing and process control systems

3 COMMENTS

SHARE YOUR THOUGHTS & COMMENTS

EFY Prime

Unique DIY Projects

Electronics News

Truly Innovative Electronics

Latest DIY Videos

Electronics Components

Electronics Jobs

Calculators For Electronics