Automatic Watering
Part one : Summary
When outing , would you worry that the plant at home will be dry due to the lack of water ? Would you feel like to slack off ,when you need to watering the plant everyday?
Based on Arduino , our group made a simple automatic watering device by using humidity sensor ,relay ,water pump ,etc, and judged whether to water your plants by detecting soil miosture with the sensor . The following is the realization process of device.
The Component
1、Arduino UNO board
2、Humidity sensor
3、Relay
4、Water pump
5、Battery case
6、Several conductors
Technical indicators of sensor:
· Supply voltage : 3.3V or 5V
· Output voltage : 0 - 2.3V
· Operating current : 20mA Max
· Interface definition : 1. pin signal 2. pin ground 3. pin power positive
· Service life : about 1 year
· Module size : 60 x 20 x 5mm
· Typical voltage value (Test platform : 10-bit AD , Reference voltage 5V)
· 0~300 : Dry soil
· 300~700 : Moist soil
· 700~950 : Put into the water
As can be seen from the circuit schematic diagram, the core of the module is a voltage comparator, which adopts the common LM393. LM393's forward input is connected to a voltage divider circuit composed of two resistors, of which the lower resistor is the soil moisture sensor, which is simply a resistance whose value changes with the soil moisture. In the real picture, the one that looks like a pair of pants is the soil moisture sensor. The inverting input of the LM393 is connected to a adjustable potentiometer, which can be rotated to change the input voltage at the inverting input.
This module can directly output high and low levels, without programming, can be very convenient for us to use. When soil moisture is detected, output the high level and vice versa.
The module has an analog output port AO, which can be connected to the AD module. Through AD conversion, more accurate values of soil moisture can be obtained.
Wiring
1.The first part is the humidity sensor:
As shown in the figure , A0, GCC and GND are first
connected by wire . Note that D0 is not required . Connect the sensor on the left.
2.The part of Relay
The battery box and water pump are connected to the left
of the relay.First of all , connect the red line of the battery box to the COM port of thhe relay and the red line of the water pump to the positive pole of the NO port , and then the black line of the battery box and the water pump is directly connected to the negative pole .
Noting: the NC port is not
connected , the two black wires are directly wrapped around the waist together.
When wiring ,
you need to use a small screwdriver to loosen the screws first , and then tighten the screws after puttiing the line in . The right side is directly connected with three wires first .
3.Then , access to the UNO board.
Relay UNO
VCC 5V
GND GND
IN foot 8
Sensor UNO
VCC 5V
GND GND
VCC 5V
A0 A0
4. Finally , the UNO version can be connected to the power supply.
Code
int sensorPin=A0;
int zlhPin=8;
int sensorValue=0;
void setup()
{
pinMode(zlhPin,OUTPUT);
Serial.begin(9600);
}
void loop()
{
sensorValue=analogRead(sensorPin);
if(sensorValue<700)
{
digitalWrite(zlhPin,HIGH);
}
else
{
digitalWrite(zlhPin,LOW);
}
Serial.println(sensorValue);
delay(100);
}
Practice
After connecting the power supply, the red light of the relay lights up, indicating that it has been successfully connected.
When the value of the sensor is less than a certain value (700 in the code), the green light turns on, the water pump starts pumping, and the flowers are watered.
Improvement Project
· In order to take more comprehensive care fo the plants ,we hope to extend the measurement to more natural elements such as air temperature and humidity , soil fertility and so on . This requires more sophisticated detection devices and more complex code to support .Once this is done ,not only can it be applied to home potting , but it can also contribute to mordern agriculture.
· We hope to add a display device to visually observe the value of soil moisture. This is equivalent to an insurance mechanism , in case of equipment damage can be added to the human intervention , to ensure the growth of plants in all aspects.
· If a different output device (such as automatic sprinkler head) is arranged at the end of the pumping pipe , the scope of application will be more extensive. Such as indoor automatic humidifier , household aromatherapy , and even applied to the field of skin care.