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!
🧺 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.
What You'll Need
Gather these parts before you start building Harvey!
Arduino Uno
The brain that checks color and controls the arm.
TCS3200 Color Sensor
Mounted near the gripper to "see" each fruit's color.
SG90 Micro Servo Motors
Base rotation, arm lift, and the gripper claw.
LEDs (Green + Red)
Green flashes for ripe, red for unripe/skipped.
Small Buzzer
Beeps once each time a ripe fruit is picked.
Mini Craft "Fruit Tree"
With a few felt or foam fruits at 2–3 fixed positions.
Small Basket
Placed within the arm's swinging reach.
Breadboard
For connecting everything without soldering.
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.
Step-by-Step Build Instructions
Ask an adult to help with mounting the arm segments and calibrating the color sensor. Let's build Harvey!
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.
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.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.
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.
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.
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.
// 🍎🤖 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.
Comments
Post a Comment