Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
    • Design Guides
      • WiFi & the IOT Design Guide
      • Microcontrollers Design Guide
      • State of the Art Inductors Design Guide
  • Women in Engineering

Rain Detector using 8051 Microcontroller

By Salman Khan

 

Now we are going to learn how to make a rain detector with only a LCD and a microcontroller to control your hole circuit. This controller will give you the data that what is the speed of the rain. You can also make a circuit from this that to make water flowing from the pipe this will take the detail of the water flowing from the pipe and tell you the speed of the rain. You can fit it at very far places and the places where you go very less. You can place it in the office, in that office form where you cannot see outside you cannot tell or predict the speed of rain like if you are in a hall or in the mall. You can make a automatic system which can help you to work in the further process. So let’s begin.

Aim: To make rain detector with microcontroller 8051.
Principle: It works in the principle of water conducting electricity.
Material required: present, 8051 microcontroller (I used P89C52X2BN), LCD, connecting wire, hole pin, plastic pipe, battery.
Description:
This rain detector is working in very simple process of water conducting electricity. The wire which is connected to Vcc and the other four wires are made to be inside the pipe whose image is given below. It has different levels namely slow, moderate, high, and very high via BC547 transistor. Port P2 is connected to data pins of LCD and P1.0, P1.1, P1.2, are connected to RS, RW, and EN pins of LCD respectively.
When there is no rain it will show No Rain. As the rain starts the pipe gets filled slowly wire at different levels get some positive voltage, due to conducting nature of the water. Due to this voltage is sent to their respective pins on controller. When first drop fall in that pipe, LCD displays the message slow. When the speed of rain increases the water get touched the wire and show different message like slow, moderate, high, very high.
 
Overview of 8051 Microcontroller based Rain Detector
Fig. 1: Overview of 8051 Microcontroller based Rain Detector
How to make:
You only have to see the circuit and connect the wire.
For PCB users:
Do the etching process and whatever required making the circuit or buying readymade prototype PCB containing holes. This is your headache just make a PCB design and makes it.
Advantages:
      1.      It will tell you the detail of the rain.
      2.      Very less energy is required to give a good result.
      3.      You can make your own.
      4.      Work with a basic principle.
      5.      Very easy to make
      6.      Easy to handle.
      7.      Lots more
Disadvantages:
      1.      It could not store the data for further use but if you what you can make this out of it.
       2.      It has to on for 24 hour.
      3.      Alert will be start when rain is there, sometime it disturb human.
      4.      Cannot tell you from far has to be very close to it to find out that whether it is raining or what.
      5.      It has to be in few heights so that something could not enter it.

 

 

Project Source Code

###

// Program to make a Rain detector with Microcontroller 8051 from Salman
#include<REG52X2.H>
sbit rs=P1^0; //register select pin
sbit rw=P1^1; //read/write pin
sbit e=P1^2; //enable pin
sbit firs=P3^0; //pin connected to 1st level of pipe
sbit seco=P3^1; //pin connected to 2nd level of pipe
sbit thir_3=P3^2; //pin connected to 3rd level of pipe
sbit fort=P3^3; //pin connected to 4th level of pipe
sbit spkr_on=P3^4;  
sbit spkr_off=P3^5; // pin to off speaker

void delay(int k) //delay function
{
int i,j;
for(i=0;i<k;i++)
for(j=0;j<1275;j++);
}

void write(int j) //write function
{
rs=1; //selecting command register
rw=0; //selecting to write
P2=j; //putting value on the pins
e=1; //strobe the enable pin
delay(1);
e=0;
return;
}

void cmd(int j) //command function
{
P2=j; //put the value on pins
rs=0; //selecting command register
rw=0; //selecting to write
e=1; //strobe enable pin
delay(1);
e=0;
return;
}

void puts(char *a) //puts function to print a string
{
unsigned int p=0;
for(;a[p]!=0;p++)
write(a[p]);
}

void lcd_init(void) // function to initialise the LCD
{
cmd(0x38); //setting 8-bit interface, 2 lines, 5*7 Pixels
delay(1);
cmd(0x0e); //turning on underline visible cursor
delay(1);
cmd(0x01); //clearing screen
cmd(0x80); //moving cursor to the begining of line 1 of LCD
}

void main()
{
firs=seco=thir=fort=spkr_off=1; //configuring as input pins
firs=seco=thir=fort=spkr_off=0; //lowering input pins
spkr_on=1; // making speaker on pin high,as it works on negative logic
while(1)
{
while(firs==0&&seco==0&&thir==0&&fort==0&&spkr_off==0) //condition when pipe is empty
{
lcd_init(); // initialising LCD
puts("No Rain"); //printing No Rain on lcd
}
while(firs==1&&seco==0&&thir==0&&fort==0&&spkr_off==1) //condition when 1st level
{
lcd_init();
puts("Slow"); //printing Slow on lcd
}
while(firs==1&&seco==1&&thir==0&&fort==0&&spkr_off==1) //condition when 2nd level
{
lcd_init();
puts("Moderate"); //printing Moderate on lcd
}
while(firs==1&&seco==1&&thir==1&&fort==0&&spkr_off==1) //condition when 3rd level
{
lcd_init();
puts("High"); //printing High on lcd
}
while(firs==1&&seco==1&&thir==1&&fort==1&&spkr_off==1) //condition when 4th level
{
lcd_init();
puts("fort;Very High"); //printing Very High on lcd
spkr_on=0;// Enabling speaker
}
while(firs==1&&seco==1&&thir==1&&fort==1&&spkr_on==0&&spkr_off==1)//enabling high speaker_off pin
{
spkr_on=1;//disabling speaker
}
}
}

###

 


Circuit Diagrams

Circuit-Diagram-8051-Microcontroller-Based-Rain-Detector


Filed Under: Electronic Projects
Tagged With: 8051 microcontroller, rain detector
 

Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


Featured Tutorials

  • PS2 Keyboard To Store Text In SD Card Using Arduino Circuit Setup On Breadboard
    How To Use PS2 Keyboard To Store Text In SD Card Using Arduino- (Part 42/49)
  • Wireless Path Tracking System Using Mouse, XBee And Arduino Circuit Setup On Breadboard
    How To Make A Wireless Path Tracking System Using Mouse, XBee And Arduino- (Part 43/49)
  • How to Make a Wireless Keyboard Using Xbee with Arduino- (Part 44/49)
  • Making Phone Call From GSM Module Using Arduino Circuit Setup On Breadboard
    How to Make Phonecall From GSM Module Using Arduino- (Part 45/49)
  • How to Make a Call using Keyboard, GSM Module and Arduino
    How To Make A Call Using Keyboard, GSM Module And Arduino- (Part 46/49)
  • Receiving SMS Using GSM Module With Arduino Prototype
    How to Receive SMS Using GSM Module with Arduino- (Part 47/49)

Stay Up To Date

Newsletter Signup

Sign up and receive our weekly newsletter for latest Tech articles, Electronics Projects, Tutorial series and other insightful tech content.

EE Training Center Classrooms

EE Classrooms

Recent Articles

  • Renesas delivers intelligent sensor solutions for IoT applications
  • Microchip Technology releases AVR-IoT Cellular Mini Development Board
  • Qualcomm acquires Cellwize to accelerate 5G adoption and spur infrastructure innovation
  • MediaTek’s chipset offers high-performance option for 5G smartphones
  • Nexperia’s new level translators support legacy and future mobile SIM cards

Most Popular

5G 555 timer circuit 8051 ai Arduino atmega16 automotive avr bluetooth dc motor display Electronic Part Electronic Parts Fujitsu ic infineontechnologies integratedcircuit Intel IoT ir lcd led maximintegratedproducts microchip microchiptechnology Microchip Technology microcontroller microcontrollers mosfet motor powermanagement Raspberry Pi remote renesaselectronics renesaselectronicscorporation Research samsung semiconductor sensor software STMicroelectronics switch Technology vishayintertechnology wireless

RSS EDABOARD.com Discussions

  • Adaptive filters fundamental
  • Using LTspice to check Current sense transformer reset?
  • Thermal pad construction on pcb
  • lna+mixer noise figure problem
  • Reference driver for negative/above rail voltages.

RSS Electro-Tech-Online.com Discussions

  • Capacitor to eliminate speaker hum
  • Identify a circuit.
  • How is this tester made?
  • undefined reference header file in proteus
  • Control Bare LCD With ATmega328p
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • About Us
  • Contact Us
  • Advertise

Copyright © 2022 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
    • Design Guides
      • WiFi & the IOT Design Guide
      • Microcontrollers Design Guide
      • State of the Art Inductors Design Guide
  • Women in Engineering