Home > Applications > Environmental Control > Intelligent watering device scheme based on AT89S52 chip

Intelligent watering device scheme based on AT89S52 chip

Published time : 2017-10-01 AT89S52 smart home
This paper introduces the design of home intelligent watering device based on AT89S52 single-chip microcontroller, and carries out hardware design and scheme description.

Solution Introduction

The home intelligent watering device is widely used, and the changing program can also be used as a timed switch, a dormitory lighting system, a temperature controlled plastic greenhouse, and so on.

The innovation of the system design is that the realization of different ways of automatic watering and the retraction of the water pipe helps to change the distance of the flower pot from the water source; the problem that needs to be paid attention to during the design process is to prevent the single-chip microcontroller from resetting when the solenoid valve is closed. The resistor and capacitor are buffered.

In this system, 400 V withstand voltage capacitor is used.

Using AT89S52 single-chip microcontroller to design a home intelligent watering device to achieve automatic watering, saving manpower, convenient for people to travel,That will not affect the growth of flowers, if you can also turn off the watering device at home, manually watering flowers. 

The watering device is set in two ways, one is to regularly water the flowers, and the other is to water the flowers according to the humidity. Which method is adopted by button control or infrared remote control, when using the timed quantitative watering, the digital tube displays the time and the running time. When the watering according to the humidity is selected, the digital tube display is the current humidity.

1 Design overview

The automatic watering device is designed by using AT89S52 single-chip microcomputer. For different flowers, this intelligent watering device is set up in two ways: one is to regularly water the flowers regularly, and the other is to use the humidity sensor to detect the humidity of flowers (also used for vegetables, etc.). The humidity is transmitted to the MCU chip, and the MCU controls whether it is watered according to the humidity.

If watering is required, a pin p2.0 of the MCU is set to a high level, so that the relay coil is energized, the open contact is closed, the solenoid valve is opened, and the automatic watering of the timing is quantitatively realized. When the time is up, the solenoid valve is automatically closed. And the water flow time is adjustable, the digital tube is installed on the top, 

There is a button according to different water requirements of different flowers, the length of the watering time is set, and the length of the watering time can be displayed on the digital tube;

If the detected humidity is sufficient, p2.0 remains low and the solenoid valve is not opened. Which method is adopted by button control or infrared remote control, when using the timed quantitative watering, the digital tube displays the time and the running time. When the watering according to the humidity is selected, the digital tube display is the current humidity.

The technical scheme adopted by the technology is: using the single-chip microcomputer to realize automatic control, firstly detecting which way to water the flowers, if the water is regularly quantitatively watered, the watering is started at a prescribed time, and the watering is performed according to the length of the set watering time;

If it is based on humidity control whether to watering, set the pin of the single-chip microcomputer to a low level, the humidity sensor detects the humidity, and transmits it to the single-chip chip. When the humidity is insufficient, the pin of the single-chip microcomputer becomes high level, and the relay is turned on. 

The suction and the normally open contact are closed, so that the solenoid valve coil is energized. At this time, the electromagnetic valve is closed and becomes disconnected, the water flows through, and the flower is watered. Its structure is shown at below.

Intelligent watering device scheme based on AT89S52 chip


2 Hardware design

The hardware circuit consists of single chip microcomputer, humidity sensor, relay, solenoid valve, digital tube, 1302 chip, button, infrared remote control and so on. Note that if the solenoid valve is placed too close to the MCU, it will not work properly. The solution is:

1) Solenoid valve away from single chip microcomputer

2) Add a resistor and capacitor. Here is the method of adding resistors and capacitors, so that it is convenient to concentrate the components and the controller is relatively small.


2.1 Timing quantitative watering method

Specific hardware: Two three-digit digital digital tubes and one two-digit digital digital tube are installed to show the length of time and watering time. The button controls the time adjustment and the time setting adjustment, and has a button to set the length of the watering time according to the different water required by the flower, and displays it on the digital tube, the 1302 chip realizes the time keeping, and does not affect the time when the power is off.

The single-chip microcontroller p2.0 pin is connected to the relay, the relay is connected to the solenoid valve, and the solenoid valve controls the water flow.

The time for watering can be set by the button, and the length of the watering time can also be adjusted by pressing the button. At the same time, the 1302 chip is added, so that it does not affect the normal time in order to prevent power failure, and it is necessary to re-adjust the time after each power failure.


2.2 Humidity control watering method

First set the humidity by pressing the button. The humidity sensor used here is the LTM8901 humidity sensor. The LTM8901 is a digital temperature and humidity probe specially designed for users to design their own products. The humidity measurement range is 1%~99%RH, and the resolution is 0.5% RH, measurement accuracy is ±3.0% RH (typical); temperature measurement range is -25 to +60 °C, resolution is 0.062 5 °C, measurement accuracy is ±0.5 °C; response time is typically 5 s; The voltage range is 4.5 to 5.5 V.

The LTM8901 directly outputs the measurement result as a digital signal, which is serially transmitted to the single-chip microcontroller through the “one-wire bus”. It does not need to perform analog-to-digital conversion, which reduces the components and is simple and convenient.

The humidity is detected by the LTM8901 humidity sensor, transmitted to the MCU for processing, and the humidity is displayed on the digital tube. When the humidity is lower than the set value, the MCU is given an instruction, seth p2.0, the relay coil has current passing, and the corresponding normally open .

The contact is closed, so that the solenoid valve coil is energized. At this time, the electromagnetic valve is turned from closed to open, and watering is performed. When it is equal to or higher than the set value, clr p2.0, the relay coil is de-energized, corresponding to the normally open contact. When the point is broken, the solenoid valve coil is de-energized, the valve is closed, the water cannot flow, and the watering is stopped.


2.3 Mode setting

You can set the watering method according to the odd number of times to set the watering method according to the odd number of times, and press the even number of times to set the watering method to water the flower according to the humidity.

You can also set the watering method by infrared remote control, launch TV remote control, receive circuit with trinity receiver to receive signal, trinity receiver 1 pin ground, 2 pin power supply, 3 pin (signal pin) and single chip I The /O pin is connected, the signal is decoded, and different processing is performed.

The first time the signal is received, the water is dosed according to the timing, and the signal is received again according to the humidity. According to the number of times, the odd-numbered watering is used. In the way, evenly, the humidity control watering method is adopted, which is mainly for different flowers. Upon receiving the signal, the LED flashes for 30 s. The buzzer sounds for 10 s to remind you.

Key Components

No. Part Number Manufacturer
1 AT89S52-PU ATMEL
2 AT89S523 ATMEL
3 AT89S52-24SU ST
4 AT89S52-24PC MICROCHIP
5 AT89S52-24P ATEML