Checking and controlling the level of water in water tanks is the most critical and important operation in commercial and residential water management. Most of the time, particularly in residential setups, because of inaccessibility of overhead tanks, it is observed that water is overflowing from the tanks as there is no monitoring system available. This problem can be eradicated by using this fully automatic water level controller.
The solution for the above issue is to have a programmed system to monitor and control the level of water. While there are numerous strategies for utilizing distance sensors, utilizing current probes, utilizing ultrasonic range meter and so on, here we will focus on utilizing an ultrasonic sensor for creating an automated water level controller for this issue.
Water Level Controller system overview:
This water level controller contains an ultrasonic ranging sensor put on top of the tank. Once triggered, it sends out an ultrasonic signal. Water present in the tank will reflect-off the ultrasound. The sensor would receive this signal and act accordingly. A microcontroller in the water level controller is used to trigger the signal to the microprocessor and a beam of ultrasound is received. Once the sensor receives an echo then it knows exactly the level of water that is there in the tank. It must be noted that the sensor here is placed at the top of the tank.
Since the range sensor is positioned atop the tank, control over water flow is completed taking into consideration the amount of water from the top of the tank. For instance, if the measured range is found to be between 0 to at least 1 cm, the tank is overflowing additionally the microcontroller in the water level controller sends a control signal to rotate the motor in reverse direction, in order to eliminate the surplus water.
In case the range is between 2 to 5 cm, the tank is supposedly full therefore the microcontroller sends a control signal to turn off the motor. In the event that range is above 5cm, the tank is practically empty therefore the microcontroller sends a signal to rotate the motor in the forward direction.
The circuit of the water level controller would comprise of the following elements:
- Ultrasonic Range Finder SRF04
- PIC Microcontroller PIC16F84A
- Motor Driver L293
- DC Motor
- Two 1K Resistors
Details of Components:
Ultrasonic Range Finder SRF04:
The SRF04 is a superior quality ultrasonic ranger that is utilized in many robotic applications for simple detection of obstacles. It takes 10 microseconds to reach the trigger state. Once triggered, it will generate 8 pulses of ultrasound, at a frequency of 40 KHz and simultaneously raises its echo line to HIGH.
Once it receives the reflected signal or echo, it lowers the echo line to LOW. The width of the echo pulse, in this case, determines the depth or distance from which water levels can be measured.
PIC Microcontroller PIC16F84A
It really is a CMOS compatible, 8-bit, 18 pin Flash Microcontroller with just one 8-bit Timer and an 8-bit programmable prescaler. The Timer operation is controlled making use of the registry entries that are OPTION_REG, TMR0, and INTCON.
The OPTION_REG is a register that is 8-bit whose 5th bit (T0CS) selects the desired timer. Programming the bit selects counter operation whereas clearing it selects timer operation. TMR0 could be the timer register, whereas INTCON could be the register that is interrupt register with a 5th bit (T0IE) denoting the timer flag, in other words, it sets as soon as the Timer overflows.
Motor Driver L293:
This is a 16 pin, H-bridge based DC motor driver IC. It offers the ability to drive two motors that too in both directions. It is comprised of two enable pins Pin1 and 9 which once set to HIGH, brings on the IC operation. It basically will act as an interface between your microcontroller as well as the DC motor. It is composed of four input pins – two for every H-bridge circuit.
It can be any of your regular DC motors available in the market which suits your operational requirements.
Working of the system:
This system is created so that a 10 microseconds pulse is sent through the microcontroller to trigger the ultrasonic ranger. This is done by writing a delay function. The timer register, TMR0 is programmed with decimal value 200, such that it makes 55 counts.
The output that is obtained from SRF04, i.e. echo signal is obtained from RA4.T he Timer clock pin provides an external clock pulse into the timer. After the echo signal makes a transition from HIGH to LOW, the timer will get activated. Due to the fact that the timer counts, the interrupt flag bit, T0IE. Once programmed, the timer is deactivated.
The process is repeated for the next echo pulse and so forth. The sheer number of times the timer operates is calculated and also this denotes the number of echo pulses. We have stated earlier that each echo pulse is of 58 microseconds, it denotes 1 cm. Hence 5 echo pulses would denote 5cm. This data is then used to regulate the DC motor. The direction flow of the motor can also be controlled using the same system.