An agriculture drone sprayer controller with pump and flow sensor is the core electronics system that distinguishes a professional crop protection drone from a basic multi-rotor. In India, agriculture drone spraying services have grown rapidly after DGCA’s liberalised drone regulations and the government’s DRISHTI scheme promoting agriculture drone use. Building a custom sprayer controller allows drone makers and spraying service operators to achieve precise variable rate application, flow rate monitoring, and nozzle pressure control that commercial controllers from DJI cost ₹50,000+ to implement. This guide covers the complete build for a DIY agriculture drone sprayer.
Table of Contents
- Sprayer System Overview
- Components and Specifications
- Understanding Flow Sensors
- Pump Control with PWM and ESC
- Complete Wiring Diagram
- Arduino/ESP32 Controller Code
- Integration with Flight Controller
- Frequently Asked Questions
Sprayer System Overview
An agriculture drone sprayer system has these main components:
- Tank: 10-20 litre tank mounted on the drone frame (carbon fibre or HDPE)
- Diaphragm or centrifugal pump: Drives liquid from tank to nozzles at controlled pressure
- Flow sensor: Measures actual liquid flow rate in ml/min or L/min
- Pressure sensor: Monitors nozzle pressure to detect clogging or leaks
- Nozzles: Flat fan, hollow cone, or rotary atomiser nozzles (2-6 per drone)
- Solenoid valves: Individual nozzle control for section control
- Sprayer controller: Manages pump speed, reads flow and pressure, communicates with flight controller
The controller receives speed and altitude data from the flight controller (ArduPilot/Pixhawk via MAVLink or PWM) and adjusts pump speed to maintain constant application rate as the drone speed changes — this is variable rate spraying based on ground speed.
Components and Specifications
- Pump: 12V diaphragm pump 5-8 L/min (for 10L tank) or brushless centrifugal pump for higher flow rates. Brushless pumps are preferred for reliability and speed control via ESC.
- Flow sensor: YF-S201 (0.3-6 L/min, 7.5 pulses per mL) for small systems; FS300A (0.1-3 L/min) for precision applications. Cost ₹100-300.
- Pressure sensor: 0-10 bar analog (0-5V) or I2C pressure sensor. Cost ₹200-600.
- Controller board: Arduino Nano or ESP32 as the sprayer controller. ESP32 preferred for Wi-Fi telemetry upload.
- ESC (for brushless pump): 30A ESC with BEC, receives PWM from controller and drives brushless motor. Cost ₹300-500.
- Solenoid valves: 12V normally-closed solenoid valves for each nozzle section (₹100-300 each)
- MOSFETs: IRF540N or IRLZ44N for solenoid valve switching (₹20-50 each)
Understanding Flow Sensors
Flow sensors for sprayer controllers use a hall-effect sensor and a spinning impeller. As liquid flows through, the impeller rotates and generates pulses. Flow rate is proportional to pulse frequency:
// YF-S201 flow sensor
// 7.5 pulses per mL at rated flow
// But calibrate for your specific liquid (pesticide solutions differ from water)
volatile long pulseCount = 0;
const float PULSES_PER_ML = 7.5; // Calibrate this value
void IRAM_ATTR flowPulseISR() {
pulseCount++;
}
float calculateFlowRate() {
noInterrupts();
long pulses = pulseCount;
pulseCount = 0;
interrupts();
// Called every 1 second; pulses = pulses in last second
float mlPerSec = pulses / PULSES_PER_ML;
float LPerMin = (mlPerSec * 60.0) / 1000.0;
return LPerMin;
}
Calibrate the PULSES_PER_ML constant for your specific pesticide solution — different surfactants and adjuvants change the impeller rotation speed for the same volumetric flow. Weigh the liquid dispensed over 60 seconds and compare with the pulse count to derive the correct calibration factor.
Pump Control with PWM and ESC
For a brushless pump controlled via ESC, output a standard servo PWM signal (1000-2000µs pulse width):
#include <ESP32Servo.h>
Servo pumpESC;
const int ESC_PIN = 13;
void setup() {
pumpESC.attach(ESC_PIN, 1000, 2000);
pumpESC.write(0); // Set to 0% (armed position for ESC)
delay(3000); // Allow ESC to arm
}
// Set pump speed 0-100%
void setPumpSpeed(int speedPercent) {
speedPercent = constrain(speedPercent, 0, 100);
int pwmValue = map(speedPercent, 0, 100, 0, 180); // Servo degrees
pumpESC.write(pwmValue);
}
Complete Wiring Diagram
| Component | ESP32 GPIO |
|---|---|
| Flow Sensor (interrupt) | GPIO 18 |
| ESC Signal (PWM) | GPIO 13 |
| Nozzle Solenoid 1 (MOSFET gate) | GPIO 25 |
| Nozzle Solenoid 2 (MOSFET gate) | GPIO 26 |
| Pressure Sensor (analog) | GPIO 34 |
| Tank Level Sensor (ultrasonic) | GPIO 5/17 |
| Flight Controller PWM input | GPIO 19 |
Arduino/ESP32 Controller Code
#include <ESP32Servo.h>
#define FLOW_PIN 18
#define ESC_PIN 13
#define SOLENOID1 25
#define SOLENOID2 26
#define PRESSURE_PIN 34
// Spray parameters
const float TARGET_RATE_ML_PER_METER = 2.0; // Application rate per meter of travel
const float DRONE_BOOM_WIDTH_M = 3.0; // Effective spray width in metres
Servo pumpESC;
volatile long flowPulses = 0;
float droneSpeedMS = 3.0; // Will be received from flight controller
void IRAM_ATTR flowISR() { flowPulses++; }
void setup() {
Serial.begin(115200);
pumpESC.attach(ESC_PIN, 1000, 2000);
pumpESC.write(0);
delay(3000);
pinMode(FLOW_PIN, INPUT_PULLUP);
attachInterrupt(FLOW_PIN, flowISR, RISING);
pinMode(SOLENOID1, OUTPUT);
pinMode(SOLENOID2, OUTPUT);
// Enable nozzles
digitalWrite(SOLENOID1, HIGH);
digitalWrite(SOLENOID2, HIGH);
}
void loop() {
// Calculate required flow rate (mL/min)
float requiredFlowMLmin = TARGET_RATE_ML_PER_METER * droneSpeedMS * 60.0 * DRONE_BOOM_WIDTH_M;
// Get actual flow rate
noInterrupts();
long pulses = flowPulses;
flowPulses = 0;
interrupts();
float actualFlowMLmin = (pulses / 7.5) * 60.0; // YF-S201: 7.5 pulses/mL
// PID control (simplified proportional)
float error = requiredFlowMLmin - actualFlowMLmin;
static int pumpSpeed = 50;
pumpSpeed = constrain(pumpSpeed + (int)(error / 10), 0, 100);
int pwm = map(pumpSpeed, 0, 100, 0, 180);
pumpESC.write(pwm);
Serial.printf("Speed:%.1fm/s Target:%.0fmL/min Actual:%.0fmL/min Pump:%d%%
",
droneSpeedMS, requiredFlowMLmin, actualFlowMLmin, pumpSpeed);
delay(1000);
}
Integration with Flight Controller
The sprayer controller receives drone speed from the flight controller via MAVLink or PWM. For Pixhawk/ArduPilot, use a dedicated AUX output configured as airspeed or pump control. Read the PWM input on ESP32 using pulseIn() and map to drone speed. Alternatively, connect via MAVLink serial to get accurate GPS-based ground speed for precise application rate calculation. The ArduPilot Sprayer library (native in ArduCopter 4.0+) provides built-in sprayer control if you prefer using the flight controller’s existing spray support rather than a separate Arduino controller.
Frequently Asked Questions
What is the DGCA requirement for agriculture drones in India?
Agriculture drones used commercially in India must be registered on the Digital Sky platform and have a Remote Pilot Certificate (RPC) unless operated in BVLOS mode. Sprayer drones over 25kg MTOW require type certification. The Kisan Drone scheme and drone PLI scheme provide subsidies for DGCA-approved agriculture drones. Ensure your custom drone meets DGCA’s technical requirements (anti-collision lights, GPS geo-fencing, automatic return-to-home) before commercial operation.
What spray rate (litres per hectare) is typical for drone crop spraying in India?
Ultra-low volume (ULV) spraying from drones uses 10-15 litres per hectare (LPH), compared to 200-500 LPH for ground-based sprayers. The smaller droplets from drone nozzles provide excellent canopy penetration with less water. Rotary atomiser nozzles provide the finest droplets (50-150 micron) while flat fan nozzles give coarser droplets (150-300 micron) for ground spray residue reduction. Calibrate your system to deliver the target application rate at your typical flying speed.
How do I prevent nozzle clogging during agricultural spraying?
Use an inline strainer (80-100 mesh) between the tank and pump and between the pump and nozzles. Pre-filter the pesticide solution before filling the tank. Flush the entire system with clean water after each spraying session. Monitor the pressure sensor — a sudden pressure increase with constant pump speed indicates nozzle clogging. Design your controller to alert the pilot when pressure exceeds 20% above the calibration baseline.
What is the effective spray width for a typical 10L agriculture drone?
For a 10L drone with 2-4 flat fan nozzles, typical effective spray width is 2-4 metres depending on flying height and nozzle spacing. Flying at 2-3 metres above the crop canopy with nozzles spaced 0.5 metres apart gives approximately 3 metre effective width. Wider spacing and higher altitude increase width but reduce droplet density and penetration. GPS waypoint flight patterns should use swath widths 20% narrower than the effective spray width to ensure 10% overlap and no spray gaps.
Add comment