Build a Fertilizer-Spraying Farm Robot That Feeds Your Plants
A fun, beginner-friendly DIY project using Arduino, two motors, and a mini pump to build a rolling robot that drives along your plants and sprays them with fertilizer — like a tiny tractor!
Why We're Building This
Robots That Help Plants Grow 🌾
Farmers spend hours walking rows of crops to feed them fertilizer by hand. Our Farm Spray Bot automates part of that job: it rolls forward on two wheels and sprays a fine mist of liquid fertilizer through a pump-powered nozzle. It's a hands-on introduction to smart farming (agri-tech) that teaches real robotics skills — motors, pumps, circuits, and code — all while building something that could genuinely help a garden or small farm.
The Big Idea
How Does the Robot Work?
Three simple systems work together to move, decide, and spray.
1. The Wheels — DC Motors
Two gear motors drive the robot forward along the row of plants, steered by a motor driver board.
2. The Brain — Arduino
The Arduino board runs the program that tells the motors when to drive and when to trigger the pump.
3. The Mouth — Pump & Nozzle
A mini water pump pushes liquid fertilizer from the bottle, out through a tube, and into a fine spray.
Gather Your Gear
What You'll Need 🧰
Most parts are common robotics-kit pieces you can reuse in future builds.
- 🔷Arduino Uno BoardThe brain of our robot
- ⚙️L298N Motor Driver ModuleControls the two wheel motors
- 🛞2x DC Gear Motors + WheelsDrives the robot forward
- 🎯1x Caster / Support WheelKeeps the chassis balanced
- 💧Mini 5V Submersible Water PumpPushes fertilizer through the tube
- 🔌5V Relay ModuleSafely switches the pump on/off
- 🍶Small Plastic BottleFertilizer reservoir
- 🪈Silicone Tubing + Spray NozzleCarries and sprays the liquid
- 🧱Chassis (Cardboard or Acrylic)The robot's body/base
- 🔋Battery Pack (4xAA or 7.4V Li-ion)Powers the motors and pump
- 🌱Soil Moisture Sensor (optional)Sprays only when soil is dry
- 🔗Jumper Wires & Glue GunConnects and mounts everything
Safety First, Grown-Ups Needed!
- Build with an adult, especially when using a glue gun or handling wiring near water.
- Test the sprayer with plain water first, not real fertilizer, until everything works properly.
- If you do add real fertilizer later, ask an adult to help choose a safe, diluted, plant-friendly formula and wear gloves.
- Keep the pump's electrical connections away from spilled liquid at all times.
Wire It Up
The Circuit Diagram 🔌
Here's how the motor driver and pump relay connect to the Arduino. Color-coded wires make it easy to follow!
| Part | Pin | Connects to Arduino |
|---|---|---|
| L298N | ENA (speed) | D5 |
| L298N | ENB (speed) | D6 |
| L298N | IN1 / IN2 | D8 / D9 |
| L298N | IN3 / IN4 | D10 / D11 |
| Relay Module | IN | D7 |
| Soil Sensor (optional) | AO | A0 |
Let's Build!
Step-by-Step Instructions 🛠️
-
1
Build the chassis
Cut or assemble your base (cardboard or acrylic works great), and mount the two gear motors on the back with the caster wheel up front for balance.
-
2
Attach the wheels
Push the wheels onto the motor shafts and check that both spin freely without rubbing the chassis.
-
3
Wire the motor driver
Connect both motors to the L298N's output terminals, then wire ENA, ENB, IN1–IN4 to the Arduino as shown in the diagram.
-
4
Set up the spray system
Place the mini pump inside the reservoir bottle, connect its output to your tubing, and attach the nozzle at the front of the robot.
-
5
Wire the relay and pump
Connect the pump's power line through the relay module, and wire the relay's signal pin to Arduino pin D7.
-
6
Connect the battery pack
Power the L298N's motor supply and the pump circuit from your battery pack. Double-check + and - before switching on!
-
7
Upload the code
Copy the sketch below into the Arduino IDE, select "Arduino Uno" as your board, choose the right port, and click Upload.
-
8
Test with water first
Fill the reservoir with plain water and run a test drive on a table or tray to make sure the wheels move and the pump sprays correctly.
-
9
Take it to the garden
Once everything works, add diluted plant-safe fertilizer (with an adult's help) and let your robot roll along a row of plants!
Program the Brain
The Arduino Code 💻
This sketch drives the robot forward, pauses every few seconds to spray fertilizer through the pump, then keeps rolling. Copy it into the Arduino IDE.
// Farm Spray Bot — drives forward and sprays fertilizer #define ENA 5 #define ENB 6 #define IN1 8 #define IN2 9 #define IN3 10 #define IN4 11 #define RELAY_PIN 7 #define SOIL_SENSOR_PIN A0 #define DRIVE_TIME_MS 3000 // drive for 3 seconds #define SPRAY_TIME_MS 1500 // spray for 1.5 seconds #define DRY_SOIL_THRESHOLD 550 // lower reading = wetter soil void setup() { pinMode(ENA, OUTPUT); pinMode(ENB, OUTPUT); pinMode(IN1, OUTPUT); pinMode(IN2, OUTPUT); pinMode(IN3, OUTPUT); pinMode(IN4, OUTPUT); pinMode(RELAY_PIN, OUTPUT); digitalWrite(RELAY_PIN, LOW); Serial.begin(9600); } void loop() { driveForward(); delay(DRIVE_TIME_MS); stopMotors(); int soilReading = analogRead(SOIL_SENSOR_PIN); Serial.print("Soil reading: "); Serial.println(soilReading); if (soilReading > DRY_SOIL_THRESHOLD) { sprayFertilizer(); } } void driveForward() { digitalWrite(IN1, HIGH); digitalWrite(IN2, LOW); digitalWrite(IN3, HIGH); digitalWrite(IN4, LOW); analogWrite(ENA, 180); // speed 0-255 analogWrite(ENB, 180); } void stopMotors() { analogWrite(ENA, 0); analogWrite(ENB, 0); } void sprayFertilizer() { Serial.println("Spraying..."); digitalWrite(RELAY_PIN, HIGH); // turns pump on delay(SPRAY_TIME_MS); digitalWrite(RELAY_PIN, LOW); // turns pump off }
Did You Know?
Real farms use giant versions of this idea called "precision agriculture" robots and drones, which use sensors and GPS to spray only the exact spots that need fertilizer — saving water and money while helping crops grow healthier!
Level Up
Make It Even Smarter 🚀
Add an Obstacle Sensor
Mount an ultrasonic sensor up front so the robot stops or turns before bumping into a plant pot.
Follow a Line
Add an IR line-follower sensor so the robot automatically drives along a painted or taped row.
Control It by Phone
Swap in an ESP32 board with Wi-Fi or Bluetooth so you can drive and trigger the spray from your phone.
Questions & Answers
Farm Spray Bot FAQ
Can I use this robot with real fertilizer right away?
Test with plain water first! Once the robot works reliably, ask an adult to help pick a safe, properly diluted, plant-friendly fertilizer before switching liquids.
Do I need the soil moisture sensor?
No, it's optional. Without it, you can simply set the robot to spray at timed intervals instead of checking soil dryness.
Why do we need a relay for the pump?
The Arduino's pins can't safely supply enough current to run a motor or pump directly. The relay acts like a safe switch, letting the Arduino control a separate, stronger power source.
Can this robot work indoors for houseplants?
Yes! Just make sure there's a flat, dry path for it to roll along and keep an eye on cords and furniture in its way.

Comments
Post a Comment