Gardening is a favorite pastime for many — and a healthy one. In fact, a recent study found that even a small home garden offers mood-boosting qualities that are similar to those provided by physical exercise.
However, one of the top concerns for many new or novice gardeners is how often to water their plants and how much. Others may need to leave their garden unattended for some time and required assistance with the watering. So, what if it was possible to ensure plants were watered automatically while ensuring the ideal amount, at the ideal time?
Well…with the right system in place, this is possible.
The following project works by automatically watering plants when needed. The circuit is built using a soil moisture sensor and Arduino. As its name suggests, this sensor tracks the moisture content in the soil and, via Arduino, a pump is controlled that provides water to the plants.
To avoid over or under-watering, the soil is never left completely dry or fully wet. Rather, the moisture level is maintained at a reasonable level. Personally, I have successfully built and used this system for my kitchen garden, which has a few potted plants.
The soil moisture sensors are set in the pots and a submersible, mini water pump (12 V) is placed inside a water tank. Its water outlet is provided to the pots through a nozzle that has a drip irrigation. When soil in any of the pots begins to get dry, the pump automatically starts and the plant is gently watered.
Once the soil receives an adequate level of moisture, the pump automatically shuts off. This system has ensured all of my plants are properly watered, whenever needed, and without my assistance!
If you’d like a similar system for your home garden, simply follow the below directions. First, you’ll need to collect the required items to get started.
1. Arduino NANO
2. A soil moisture sensor
3. An Arduino Relay module
4. A 12-V battery — 1 AH or more
5. A mini submersible water pump
As shown in the above diagram, this circuit only requires a few components. The major ones include the Arduino NANO board, a soil moisture sensor, a mini water pump, and the battery.
Now, here’s how it works…
- The moisture sensor provides analog voltage output, so it must be connected with Arduino’s analog input pins A0 and A1 — which are given 5V Vcc supply from the board.
- The relay is used to switch ON/OFF the water pump. It’s connected between the “NO” (normally open) terminal and the circuit ground.
- Arduino drives the relay through the NPN transistor BC547. Arduino’s digital pin D2 is used to switch ON/OFF the relay by using the transistor. (The transistor is connected in the switch configuration.)
- The relay and water pump both operate at 12 V, which is provided by the battery.
- The battery also provides Arduino’s VIN pin 12 V.
Note: only two sensors are shown in the diagram, but one can connect eight sensors to eight of Arduino’s analog input pins (A0 – A7).
The circuit operation is quite simple: when the soil begins to get dry, the sensor will output to the Arduino board, which switches ON the water pump. Once the soil is adequately watered, Arduino switches OFF the water pump. That’s it.
- The soil moisture sensor is of variable resistance. This means its resistance varies per the conductivity changes between its two sensor rods. When these rods are inserted into the soil, their conductivity changes as per the soil’s moisture content. If the soil is dry, the conductivity is less (and the resistance is high). On the other hand, if the soil is quite moist, the conductivity is high (and the resistance is low). So, the sensor’s resistance changes from high to low, or “max” to “min,” as per the soil’s moisture (an inverse proportionality). This change in resistance is converted into an analog voltage output and as the soil’s moisture increases, the analog output voltage decreases, and vice versa.
- The sensor’s output voltage is given to Arduino as an analog input. The Arduino board will then convert it into a digital value and measure the soil’s moisture level (from 0 to 100%).
- If the moisture level is less than the set threshold level (say, 10 or 20%), it will switch ON the relay through the transistor, turning ON the pump.
- As the pump flows, the soil begins to moisten. Arduino will continuously read the soil’s moisture level from both sensors.
- When a set moisture level is reached (say, 90 or 95%) in both of the sensor rods, Arduino will switch OFF the relay, which turns OFF the pump.
- This cycle is continuous so the plant is watered when its soil becomes dry.
For this project, I’ve used only two sensors. But one can use a maximum of eight in different potted plants.
The operation of this circuit works because the program is downloaded (or embedded) into Arduino’s microcontroller.
Here’s the Arduino C program, which is written and compiled in Arduino IDE software.
#define sen1 A0
#define sen2 A1
int led1=3,led2=4,led3=5, pump_rly=2;
// put your setup code here, to run once:
Serial.println(“automatic irrigation system using arduino”);
// put your main code here, to run repeatedly:
int sen1_value, sen2_value,soil_moisture_level_1,soil_moisture_level_2;
sen1_value = analogRead(sen1);
sen2_value = analogRead(sen2);
soil_moisture_level_1 = map(sen1_value,200,1020,100,1);
soil_moisture_level_2 = map(sen2_value,200,1020,100,1);
Serial.print(“Soil Moisture level in POT 1: “);
Serial.print(“Soil Moisture level in POT 2: “);
Serial.println(“moisture level in POT 1 is low”);
Serial.println(“moisture level in POT 1 is adquate”);
Serial.println(“moisture level in POT 2 is low”);
Serial.println(“moisture level in POT 2 is adquate”);
Serial.println(“moisture level in POT 3 is low”);
Serial.println(“moisture level in POT 3 is adquate”);
if((soil_moisture_level_1<10) || (soil_moisture_level_2<10))
if((soil_moisture_level_1>94) && (soil_moisture_level_2>94))
You may also like:
Filed Under: Arduino, Electronic Projects