This article shows how to make a water level controller with the 8051 microcontroller. This website has a number of water level controller projects, however this is the first one that uses a microcontroller. This water level controller monitors the level of the over head tank and activates the water pump when the level falls below a predetermined threshold. The level of the over head tank is shown by five LEDs, and when the tank is full, the pump is turned off. If the water level in the sump tank falls below a certain level, the pump will not start, and it will also be turned off if the level falls below that level during a pumping cycle.
This Water Level Controller comes with a Project Kit that can be purchased from our Online Store. The project kit is a tweaked version of the above-mentioned project. The water level is measured using four float switches in this Water Level Controller project kit. An LCD module displays the status of the tank’s water level and the motor’s status. This device keeps track of the tank’s water level and turns on the motor when the tank is empty. When the overhead tank or container is full, the motor is turned off.
The usage of float switches toughens up the circuit and ensures that it runs for a long time without needing to be serviced. The project kit is available in two versions: plug-and-play and do-it-yourself. The kit also includes a 12-0-12 mains transformer, which is not depicted in the diagram below.
Through transistors, the level sensor probes for the overhead tank are connected to the microcontroller’s port 2. Take a look at Fig 1 for the sensor probe setup for the overhead tank. A positive voltage supply probe is inserted into the tank’s bottom. The probes for sensing 1/4, 1/2, 3/4, and FULL levels are set one by one above the bottom positive probe with equal spacing. Consider the topmost (full level) probe, which is connected to the base of transistor Q4 via resistor R16 on the other end. When the water level reaches to the maximum, current flows into the base of transistor Q4, turning it on and lowering the collector voltage.Q4’s collector is connected to P2.4, and a low voltage at P2.4 indicates that the over head tank is empty. The base of Q2 opens open when the water level falls below the full level probe, turning it off. The collector voltage is now quite high at P2.4, indicating that the tank is not full. Other sensor probes (3/4, 1/2, 1/4) work in the same way, and the CPU determines the current level by scanning the port pins P2.4, P2.5, P2.6, and P2.7. The fact that all of these port pins are high (and all of the sensor probes are open) indicates that the tank is empty.
The pump is controlled by port pin P0.5. When it’s time to start pumping, the controller sets P0.5 low, which turns on transistor Q6, which activates the relay K1 and turns on the pump. The LED d6 also illuminates, indicating that the motor is turned on. The low sump indicator is LED D7. When the water level in the sump tank falls below a certain level, the controller lowers P0.7, causing LED D7 to illuminate. The water level controller’s circuit diagram is shown in the image below.
MOV P2,#11111111B // initiates P2 as sensor input
MOV P0,#11111111B // initiates P2 as the output port
MAIN:ACALL SMPCK // checks the level of the sump tank
MOV A,P2 // moves the current status of P2 to A
CJNE A,#11110000B,LABEL1 // checks whether tank is full
CLR P0.0 // glows full level LED
CJNE A,#11111000B,LABEL2 // checks whether tank is 3/4
CLR P0.1 // glows 3/4 level LED
CJNE A,#11111100B,LABEL3 // checks whether tank is 1/2
CLR P0.2 // glows 1/2 level LED
CJNE A,#11111110B,LABEL4 // checks whether tank is 1/4
CLR P0.3 // glows 1/4 level LED
CLR P0.5 // switches motor ON
CJNE A,#11111111B,MAIN // checks whether tank is empty
CLR P0.4 // glows EMPTY LED
JB P0.6,MAIN // checks whether sump is low
CLR P0.5 // switches motor ON
SMPCK:JB P0.6,LABEL5 // checks whether sump is low
SETB P0.7 // extinguishes the sump low indicator LED
LABEL5:SETB P0.5 // switches the pump OFF
CLR P0.7 // glows sump low indicator LED