Smart irrigation • Embedded systems project

Phone Controlled
Water Pump for Agriculture Field

A simple wireless command system that lets a farmer switch an irrigation pump ON or OFF from a mobile phone. Arduino receives the command, operates a relay module and controls the pump without requiring the operator to stand beside the control point.

Arduino + Bluetooth serial link + relay switching
Remote controlSend pump commands from a phone
Two commands“turn on water pump” / “turn off water pump”
Relay outputArduino pin D2 controls the relay input

01. Introduction

Water is one of the most important resources in agriculture. Crops need a suitable quantity of water at the correct time, and irrigation is often repeated every day or at regular intervals. In a conventional arrangement, a farmer may need to walk to a pump house, operate a switch manually and return to the field. This can be inconvenient when the pump is far away, the field is large, or the operator is busy with other agricultural work.

The Phone Controlled Water Pump for Agriculture Field project demonstrates a basic remote switching solution. A mobile phone sends a text command over a wireless serial connection. A Bluetooth serial module such as the HC-05 can receive the command and pass the characters to an Arduino board. The Arduino checks the received text. When the command is turn on water pump, it changes digital pin 2 to LOW, energising an active-LOW relay module. When the command is turn off water pump, the Arduino changes pin 2 to HIGH and the relay releases.

The relay provides an electrically controlled switching interface between the low-voltage control circuit and the pump power circuit. The Arduino does not supply the pump's operating current. Instead, it controls the relay input, while correctly rated relay contacts or a suitable motor contactor switch the pump supply. This separation is essential because agricultural pumps may operate at much higher voltage and current than a microcontroller can handle.

This is an educational prototype for understanding wireless control, embedded programming and relay-based automation. It can be adapted to a small demonstration pump or developed into a professionally protected irrigation controller. It does not automatically measure soil moisture, check tank level or decide when irrigation is needed; the farmer initiates the ON and OFF commands.

02. Main objectives

  • Provide a convenient way to switch an agriculture water pump ON and OFF remotely within the wireless module's operating range.
  • Use simple text commands so that the operation is easy to understand and demonstrate.
  • Reduce the need to visit the pump control point for every switching operation.
  • Introduce the practical use of Arduino digital output pins, serial communication and relay modules.
  • Create a foundation that can later be expanded with sensors, scheduling, water-use monitoring and internet connectivity.

03. Components used

1. Arduino Uno or compatible board

The controller reads serial data, compares the command with the required text and drives the relay input from digital pin 2.

2. Bluetooth serial module (HC-05)

Provides a short-range wireless serial connection between the phone and Arduino. Use a compatible phone app that sends plain text.

3. Relay module, active-LOW

Accepts the Arduino control signal and operates an isolated switch contact. The supplied program assumes LOW means relay ON and HIGH means relay OFF.

4. Water pump and power supply

The pump moves water through the irrigation line. Its voltage, current, starting current and supply type determine the required switching equipment.

5. Mobile phone

Runs a Bluetooth serial terminal or a purpose-built application and sends the exact ON/OFF command strings.

6. Regulated DC supply and wiring

Provides stable power to the Arduino and Bluetooth module. Use suitable wire sizes, terminals, enclosure and protective devices.

04. Theory of the components

Arduino microcontroller

Arduino is a development platform built around a microcontroller. The board provides digital input/output pins, serial communication and a programmable environment. In this project, the Arduino runs a continuous loop. It checks whether serial characters have arrived, builds a command string, converts that string to lowercase and compares it with two expected phrases. The board's D2 pin is used as a digital output. A digital output can represent a HIGH or LOW logic level, but it cannot directly power a motor.

Bluetooth serial communication

A Bluetooth serial module such as the HC-05 commonly provides a wireless link that behaves like a serial cable. Once paired with a compatible Android phone, a terminal application can transmit characters. The module forwards those characters to the Arduino's serial receive connection. The exact range depends on the module, antenna, obstacles and radio interference; it should not be treated as a long-distance farm-wide communication system.

Relay and electromagnetic switching

A relay is an electrically operated switch. In a typical electromechanical relay, current through a coil creates a magnetic field that moves an armature and changes the contact position. A relay module commonly includes a transistor driver and a flyback diode for the coil, allowing a low-power logic signal to control the relay. The COM, NO and NC terminals provide the switching contacts. NO means normally open: when the relay is not energised, COM and NO are disconnected; when energised, they connect.

The supplied sketch assumes an active-LOW relay module. This means a LOW signal activates the relay and a HIGH signal deactivates it. Relay modules are not all wired the same way, so check the module's markings and documentation before connecting the pump circuit.

Water pump

An electric pump converts electrical energy into mechanical energy to move water. Pump motors can draw a starting current several times greater than their normal running current. Therefore, the relay or contactor must be selected using the motor's voltage, running current, starting characteristics and motor-load rating—not just a general resistive-load rating.

Power supply and protection

The Arduino and Bluetooth module require a stable low-voltage DC supply. The pump has its own correctly rated power circuit. A fuse or circuit breaker protects against overcurrent, while earthing, residual-current protection, suitable isolation and a weather-resistant enclosure help reduce electrical hazards. The low-voltage electronics and hazardous pump wiring should be physically separated.

05. Working principle

  1. Power-up: The Arduino starts, configures D2 as an output and writes HIGH to the relay pin. With the assumed active-LOW module, this establishes the OFF state at startup.
  2. Phone pairing: The user pairs the phone with the Bluetooth serial module and opens a terminal application configured to send plain text.
  3. Command transmission: The user sends the exact phrase turn on water pump or turn off water pump.
  4. Serial reception: Arduino checks Serial.available(). If characters are available, it reads them one by one and appends them to the cmd string.
  5. Command processing: The sketch converts the received string to lowercase. It then compares the string with the ON and OFF phrases.
  6. Relay switching: For the ON phrase, Arduino writes LOW to D2. For the OFF phrase, it writes HIGH to D2. An active-LOW relay module responds accordingly.
  7. Water delivery: When the pump power circuit is correctly connected through the relay/contactor, the pump starts or stops and water flow changes.

06. SVG connection diagram

LOW-VOLTAGE CONTROL SIDE Mobile phoneBluetooth terminal HC-05 moduleBluetooth ↔ UART Wireless Arduino UnoD2 = relay controlSerial RX/TX TX/RX* Relay moduleIN ← Arduino D2VCC / GND D2 signal Common GND *HC-05 TXD → Arduino RX; Arduino TX → HC-05 RXD through a suitable level divider.

07. Connection guide

HC-05 to Arduino (serial connection)

HC-05 pinArduino Uno connectionPurpose / note
VCCSuitable regulated supply as specified by the breakout boardMany HC-05 breakout boards accept 5 V on VCC because they include regulation; bare modules may not.
GNDGNDCommon low-voltage reference.
TXDArduino RX (D0)Module sends received Bluetooth data to Arduino.
RXDArduino TX (D1) through a level dividerReduce the Arduino's 5 V TX logic to a level suitable for the HC-05 RX input.

On an Uno, D0 and D1 are also used by the USB serial interface. Disconnect the Bluetooth module from these pins while uploading a sketch if it interferes with programming. The supplied sketch uses the hardware Serial port at 9600 baud. A board with a separate hardware UART, or a carefully configured software serial port, can make development easier.

Relay module to Arduino

Relay module pinArduino connection
IND2
VCCModule-rated DC supply
GNDArduino GND (if required by the module's input design)

Connect the pump power path only through contacts and switching equipment rated for the pump motor. The Arduino D2 pin connects only to the relay module's low-voltage input; it must never be connected directly to the pump or mains supply.

08. Full Arduino code

#define relay 2
String cmd="";

void setup()
{
  Serial.begin(9600);
  pinMode(relay,OUTPUT);
  digitalWrite(relay,HIGH);
}

void loop()
{
  if(Serial.available()>0)
  {
    while(Serial.available()>0)
    {
      char c=Serial.read();
      cmd=cmd+c;
      delay(10);
    }
    cmd.toLowerCase();
    if(cmd.length()>0)
    {
      if(cmd=="turn on water pump")
      {
        digitalWrite(relay,LOW);
      }
      else if(cmd=="turn off water pump")
      {
        digitalWrite(relay,HIGH);
      }
      cmd="";
    }
  }
}

09. Detailed code explanation

#define relay 2

Creates the name relay for digital pin 2. Using a name makes the program easier to read and makes the pin easier to change later.

String cmd="";

Declares a String variable named cmd. It begins empty and stores the characters received from the phone.

void setup()

Defines the setup function. Arduino executes this function once after power-up or reset.

Serial.begin(9600);

Starts serial communication at 9600 bits per second. The Bluetooth serial module and phone terminal must use compatible serial settings.

pinMode(relay,OUTPUT);

Configures digital pin 2 as an output so the microcontroller can send a logic signal to the relay module input.

digitalWrite(relay,HIGH);

Sets D2 HIGH at startup. Because the sketch assumes an active-LOW relay board, HIGH represents the relay OFF state and helps prevent an unintended start during normal initialisation.

void loop()

Defines the main loop. Arduino repeats its instructions continuously while the board is powered.

if(Serial.available()>0)

Checks whether at least one serial character is waiting in the receive buffer. The code only begins collecting a command when data is available.

while(Serial.available()>0)

Continues reading while characters remain in the serial buffer. This gathers the incoming phrase rather than processing only its first character.

char c=Serial.read();

Reads one received character and stores it temporarily in the variable c.

cmd=cmd+c;

Appends that character to the end of the command String. Repeating this operation reconstructs the phrase sent by the phone.

delay(10);

Waits for 10 milliseconds before the next read. This gives additional characters time to arrive, although fixed delays are not a robust way to detect the end of a message in every communication condition.

cmd.toLowerCase();

Converts the command text to lowercase. This allows phrases such as “TURN ON WATER PUMP” to match the lowercase comparison, provided no extra characters are included.

if(cmd.length()>0)

Checks that the command String contains at least one character before attempting to process it.

if(cmd=="turn on water pump")

Compares the received text with the exact ON command. The comparison succeeds only when the complete String matches.

digitalWrite(relay,LOW);

Writes LOW to D2. On the assumed active-LOW relay module, this activates the relay. Its contacts then change state, allowing the correctly designed pump power circuit to energise the pump.

else if(cmd=="turn off water pump")

If the ON command did not match, the program checks for the exact OFF command.

digitalWrite(relay,HIGH);

Writes HIGH to D2. The active-LOW relay module deactivates, returning its contacts to their normal state and switching the pump circuit OFF when wired accordingly.

cmd="";

Clears the command String after processing so that the next phone message starts with an empty buffer instead of being joined to the previous command.

10. Testing, operation and troubleshooting

  1. Build and test the Arduino, Bluetooth module and relay input using a low-voltage indicator or a safe test load first. Keep the pump power circuit disconnected during initial software tests.
  2. Upload the sketch with the Bluetooth module disconnected from Uno pins D0/D1 if the connection blocks uploading.
  3. Reconnect the Bluetooth module with correct voltage levels, power the controller and pair the phone with the module.
  4. Open a Bluetooth serial terminal, select the correct paired module and send turn on water pump.
  5. Check that the relay indicator or a suitable low-voltage test load responds. Send turn off water pump and verify that it releases.
  6. Only after the low-voltage control has been verified should the properly protected pump power installation be commissioned by a qualified electrician.

Common problems

  • No Bluetooth data: Check pairing, module power, baud rate and TX/RX wiring.
  • Sketch will not upload: Disconnect the HC-05 from D0 and D1 during upload, then reconnect it correctly.
  • Relay does not respond: Confirm that the relay module is active-LOW, that its supply is correct, and that its input shares the required ground reference.
  • Command is ignored: Remove terminal line endings and spaces. The supplied program requires an exact phrase after converting letters to lowercase.
  • Pump does not run: The control relay clicking does not prove that the pump power circuit is healthy. Have the supply, protection, contactor, wiring and pump checked safely by a qualified electrician.

11. Advantages

  • Convenient operation: A user can issue a switching command from a phone without standing next to the controller.
  • Simple interface: Only two plain-language commands are required for the basic demonstration.
  • Low-cost learning platform: Arduino, a Bluetooth serial module and a relay board are widely used educational components.
  • Expandable design: Sensors, status indicators, timers and remote monitoring can be added in later versions.
  • Reduced routine walking: Where the wireless link reaches the pump location, remote switching can reduce repeated trips to the switch point.
  • Practical embedded-systems experience: The project demonstrates serial data handling, string comparison, digital outputs and electrical switching concepts.

12. Disadvantages and limitations

  • Limited communication range: Bluetooth is intended for relatively short-range communication. Large fields, buildings and obstacles can interrupt the connection.
  • No automatic irrigation decision: The present program does not use soil-moisture, rain or crop-condition data. The user must decide when to operate the pump.
  • No feedback confirmation: The sketch does not send a status message back to the phone and cannot verify that the motor actually started or stopped.
  • Exact text matching: Extra spaces or line-ending characters can cause a command to be rejected.
  • Electrical installation complexity: Pump motors can have high starting currents and must be switched using appropriately rated motor-control equipment.
  • Power and weather exposure: A field installation needs a protected supply, suitable enclosure, cable management and maintenance against moisture, dust and corrosion.
  • Basic security: Pairing alone may not provide sufficient protection for a critical pump installation. Access control and safe operating interlocks are needed for a deployed system.

13. Future scope and improvements

Soil-moisture-based automatic irrigation

A soil-moisture sensor can be added to estimate whether the soil is dry. Arduino could then allow automatic pump operation when the measured value crosses a calibrated threshold. Sensor placement, soil type and crop requirements must be considered; one sensor reading may not represent an entire field.

Water-level protection

A tank or source-water level sensor can prevent dry running by disabling the pump when water is insufficient. A flow sensor can provide evidence that water is moving through the pipe after a start command. These protections should be implemented with fail-safe logic and tested under fault conditions.

Internet of Things connectivity

An ESP32 or a suitable cellular/LoRa communication system could extend control beyond the local Bluetooth range. A secure dashboard could show pump status, operating history and alerts. Connectivity should not be the only safety mechanism: local protection and a manual emergency stop must remain available.

Scheduling and water-use records

A real-time clock or network time source could support scheduled irrigation. A flow meter could estimate water consumption and help compare irrigation cycles. Scheduling should account for rainfall, soil conditions, water availability and crop-specific needs.

Safer and more reliable control

Future versions can include a motor-rated contactor, overload protection, dry-run protection, enclosure tamper detection, command acknowledgement, watchdog recovery and a clear manual/automatic mode selector. The software should also use a robust message format, remove line endings, set a maximum command length and define a safe state after communication or controller failure.

14. Conclusion

The Phone Controlled Water Pump for Agriculture Field project presents a straightforward way to demonstrate remote pump switching using a mobile phone, Bluetooth serial communication, Arduino and an active-LOW relay module. A user sends one of two text commands; the Arduino recognises the command and changes the relay control output to switch the pump circuit.

The project is useful as an educational prototype because it combines software and hardware in a real agricultural application. Its current form provides manual remote ON/OFF control only. With suitable sensors, feedback, communication upgrades and professionally designed motor protection, it can become part of a more capable smart irrigation system.