svskits - 1

Friday, 28 July 2023

Automatic irrigation using Arduino Nano and soilmoisture sensor

 

www.svsembedded.com             SVSEMBEDDED                                   svsembedded@gmail.com,

CONTACT: 9491535690, 7842358459

Automatic irrigation using Arduino Nano and soilmoisture sensor

Creating an automatic irrigation system using an Arduino Nano and a soil moisture sensor is a practical and useful project for keeping your plants watered efficiently. The basic idea is to use the soil moisture sensor to measure the moisture level of the soil, and then trigger the irrigation system when the moisture level falls below a certain threshold. Here's a step-by-step guide to help you get started:

Components you'll need:

  1. Arduino Nano or any compatible Arduino board
  2. Soil moisture sensor (analog or digital)
  3. Relay module (to control the water pump or solenoid valve)
  4. Water pump or solenoid valve (to deliver water to the plants)
  5. Power supply (for Arduino and the water pump/valve)
  6. Jumper wires
  7. Breadboard or perfboard (optional)

Step 1: Connect the Components

  1. Connect the soil moisture sensor to the Arduino:

    • For analog soil moisture sensor, connect VCC to 5V, GND to GND, and A0 to an analog pin (e.g., A0).
    • For digital soil moisture sensor, connect VCC to 5V, GND to GND, and D0 to a digital pin (e.g., D2).
  2. Connect the relay module to the Arduino:

    • Connect the IN1 pin of the relay module to a digital pin (e.g., D3) on the Arduino.
    • Connect the VCC and GND pins of the relay module to 5V and GND on the Arduino, respectively.
    • Connect the COM (Common) and NO (Normally Open) terminals of the relay to the positive and negative terminals of the water pump/valve, respectively.

Step 2: Write the Arduino Code Now, you need to program the Arduino to read the soil moisture sensor data and control the relay based on the moisture level. You can use the Arduino IDE for this purpose:

const int moisturePin = A0; // Analog pin to read the moisture sensor const int relayPin = 3; // Digital pin connected to the relay module int moistureThreshold = 500; // Adjust this value based on your sensor and plants' needs void setup() { pinMode(relayPin, OUTPUT); digitalWrite(relayPin, LOW); // Turn off the relay initially Serial.begin(9600); } void loop() { int moistureValue = analogRead(moisturePin); Serial.print("Moisture: "); Serial.println(moistureValue); if (moistureValue < moistureThreshold) { // If moisture level is below the threshold, turn on the irrigation digitalWrite(relayPin, HIGH); Serial.println("Water pump ON"); delay(2000); // Adjust the delay time to control the watering duration digitalWrite(relayPin, LOW); Serial.println("Water pump OFF"); } delay(1000); // Delay between moisture readings }

Step 3: Upload the Code to Arduino Connect your Arduino Nano to your computer using a USB cable and upload the code using the Arduino IDE.

Step 4: Calibration and Adjustment Place the soil moisture sensor in the plant's soil and adjust the moistureThreshold value in the code to suit the moisture level at which you want the irrigation to start. You may need to experiment and calibrate the threshold according to your specific soil type and plant requirements.

Step 5: Power Supply Make sure to use an appropriate power supply for your water pump/valve and consider the power requirements when choosing the relay module.

With this setup, your Arduino will continuously monitor the soil moisture level, and when it drops below the threshold, it will activate the water pump or valve to water your plants. Remember to be cautious when working with water and electricity, and follow safety guidelines to avoid any accidents.

Note: Always be careful when dealing with electrical components and water to avoid any damage or harm.



Automatic irrigation using Arduino Nano and soilmoisture sensor

 www.svsembedded.com             SVSEMBEDDED                                   svsembedded@gmail.com,

CONTACT: 9491535690, 7842358459

Automatic irrigation using Arduino Nano and soilmoisture sensor


Sure, I can help you with that. Here are the steps on how to build an automatic irrigation system using Arduino Nano and soil moisture sensor:

  1. Gather the necessary materials. You will need the following:

    • Arduino Nano
    • Soil moisture sensor
    • Relay module
    • DC water pump
    • Breadboard
    • Jumper wires
    • Power supply
  2. Connect the components to the breadboard. The following is the schematic diagram of the circuit:

    +5V
    |
    RELAY
    |
    GND
    |
    SOIL MOISTURE SENSOR
    |
    A0
    |
    GND
    |
    DC WATER PUMP
  1. Write the Arduino code. The following is a sample code that you can use:
int soilMoisturePin = A0;
int relayPin = 2;
int threshold = 500;

void setup() {
  pinMode(soilMoisturePin, INPUT);
  pinMode(relayPin, OUTPUT);
}

void loop() {
  int moistureValue = analogRead(soilMoisturePin);
  if (moistureValue < threshold) {
    digitalWrite(relayPin, HIGH);
  } else {
    digitalWrite(relayPin, LOW);
  }
}
  1. Upload the code to the Arduino Nano.

  2. Test the system. Once the code is uploaded, you can test the system by connecting the power supply and placing the soil moisture sensor in the soil. The water pump should turn on when the soil moisture level is below the threshold value.

Here are some additional tips for building an automatic irrigation system:

  • Use a high-quality soil moisture sensor. This will ensure that the readings are accurate and reliable.
  • Set the threshold value appropriately. The threshold value is the moisture level at which the water pump will turn on. You will need to experiment to find the right value for your plants.
  • Use a relay module with a high current rating. This will ensure that the water pump can get enough power to operate.
  • Use a DC water pump that is designed for irrigation. This type of pump will be able to deliver a steady stream of water.

I hope this helps!

IEEE Projects for ECE 2024 – 2025 TITLES

  www.svsembedded.com               SVSEMBEDDED                                    svsembedded@gmail.com , CONTACT: 9491535690, 7842358459...