Agri Irrigation System
Arduino Project

Agri Irrigation System

Automatic Irrigation System using Magicbit

Components Required

What is an Automatic Irrigation System?

Automatic agri irrigation systems is the use of a device to operate irrigation structures so the change of flow of water from bays can occur in the absence of the irrigator.


Modern agriculture is heading towards automation nowadays. In this project, we will make an Agri monitoring and irrigation systems using Magicbit-(ESP32) and arduino. We will use sensors to keep track of the moisture content in the soil. With this moisture data, we will try to operate a pump that will control water flow to plants. This will make sure that plants are getting the correct moisture levels that they need.


  1. make the setup using water pumps and tubes according to your plants. (You can use many plants as you want but you will have to use a powerful water pump and bigger tubing.

circuit diagram




  1. Copy the following code to Arduino IDE
// Agri Irrigation System
// Magicbit

#include <ESP32Servo.h>

int SENSOR = 32;
int output_value ;
int upper_val = 70;
int lower_val = 40;

int M1A = 16; //motor drive input pins
int M1B = 17;

void setup() {
  pinMode(M1A, OUTPUT); //configure as inputs
  pinMode(M1B, OUTPUT);

void loop() {
    output_value= analogRead(SENSOR);
    output_value = map(output_value,550,0,0,100);
    if (lower_val>output_value && upper_val>output_value)
    analogWrite(M1A, 255);//pwm signal
    analogWrite(M1B, 0);  

  1. Find the soil moisture range that your plants want. Here we have used the 40 – 70 range.
  1. Edit the code according to your soil moisture range.

arduino code

5. Upload the code.

Related Posts
Leave a Reply