Introduction: Liquid Level Sensor (using Ultrasonic)

Picture of Liquid Level Sensor (using Ultrasonic)

Liquid Level Sensor detects the level of the liquid from a ground level. Turns on the motor (requires motor driver amplifier) below a given value and turns off it above a given value after filling the liquid.

Features of this system:

  • Works with any liquid (water, oil etc).
  • Range up to 250 cm ground distance (also height of the tank).
  • Precise measurement (up to 2 cm error) with HC-SR04, Ping etc.
  • Motor control output.
  • Calibration (in runtime) available for :
    • Ground Level : Can be calibrated for any tank (up to 250 cm tall) while the system is running, with a push button.
    • Motor turn ON and OFF levels : ON and OFF levels can be set with provided presets and a mode change button.
  • Off limits indication with '0 cm'.
  • Works on 5V DC.

Parts required to build:

  1. Arduino (or ATMega 328 with programmer).
  2. HC-SR04 or any common Ultrasonic sensor module.
  3. Presets (20K or 10K) - 2 Pc
  4. Male Header - 6 Pin
  5. Female header 16 Pin
  6. Push click micro switch
  7. Push toggle micro switch
  8. 10K 1/4 watt resistor
  9. 1N4007 Diode
  10. DC Power socket
  11. 220E resistor
  12. Veroboard (or Breadboard if you prefer)
  13. Hookup wires
  14. 16*2 LCD Screen with pin male headers attached
  15. Motor Driver and motor (if you want)
  16. Knowledge basic know how of electronics and Arduino

Step 1: Circuit Diagram

Picture of Circuit Diagram

Step 2: Working

Picture of Working

In our sensor board we have ultrasonic Tx and Rx parts. The sensor reads the distance from surface level of liquid. The Tx is basically a 40KHz speaker, which sends pulses of 40KHz Ultrasonic sound. The pulse sending time and pulse receiving time is noted for each pulse. This pulses are sensed in MCU.

The MCU notes the time difference between and then it used sound speed to calculate distance. The MCU is to be pre calibrated to record distance from ground level, that is when the tank/container is empty. The difference is calculated and thus we get the level of the liquid.

The level is shown in 16x2 LCD display. Also other details are shown in screen.

There are two presets for maximum and minimum value limit of the pump signal generator. The the is generated when liquid level reaches over maximum limit set by the preset. The signal again goes low when it reaches below minimum limit set by other preset.

The ground distance calibration is done by a switch, which sends a signal to the atmega328 chip and it records the current distance and sets it as reference ground.

Step 3: Program - Arduino

The program is made in Arduino. Use this to burn to Atmega328 (or any of your liking).

Program is available at git under GPL-3.0.

A compiled hex file is already given for easy upload using arduino-builder.

Dependencies:

Newping library.

Step 4: Calibration and Data

The LCD screen shows the current level (difference) from the calibrated level.

The two presets decide the upper (max level) after which load will turn off and lower (min level) after which load will turn on. Load intended here is pump, as this system is applicable in automated pump system. Four header are for sonic (ping) sensor. I used HC-SR04. One pair of header for motor (digital pin 9). Requires an external pump driver. It used EEPROM to store calibration data.

Two calibrations are provided :

  • LEVEL_CAL
  • MOTOR_TRIGGER_CAL

Step 5: Pump Control

The board has 2 dedicated pins for pump signal.

One gives out 5V signal when pump needs to be turned on (when liquid level goes below preset low limit value) and gives 0V signal when pump should be kept off (level goes over upper limit).

The signal is sent a relay board to control a AC pump.

Comments

Swansong (author)2017-09-15

That's a neat idea, do you have any photos of the finished project?

Subhajitdas298 (author)Swansong2017-09-15

I have the finished product. I will upload pics and videos soon.

About This Instructable

67views

2favorites

License:

Bio: Electronics and Telecommunication Engineer, Software Engineer, Hobbyist
More by Subhajitdas298:Liquid Level Sensor (using Ultrasonic)Wireless AVR Programmer (WiFi)Rotary Car Parking System
Add instructable to: