Introduction
Water level monitoring and control are crucial for various applications, from household tanks to industrial reservoirs. Automating this process can prevent overflow, conserve water, and maintain optimal levels. This article outlines the design and implementation of a Water Level Indicator and Controller using a PIC Microcontroller, focusing on simplicity, effectiveness, and scalability.
Components Required
PIC Microcontroller: PIC16F877A or any suitable PIC microcontroller.
Water Level Sensors: Typically, conductive probes or float switches.
LCD Display: For displaying water levels.
Relays: For controlling water pumps or valves.
Power Supply: For powering the circuit and microcontroller.
Resistors, Capacitors, and Other Basic Electronic Components: For circuit stability and interfacing.
Transistors: For switching relays or controlling loads.
Circuit Diagram
Below is a simplified overview of the circuit:
PIC Microcontroller: Connect the microcontroller to the water level sensors, LCD display, and relays.
Water Level Sensors: Position the sensors at different levels in the tank.
LCD Display: Connect to the microcontroller to display the current water level.
Relays: Connect to the microcontroller outputs to control the water pump or valve.
Water Level Sensor Configuration
Water level sensors are critical for this project. They can be classified into:
Conductive Probes: Simple and effective, these probes are placed at different heights in the tank. They work on the principle of conductivity; when the water reaches a probe, it completes the circuit and sends a signal to the microcontroller.
Float Switches: These are mechanical switches that float on the water's surface. They can activate or deactivate when the water level changes.
Microcontroller Configuration
The PIC Microcontroller (e.g., PIC16F877A) is used to read the water level from sensors and control the display and relays. Here’s how to set it up:
Pin Configuration: Connect sensor outputs to the analog/digital pins of the PIC. Connect the LCD display to the appropriate pins for data and control.
Programming: Write a program in MPLAB X IDE or another suitable compiler. The code will read the sensor inputs, process the data, and drive the LCD and relays accordingly.
Sample Code
Here’s a sample code snippet to give you an idea of how to handle the sensors and control the display:
#include <xc.h>
#include <stdio.h>
#include "lcd.h"
#define _XTAL_FREQ 4000000
void main(void) {
TRISB = 0x00; // Set PORTB as output for relays
TRISA = 0xFF; // Set PORTA as input for sensors
LCD_Init();
while(1) {
if (RA0 == 1) { // Check sensor 1
LCD_Set_Cursor(1,1);
LCD_Write_String("Low Level");
PORTBbits.RB0 = 1; // Activate relay to turn on pump
} else if (RA1 == 1) { // Check sensor 2
LCD_Set_Cursor(1,1);
LCD_Write_String("Medium Level");
PORTBbits.RB0 = 0; // Deactivate pump if needed
} else if (RA2 == 1) { // Check sensor 3
LCD_Set_Cursor(1,1);
LCD_Write_String("High Level");
PORTBbits.RB1 = 1; // Activate another relay if needed
} else {
LCD_Set_Cursor(1,1);
LCD_Write_String("No Water");
PORTBbits.RB0 = 0; // Ensure pump is off
}
__delay_ms(500);
}
}
Working of the System
Initialization: Upon startup, the microcontroller initializes the LCD and reads the water level from sensors.
Sensor Reading: The microcontroller constantly checks the state of the sensors. Based on the sensor input, it updates the LCD with the current water level.
Relay Control: The microcontroller controls the relays to activate or deactivate the water pump or valves, depending on the water level.
Testing and Calibration
Testing: Once assembled, test each component individually to ensure correct operation. Verify sensor readings, LCD display functionality, and relay control.
Calibration: Adjust the sensor positions and code thresholds according to the specific requirements of your tank and application.
Conclusion
The Water Level Indicator and Controller using a PIC Microcontroller is a practical and efficient solution for managing water levels. By following this guide, you can build a system that ensures accurate monitoring and control, contributing to better water management.
References
PIC16F877A Datasheet: Microchip
LCD Module Documentation: [Your LCD Manufacturer's Website]
MPLAB X IDE: Microchip
Want us to guide you through your project or make the project for you ?
Create Various Projects
Check out our Free Arduino Projects Playlist - Arduino Projects
Check out our Free Raspberry Pi Projects Playlist - Raspberry Pi Projects
Check out our Free TinkerCAD Projects Playlist - TinkerCAD Projects
Check out our Free IoT Projects Playlist - IoT Projects
Check out our Free Home Automation Projects Playlist - Home Automation Projects
Check out our Free NodeMCu Projects Playlist - NodeMCu Projects
Comments