Smart Mini Farm: A DIY Robotic Farm Model with Auto Watering, Fertilizing & Weed Removal | Kids Robotics Project

Smart Mini Farm: A DIY Robotic Farm Model with Auto Watering, Fertilizing & Weed Removal | Kids Robotics Project
Robotics Project · Ages 10+

The Smart Mini Farm: a tabletop farm model that waters, feeds, and weeds itself

A miniature farm that watches over its own crops — a soil sensor tells it when the ground is dry, a pump waters the rows automatically, a second pump sprays fertilizer on a schedule, and a small robotic arm clears out weeds it spots along the way. One robotics build, three farming jobs done automatically.

42% soil

What you're building

A miniature farm model that teaches sensors, pumps, and motors by putting them to real farming work.

The Smart Mini Farm sits on a small foam or cardboard base planted with a few model crop rows. Underneath, a soil moisture sensor constantly checks how dry the ground is — when it drops too low, a pump switches on and waters the row automatically. On a set schedule, a second pump sprays a light mist of fertilizer solution. Meanwhile, a sensor watches the ground for weed markers scattered between the crops, and when it spots one, a small servo arm swings over and knocks it out of the row. A little screen keeps track of soil moisture, watering, and how many weeds have been cleared.

Auto Watering

A soil moisture sensor checks the ground and switches on a pump the moment it's too dry.

Fertilizer Spray

A second pump mists a nutrient solution over the crops on a timed schedule.

Weed Removal

A sensor spots weed markers between the rows and a servo arm sweeps them away.

Materials list

Most electronics can be reused from a beginner Arduino sensor kit.

Electronics

  • 1x Arduino Uno
  • 1x Soil moisture sensor (analog)
  • 1x IR obstacle / color sensor (for weed markers)
  • 2x 5V single-channel relay modules
  • 2x mini submersible water pumps (3-6V)
  • 1x micro servo motor (weed-removal arm)
  • 1x 16x2 LCD display with I2C backpack
  • 1x small buzzer
  • 3x LEDs (green, orange, red) + 220-ohm resistors
  • Silicone tubing + a small nozzle
  • External 5-9V power supply for the pumps

Farm model & build supplies

  • Foam board or cardboard base (30x40 cm)
  • Artificial grass mat or green paper
  • Small foam or paper model crops
  • Dark green felt scraps (weed markers)
  • 2 small cups or bottles (water tank, fertilizer tank)
  • Hot glue gun
  • Craft knife (adult use only)
  • Waterproof tape

Circuit diagram

Everything connects back to the Arduino Uno. The relays isolate the pumps from the Arduino's low-power pins.

ARDUINO UNO USB / 5V power in SOIL MOISTURE Sensor Signal → A0 WEED SENSOR IR / color module Signal → D7 RELAY 1 Water pump D8 RELAY 2 Fertilizer pump D9 SERVO ARM Weed removal D10 16x2 LCD (I2C) Status display SDA → A4 SCL → A5 BUZZER Weed alert D11 STATUS LEDs Green/Orange/Red D2, D3, D4 5-9V POWER For pumps (via relays) Shared GND

Tip: Never connect the pumps directly to Arduino pins — always switch them through the relay modules. Keep the pumps and their tubing on the opposite side of the base from the Arduino and LCD, away from any splashes.

Wiring reference table

ComponentComponent PinArduino Pin
Soil Moisture SensorSignal (AO)A0
Weed Sensor (IR/color)SignalD7
Relay 1 (Water Pump)IND8
Relay 2 (Fertilizer Pump)IND9
Servo (Weed Arm)SignalD10
BuzzerSignalD11
Green LED (Watering)AnodeD2
Orange LED (Fertilizing)AnodeD3
Red LED (Weed Removed)AnodeD4
16x2 LCD (I2C)SDA / SCLA4 / A5
All componentsGNDCommon GND rail

Step-by-step build instructions

Work through these in order — test each sensor and pump on the bench before mounting anything on the farm base.

  1. Build the farm base

    Cut a foam board or cardboard base, cover it with artificial grass or green paper, and mark out two or three crop rows with small model plants.

  2. Wire the soil moisture sensor

    Push the sensor's prongs into the soil near one crop row and connect its signal pin to A0, then test that its reading changes when the soil is wet versus dry.

  3. Set up the water pump and relay

    Connect the water pump to Relay 1, place the pump in a small water tank, and run tubing from the pump to a nozzle positioned over the crop row.

  4. Set up the fertilizer pump and relay

    Repeat the same setup with the second pump and relay, using a separate small tank filled with diluted liquid fertilizer (or plain water for testing).

  5. Mount the weed sensor and servo arm

    Position the IR/color sensor to look down at the gaps between crop rows, and mount the servo with a small arm attachment beside it so it can swing over and knock away a weed marker.

  6. Scatter weed markers

    Place a few small dark green felt scraps between the crop rows to act as "weeds" for the sensor to detect.

  7. Wire the LCD, buzzer, and LEDs

    Connect the LCD's SDA/SCL to A4/A5, and wire the buzzer and three status LEDs to their pins as shown in the wiring table.

  8. Upload the code and calibrate

    Upload the sketch below, then check the LCD's moisture reading against dry and wet soil so you can fine-tune MOISTURE_THRESHOLD in the code.

  9. Test the full farm cycle

    Let the soil dry out a little and confirm watering kicks in, wait for a fertilizer cycle to trigger, and pass a felt "weed" under the sensor to confirm the arm sweeps it away.

Arduino code

Copy this into a new sketch in the Arduino IDE. Install the Servo and LiquidCrystal_I2C libraries first from the Library Manager.

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Servo.h>

// ---- Pin setup ----
#define MOISTURE_PIN     A0
#define WEED_SENSOR_PIN  7
#define WATER_RELAY_PIN  8
#define FERT_RELAY_PIN   9
#define SERVO_PIN        10
#define BUZZER_PIN       11
#define LED_WATER        2
#define LED_FERT         3
#define LED_WEED         4

LiquidCrystal_I2C lcd(0x27, 16, 2);
Servo weedArm;

int MOISTURE_THRESHOLD = 40;      // % below which watering starts
unsigned long lastFertTime = 0;
const unsigned long fertInterval = 60000UL * 10; // fertilize every 10 minutes
int weedCount = 0;
bool weedBusy = false;

void setup() {
  pinMode(WEED_SENSOR_PIN, INPUT);
  pinMode(WATER_RELAY_PIN, OUTPUT);
  pinMode(FERT_RELAY_PIN, OUTPUT);
  pinMode(BUZZER_PIN, OUTPUT);
  pinMode(LED_WATER, OUTPUT);
  pinMode(LED_FERT, OUTPUT);
  pinMode(LED_WEED, OUTPUT);

  digitalWrite(WATER_RELAY_PIN, LOW);
  digitalWrite(FERT_RELAY_PIN, LOW);

  weedArm.attach(SERVO_PIN);
  weedArm.write(0); // resting position

  lcd.init();
  lcd.backlight();
}

void loop() {
  int moisturePercent = readMoisture();
  updateDisplay(moisturePercent);

  if (moisturePercent < MOISTURE_THRESHOLD) {
    waterPlants();
  }

  if (millis() - lastFertTime > fertInterval) {
    fertilizePlants();
    lastFertTime = millis();
  }

  checkForWeeds();
}

int readMoisture() {
  int raw = analogRead(MOISTURE_PIN);
  // Wetter soil usually reads LOWER on cheap analog sensors, so we flip it.
  int percent = map(raw, 1023, 300, 0, 100);
  percent = constrain(percent, 0, 100);
  return percent;
}

void waterPlants() {
  digitalWrite(LED_WATER, HIGH);
  lcd.setCursor(0, 1);
  lcd.print("Watering...     ");
  digitalWrite(WATER_RELAY_PIN, HIGH);
  delay(3000); // watering burst, adjust to taste
  digitalWrite(WATER_RELAY_PIN, LOW);
  digitalWrite(LED_WATER, LOW);
}

void fertilizePlants() {
  digitalWrite(LED_FERT, HIGH);
  lcd.setCursor(0, 1);
  lcd.print("Fertilizing...  ");
  digitalWrite(FERT_RELAY_PIN, HIGH);
  delay(1500); // short fertilizer mist
  digitalWrite(FERT_RELAY_PIN, LOW);
  digitalWrite(LED_FERT, LOW);
}

void checkForWeeds() {
  bool weedSeen = digitalRead(WEED_SENSOR_PIN) == HIGH;

  if (weedSeen && !weedBusy) {
    weedBusy = true;
    digitalWrite(LED_WEED, HIGH);
    tone(BUZZER_PIN, 1000, 200);

    weedArm.write(90);  // sweep over
    delay(500);
    weedArm.write(0);   // return to rest
    delay(300);

    weedCount++;
    lcd.setCursor(0, 1);
    lcd.print("Weed removed!   ");
    delay(1000);
    digitalWrite(LED_WEED, LOW);
  }

  if (!weedSeen) {
    weedBusy = false;
  }
}

void updateDisplay(int moisturePercent) {
  lcd.setCursor(0, 0);
  lcd.print("Soil:");
  lcd.print(moisturePercent);
  lcd.print("% Wds:");
  lcd.print(weedCount);
  lcd.print("  ");
}

Beginner tip

Cheap analog soil sensors read differently from batch to batch. Dip the sensor in a dry pot and a wet pot, note both raw readings, and plug those numbers into the map() line in readMoisture() for an accurate percentage.

Safety notes for young makers

Ask an adult to help wire the relays and handle any liquid fertilizer, and use only a well-diluted, plant-safe fertilizer solution or plain water for testing. Keep the Arduino, LCD, and wiring away from water and splashes, and always unplug the power before adjusting tubing or refilling tanks.

Why this project works so well for learning

The Smart Mini Farm packs three real automation ideas into one build. Reading a soil moisture sensor and driving a pump through a relay teaches how threshold-based automation works — the same idea behind real irrigation systems. Running a task on a timer, like the fertilizer spray, introduces working with time in code instead of just single button presses. And detecting a weed marker with a sensor and reacting with a servo arm is a hands-on first taste of "sense, decide, act" — the core loop behind every robot, from a simple farm model to a full-size agricultural robot.

Frequently asked questions

What age group is this robotics project best suited for?

Ages 10 and up can build this with an adult helping on the relay wiring and any fertilizer handling. Ages 13+ with some Arduino experience can usually manage most of it independently.

Do I need real fertilizer for this to work?

No. Plain water works fine in both tanks for testing and demonstrations — swap in a heavily diluted, plant-safe fertilizer solution only once you're confident in the wiring and timing.

Can I build this without the weed removal system?

Yes. Skip the weed sensor and servo wiring and the checkForWeeds() function, and you'll still have a fully working automatic watering and fertilizing model.

Why use relays instead of connecting the pumps directly?

Water pumps draw more current than an Arduino pin can safely supply, and mixing higher-current pump wiring directly into the board risks damaging it. A relay lets the Arduino safely switch a separate power supply on and off for the pumps.

How do I stop the model from over-watering?

Increase the delay inside waterPlants() for a longer soak, or add a short "cooldown" timer so watering can't trigger again for a few minutes after the last cycle.

Built for curious young engineers. Always build and power on electronics with adult supervision, and keep water and electronics carefully separated.

Comments

Product Cards
Buddy Bot eBook
⭐ New 2026 Release
Build Your
Own Robot!
3D design, wiring &
Arduino coding.
★★★★★ Young inventors love it!
🖨️
3D Print
All parts
⚡
Wire it
Circuit guide
💻
Code it
Arduino IDE
🤖
Watch it
Walk & react
📋 Your Details
Enter your name
Valid 10-digit no.
Enter a valid email
Special Website Offer
₹499 ₹300
🌍 International: $5 USD
One-time · Instant digital delivery
🔒 Secured by Razorpay · Your data is safe
📄 Download Free Sample Copy
🔒 Secured by Razorpay · Your data is safe
🍓
Raspberry Pi Pico Mastery
21 Projects
⚡ Launch Price — 80% OFF
Learn Pico
Build 21 Projects!
MicroPython · Wokwi
IoT · Certificate
★★★★★ Perfect for beginners!
🖥️
Wokwi
No hardware
🐍
MicroPy
From zero
🔨
21 Projects
IoT + sensors
📄
Certificate
Verified cert
📋 Your Details
Enter your name
Valid 10-digit no.
Enter a valid email
Special Launch Offer
₹999 ₹200 80% OFF
🌍 International: $5 USD
One-time · Lifetime access · No subscription
🔒 Secured by Razorpay · UPI · Cards · NetBanking
🎉

You're in!

Payment successful! Your Buddy Bot eBook is ready. Time to build!

📖 Access Your eBook Now
🎉

Enrolled!

Payment successful! Lifetime access to all 21 Pico Projects is yours!

🍓 Go to My Course