Introduction: 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.
Parts required to build:
- Arduino (or ATMega 328 with programmer).
- HC-SR04 or any common Ultrasonic sensor module.
- Presets (20K or 10K) - 2 Pc
- Male Header - 6 Pin
- Female header 16 Pin
- Push click micro switch
- Push toggle micro switch
- 10K 1/4 watt resistor
- 1N4007 Diode
- DC Power socket
- 220E resistor
- Veroboard (or Breadboard if you prefer)
- Hookup wires
- 16*2 LCD Screen with pin male headers attached
- Motor Driver and motor (if you want)
- Knowledge basic know how of electronics and Arduino
Step 1: Circuit Diagram
Step 2: 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
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 :
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.
We have a be nice policy.
Please be positive and constructive.