Water tank controller is an embedded project where motor switch automatically controlled by a microcontroller .When tank's water level is very low , the microcontroller system turns on the motor switch , Until the water level is full or 100% and the motor switch remains on . When microcontroller get notification tank is full , it turns off the switch of motor . Until the tank is empty this stage remains on .
Now the question is , how can we get notification about water level ? We will apply a technique . Look at the picture given below .
![]() |
Microcontroller Project : Water Tank Controller using pic18f2550 Microcontroller |
Here microcontroller pins (RA0-RA4) are connected to VDD through five 10k Ohm resistors . Five cables are connected to the points between resistors first end points and mcu (RA0-RA4)pin points . Those five (A,B,C,D,E) cables are hanged into the tank at different five levels(A,B,C,D,E) so that each cable represents each of five levels individually .
![]() |
Microcontroller Project : Water Tank Controller using pic18f2550 Microcontroller |
Once water level goes to E level , it makes enable the connection between GND and 'E' level cable . So , it makes the RA4 pin GND(logical 0) and we get notification the tank is empty . Consequently the system turns on the motor of switch .
![]() |
Water Tank Controller Project using Microcontroller |
When it's full, all the mcu pins(RA0-RA4) goes to low or 0 . We get the notification tank is full the motor needs to be turned off . That's the working process of this system.
Souece Code :
void main() {
ADCON1=0x0F; // Configure RA) pin as input
CMCON=7;
TRISC.F0=0;
TRISA.F0=1;
TRISA.F1=1;
TRISA.F2=1;
TRISA.F3=1;
TRISA.F4=1;
TRISB=0x00;
while(1){
if(PORTA.F4==0 && PORTA.F3==0 && PORTA.F2==0 && PORTA.F1==0 && PORTA.F0==0){
PORTB.F0=1;
PORTB.F1=1; // 100% full
PORTB.F2=1;
PORTB.F3=1;
PORTB.F4=1;
PORTC.F0=0; //motor turned off
}
if(PORTA.F4==0 && PORTA.F3==0 && PORTA.F2==0 && PORTA.F1==0 && PORTA.F0==1){
PORTB.F0=0;
PORTB.F1=1; // 80% full
PORTB.F2=1;
PORTB.F3=1;
PORTB.F4=1;}
if(PORTA.F4==0 && PORTA.F3==0 && PORTA.F2==0 && PORTA.F1==1 && PORTA.F0==1){
PORTB.F0=0;
PORTB.F1=0;
PORTB.F2=1; // 60% full
PORTB.F3=1;
PORTB.F4=1;
}
if(PORTA.F4==0 && PORTA.F3==0 && PORTA.F2==1 && PORTA.F1==1 && PORTA.F0==1){
PORTB.F0=0;
PORTB.F1=0; // 40% full
PORTB.F2=0;
PORTB.F3=1;
PORTB.F4=1;
}
if(PORTA.F4==0 && PORTA.F3==1 && PORTA.F2==1 && PORTA.F1==1 && PORTA.F0==1){
PORTB.F0=0;
PORTB.F1=0;
PORTB.F2=0;
PORTB.F3=0; // 20% full
PORTB.F4=1;
PORTC.F0=1; //motor turned on
}
}
}
Circuit :
![]() |
Water Tank Controller Project using Microcontroller |
![]() |
Water Tank Controller Project using Microcontroller |
how did you manage to produce a hex file without assigning the PIC in the C source file? I'm having issues trying to compile the C source file given here.
ReplyDeleteAh! I used MikroC IDE and framework library.
DeleteThis is a great inspiring article.I am pretty much pleased with your good work.You put really very helpful information. Keep it up. Keep blogging. Looking to reading your next post. view more
ReplyDeleteThank you.
DeleteYour work is truly appreciated round the clock and the globe. It is incredibly a comprehensive and helpful blog. οικιακά φίλτρα νερού
ReplyDeleteThank you.
DeleteI wanted to thank you for this excellent read!! I definitely loved every little bit of it. I have you bookmarked your site to check out the new stuff you post. project execution
ReplyDeleteReally nice and interesting post. I was looking for this kind of information and enjoyed reading this one. Keep posting. Thanks for sharing. lora module
ReplyDeleteConsidering Microcontroller project for water level is not a piece of cake so this post is quite helpful for understating water level indicator project. Assignment Writing Services
ReplyDeleteCan i get the header file from this coding?
ReplyDeleteAwesome and interesting article. Great things you've always shared with us. Thanks. Just continue composing this kind of post. crystal water bottle
ReplyDeleteThanks for another wonderful post. Where else could anybody get that type of info in such an ideal way of writing? https://www.nox-emulator.com/hydrogen-water-and-their-advantages/
ReplyDeleteThe gatherer liquid goes through one side of the exchanger and the tank water goes through the opposite side. รับติดตั้งโรงงานน้ำดื่ม
ReplyDeleteWe as a whole need to have a pardon for our conduct when it isn't what we proposed; eliminate that hindrance. Liquor store near me
ReplyDeleteAdmiring the time and effort you put into your blog and detailed information you offer!.. máy lọc nano
ReplyDeleteThis is very educational content and written well for a change. It's nice to see that some people still understand how to write a quality post!
ReplyDeleteultrasonic level sensor
These things are very important, good think so - I think so too... visit this page
ReplyDeleteI see some amazingly important and kept up to a length of your strength searching for in your on the site.Waste Water Solutions Company
ReplyDeleteNice post. I was checking constantly this blog and I’m impressed! Extremely useful info specially the last part I care for such information a lot. I was seeking this certain info for a long time. Thank you and good luck.shopping for a tankless water heater
ReplyDeleteThis is an article about the importance of routine ice machine maintenance. ice tube maker
ReplyDeleteThat is great post which you have shared here. I get an information by this blog for test and tag equipment which is my interest. I like your blog too much please share more info for us. Thank you.
ReplyDeleteRegardless of whether you're purchasing straightforwardly from a business online retailer, an individual web based shopping webpage, or an Internet closeout website, shopping on the web can be fun, basic, efficient and prudent.car battery to outlet
ReplyDeletecar battery to power outlet
We believe in providing a top-quality digital marketing agency in Jacksonville, FL, businesses can trust with their digital growth. You can get the most out digital marketing agency jacksonville
ReplyDeleteI learn some new stuff from it too, thanks for sharing your information. Mold Damage
ReplyDeleteclinique chirurgie esthétique Tunisie prix tout compris
ReplyDeleteSometimes it becomes very hard to find a well-written and well-established bog which gives you correct and useful information. However, I found this blog and got some relevant information that is helpful for me.Dairy Wastewater Treatment Plants
ReplyDeleteNeed professional WordPress Web Design Services? We're experts in developing attractive mobile-friendly WordPress websites for businesses. Contact us today! https://just99marketing.com/wordpress-web-design
ReplyDeleteWater restoration involves not only removing water but also addressing potential contaminants and sanitizing the area. water damage restoration
ReplyDeleteInvesting in a high-quality water heater is worth every penny. replacing water heater raleigh
ReplyDeleteTankless water heaters heat water on-demand.
ReplyDeletewater heater replacement melbourne
"A well-insulated attic can reduce the workload on your water heater during winter." water heater replacement danville virginia
ReplyDeleteElectric water heaters are not affected by altitude.
ReplyDeletewater heater surprise az
Water heater efficiency – it's all about saving energy and money. water heater replacement nm
ReplyDeleteConsider a point-of-use water heater for specific needs. water heater replacement berkeley california
ReplyDeleteSediment buildup is a common issue in water heaters, which can reduce efficiency and shorten the lifespan of the appliance.
ReplyDeletewater heater replacement rancho cucamonga
Water heaters with a digital interface offer easy programming and monitoring.
ReplyDeletewater heater repair
Regular maintenance can help ensure a water heater operates at peak efficiency.
ReplyDeletewater heater repair murfreesboro
Storage water heaters store and heat a specific amount of water.
ReplyDeletewater heater replacement edgewater