DIY Fruit Picking Robot 🍎Arduino Color Sensor Robotics

DIY Fruit Picking Robot 🍎Arduino Color Sensor Robotics Project for Kids
🍎 ROBOTICS FOR KIDS · LEVEL: INTERMEDIATE

Build a Robot Arm That Picks Only the Ripe Fruit!

Meet Harvey — a servo-powered robotic arm with a color sensor "eye." It checks each fruit's color, plucks only the ripe ones, and gently drops them into a basket — skipping anything still green!

⏱️ 4–5 hours 🎂 Ages 10+ (with an adult) 🎨 Color-Sensing Robotic Arm

🧺 Say hi to Harvey, your fruit picking robot!

What Is a Fruit Picking Robot, Anyway?

Real fruit-picking robots used on farms use cameras and sensors to tell ripe fruit apart from unripe fruit before picking it. Harvey does the same thing on a mini scale: a color sensor checks each fruit's color, and only if it's ripe (red or orange) does the robotic arm reach out, pluck it, and drop it into the basket.

🎨 Color-Based Ripeness Check 🦾 3-Servo Robotic Arm 🧺 Automatic Basket Drop 🔔 Pick Confirmation Beep
🧰

What You'll Need

Gather these parts before you start building Harvey!

x1

Arduino Uno

The brain that checks color and controls the arm.

x1

TCS3200 Color Sensor

Mounted near the gripper to "see" each fruit's color.

x3

SG90 Micro Servo Motors

Base rotation, arm lift, and the gripper claw.

x2

LEDs (Green + Red)

Green flashes for ripe, red for unripe/skipped.

x1

Small Buzzer

Beeps once each time a ripe fruit is picked.

x1

Mini Craft "Fruit Tree"

With a few felt or foam fruits at 2–3 fixed positions.

x1

Small Basket

Placed within the arm's swinging reach.

x1

Breadboard

For connecting everything without soldering.

~15

Jumper Wires

Male-to-male and male-to-female.

🔌

The Circuit Diagram

The color sensor, three arm servos, two LEDs, and a buzzer all connect to one Arduino Uno.

Arduino Uno UNO Pins 2,3,4,5 — Color Sensor S0–S3 Pin 6 — Color Sensor OUT Pin 9 — Base Rotation Servo Pin 10 — Arm Lift Servo Pin 11 — Gripper Servo Pin 7 — Ripe (Green) LED Pin 8 — Unripe (Red) LED Pin 12 — Buzzer 5V GND TCS3200 Color Sensor Servo — Base Rotation Servo — Arm Lift Servo — Gripper Green + Red LEDs Buzzer
Color sensor S0–S3 → pins 2,3,4,5 Color sensor OUT → pin 6 Arm servos → pins 9, 10, 11 LEDs → pins 7,8 · Buzzer → pin 12
🛠️

Step-by-Step Build Instructions

Ask an adult to help with mounting the arm segments and calibrating the color sensor. Let's build Harvey!

1

Build the 3-servo arm

Mount the base servo upright, attach the arm-lift servo on top of it, and mount the gripper servo at the end of the arm with a small claw or pincer attachment.

2

Attach the color sensor

Mount the TCS3200 sensor right next to the gripper, facing forward, so it "looks" at whatever fruit the gripper is about to grab.

💡 Tip: Test the sensor readings on a red felt fruit and a green felt fruit first, and write down the typical numbers for each — you'll need them for calibration.
3

Set up the mini fruit tree

Position 2–3 felt or foam fruits at fixed spots within the arm's reach — mix in both "ripe" (red/orange) and "unripe" (green) fruits.

4

Place the basket

Position a small basket within the arm's swinging range, at the angle the base servo will rotate to when dropping off a picked fruit.

5

Add the LEDs and buzzer

Mount the green and red LEDs somewhere visible to show ripe/unripe decisions at a glance, and place the buzzer nearby for pick confirmations.

6

Wire everything and test

Connect the color sensor, all three servos, the LEDs, and the buzzer exactly as shown in the circuit diagram, upload the code, and watch Harvey check, pick, and sort the fruit!

💻

The Arduino Code

Copy this code into the Arduino IDE, adjust the color threshold after testing your sensor, then click Upload.

fruit_picking_robot.ino
// 🍎🤖 Harvey the Fruit Picking Robot — Arduino Color Sensor Robotics Project
// Checks each fruit's color, picks the ripe ones, and drops them in a basket

#include <Servo.h>

Servo baseServo, liftServo, gripperServo;

// ---- Color sensor pins ----
const int s0 = 2, s1 = 3, s2 = 4, s3 = 5, colorOut = 6;

// ---- LEDs + buzzer ----
const int ripeLED = 7, unripeLED = 8, buzzerPin = 12;

// ---- Fruit positions on the mini tree (base servo angles) ----
const int fruitPositions[3] = {30, 90, 150};

const int basketAngle = 0;
const int liftDown = 30, liftUp = 100;
const int gripOpen = 0, gripClosed = 60;

void setup() {
  baseServo.attach(9);
  liftServo.attach(10);
  gripperServo.attach(11);

  pinMode(s0, OUTPUT); pinMode(s1, OUTPUT);
  pinMode(s2, OUTPUT); pinMode(s3, OUTPUT);
  pinMode(colorOut, INPUT);
  pinMode(ripeLED, OUTPUT);
  pinMode(unripeLED, OUTPUT);
  pinMode(buzzerPin, OUTPUT);

  digitalWrite(s0, HIGH); digitalWrite(s1, LOW);  // 20% frequency scaling

  liftServo.write(liftUp);
  gripperServo.write(gripOpen);
  baseServo.write(basketAngle);
}

void loop() {
  for (int i = 0; i < 3; i++) {
    baseServo.write(fruitPositions[i]);
    delay(600);   // give the arm time to swing into position

    if (isRipe()) {
      digitalWrite(ripeLED, HIGH);
      pickFruit();
      dropInBasket();
      digitalWrite(ripeLED, LOW);
    } else {
      digitalWrite(unripeLED, HIGH);
      delay(500);
      digitalWrite(unripeLED, LOW);
    }
  }
  delay(3000);  // pause before checking the tree again
}

// Reads red and green light levels and compares them to decide ripeness
bool isRipe() {
  int redValue = readColor(LOW, LOW);    // S2=LOW,S3=LOW selects red filter
  int greenValue = readColor(HIGH, HIGH); // S2=HIGH,S3=HIGH selects green filter

  // Lower frequency number = stronger color detected by this sensor
  return (redValue < greenValue - 20);
}

// Selects a color filter and measures the resulting pulse frequency
int readColor(int s2state, int s3state) {
  digitalWrite(s2, s2state);
  digitalWrite(s3, s3state);
  return pulseIn(colorOut, LOW);
}

// Lowers the arm, closes the gripper on the fruit, then lifts back up
void pickFruit() {
  liftServo.write(liftDown);
  delay(400);
  gripperServo.write(gripClosed);
  delay(400);
  liftServo.write(liftUp);
  delay(400);
  tone(buzzerPin, 1400, 150);
}

// Swings the arm over the basket and releases the fruit
void dropInBasket() {
  baseServo.write(basketAngle);
  delay(600);
  gripperServo.write(gripOpen);
  delay(300);
}
🧠

How Does Harvey Actually Work?

Here are the big robotics ideas hiding inside this project:

🎨

Color Sensing with Light

The TCS3200 shines colored filters over a light sensor and counts how fast it pulses — different colors of fruit reflect light differently, giving a different pulse frequency for each.

⚖️

Comparing Two Readings

Rather than trusting one number alone, isRipe() compares the red and green readings against each other — a much more reliable way to judge color than a single fixed threshold.

🦾

Coordinated Multi-Servo Movement

Picking a fruit takes three servos working in the right order — lower, grip, lift — each waiting for the last to finish, just like a real robotic arm.

📍

Positions Stored as Data

The fruitPositions[] array holds each fruit's location as a servo angle, so the loop can visit every position automatically instead of hardcoding each move separately.

🧑‍🔬 Safety First!

  • Build with an adult, especially when assembling and calibrating the robotic arm.
  • Use only craft or felt fruit for testing — this is a mechanical demo, not a robot for handling real produce without further safety design.
  • Keep fingers clear of the gripper while it's powered on.
  • Double-check your color threshold values in good, consistent lighting — shadows can confuse the sensor.

Frequently Asked Questions

Why does a lower pulse number mean a stronger color?

The TCS3200 measures color as a frequency — the more of a certain color it detects, the faster it pulses, meaning pulseIn() returns a shorter (lower) number for that color.

How do I calibrate the ripe/unripe threshold?

Print the red and green readings to the Serial Monitor for both a ripe and an unripe fruit, then adjust the - 20 comparison value in isRipe() until it correctly tells them apart.

Can I add more fruit positions?

Yes! Add more angles to the fruitPositions[] array and change the loop limit from 3 to match your new total.

What age group is this project good for?

Because it combines a multi-servo arm with color sensor calibration, this project is best suited for kids around age 10+ working closely with an adult.

🎉 Great harvest — you just built a real color-sensing robot! Set up your mini tree and watch Harvey pick out only the ripe fruit.

⬆️ Back to Materials List

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