Moisture sensing automatic plant watering system (2024)

DIY Automatic plant watering system

This project is about a moisture-sensing automatic plant watering system using 8051 microcontroller. The system simply senses the moisture level and switches on the irrigation pump when the moisture is below the set limit. The system switches off the pump when the moisture rises above the set point. The moisture level threshold can be set using a trim pot on the system. The status of the pump (whether ON or OFF) is displayed on a 16×2 LCD display. The system can be divided into three section as follows.

Sensing prob.

YL 69 moisture sensing probe is used to sense the moisture here. It is simply a fork-shaped PCB with tracks running on both sides of the legs. Just plug this probe into the soil where you want to sense the moisture. Image of the YL 69 sensing probe is given below.

Comparator circuit.

YL 38 comparator module is used in this project. It is a single channel opamp comparator based on L393 IC. This module just compares the output voltage of the sensing probe with a reference voltage and switches its voltage appropriately for the microcontroller to read. Circuit diagram of the YL 38 comparator module is shown below.

The output voltage of the sensing probe is connected to the inverting input of the opamp. When the moisture level is high more current passes through the sensing probe and so the voltage at the inverting pin will be higher than the reference. The reference can be set using the trim pot R2. At this condition output of the opamp goes low and sinks the LED D1 to make it glow. When the moisture is lower than the set point, the opposite happens. So in simple words, a LOW output of the opampindicates a high moisture and a HIGH output of the opamp indicates a low moisture. The output of the opamp is marked as pin D0 on the sensor YL 38 module. This pin is connected to the microcontroller for further processing. LED D2 is just a power ONindicator. Capacitors C1and C2 are noise filters.

Microcontroller section.

Microcontroller section senses the status of the comparator module and switches the irrigation motor appropriately. It also displays the status of the pump on the LCD screen. The power supply unit and the motor driver unit are incorporated in this section. Full circuit diagram of the project is given below.

Output pin of the comparator module (D0) is connected to P3.5 pin of the 8051 microcontroller. The microcontroller monitors the moisture level by polling the status of the P3.5 pin which is the output of the comparator.

Supporting Tutorials

Interfacing LCD Module to 8051 – read this tutorial to learn how to interface 16×2 LCD module to 8051.

Motor to 8051 – this tutorial teaches how to interface a DC motor to 8051.

Program

RS EQU P2.7RW EQU P2.6E EQU P2.5ORG 00HSETB P3.5MOV TMOD,#00000001B MAIN:ACALL DINT ACALL TEXT1 JB P3.5, NEXT ACALL LINE2 ACALL TEXT2 CLR P2.0 SJMP EXITNEXT:ACALL LINE2 ACALL TEXT3 SETB P2.0 EXIT:ACALL DELAY1SJMP MAINDELAY1:MOV R0,#15DBACK1: MOV TH0,#00000000B MOV TL0,#00000000B SETB TR0 HERE2: JNB TF0,HERE2 CLR TR0 CLR TF0 DJNZ R0,BACK1 RETTEXT1: MOV A,#"M" ACALL DISPLAY MOV A,#"o" ACALL DISPLAY MOV A,#"i" ACALL DISPLAY MOV A,#"s" ACALL DISPLAY MOV A,#"t" ACALL DISPLAY MOV A,#"u" ACALL DISPLAY MOV A,#"r" ACALL DISPLAY MOV A,#"e" ACALL DISPLAY MOV A,#" " ACALL DISPLAY MOV A,#"C" ACALL DISPLAY MOV A,#"o" ACALL DISPLAY MOV A,#"n" ACALL DISPLAY MOV A,#"t" ACALL DISPLAY MOV A,#"r" ACALL DISPLAY MOV A,#"o" ACALL DISPLAY MOV A,#"l" ACALL DISPLAY RET TEXT2: MOV A,#"[" ACALL DISPLAY MOV A,#"O" ACALL DISPLAY MOV A,#"K" ACALL DISPLAY MOV A,#"]" ACALL DISPLAY MOV A,#" " ACALL DISPLAY MOV A,#"P" ACALL DISPLAY MOV A,#"u" ACALL DISPLAY MOV A,#"m" ACALL DISPLAY MOV A,#"p" ACALL DISPLAY MOV A,#" " ACALL DISPLAY MOV A,#"O" ACALL DISPLAY MOV A,#"F" ACALL DISPLAY MOV A,#"F" ACALL DISPLAY RET TEXT3: MOV A,#"[" ACALL DISPLAY MOV A,#"L" ACALL DISPLAY MOV A,#"o" ACALL DISPLAY MOV A,#"w" ACALL DISPLAY MOV A,#"]" ACALL DISPLAY MOV A,#" " ACALL DISPLAY MOV A,#"P" ACALL DISPLAY MOV A,#"u" ACALL DISPLAY MOV A,#"m" ACALL DISPLAY MOV A,#"p" ACALL DISPLAY MOV A,#" " ACALL DISPLAY MOV A,#"O" ACALL DISPLAY MOV A,#"N" ACALL DISPLAY RET DINT:MOV A,#0CH ACALL CMD MOV A,#01H ACALL CMD MOV A,#06H ACALL CMD MOV A,#80H ACALL CMD MOV A,#3CH ACALL CMD RETLINE2:MOV A,#0C0H ACALL CMD RET CMD: MOV P0,A CLR RS CLR RW SETB E CLR E ACALL DELAY RETDISPLAY:MOV P0,A SETB RS CLR RW SETB E CLR E ACALL DELAY RETDELAY: CLR E CLR RS SETB RW MOV P0,#0FFH SETB E MOV A,P0 JB ACC.7,DELAY CLR E CLR RW RET END 

About the program.

will be added soon

Moisture sensing automatic plant watering system (2024)

References

Top Articles
Latest Posts
Article information

Author: Margart Wisoky

Last Updated:

Views: 6250

Rating: 4.8 / 5 (78 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Margart Wisoky

Birthday: 1993-05-13

Address: 2113 Abernathy Knoll, New Tamerafurt, CT 66893-2169

Phone: +25815234346805

Job: Central Developer

Hobby: Machining, Pottery, Rafting, Cosplaying, Jogging, Taekwondo, Scouting

Introduction: My name is Margart Wisoky, I am a gorgeous, shiny, successful, beautiful, adventurous, excited, pleasant person who loves writing and wants to share my knowledge and understanding with you.