Robotic arm that picks and sorts by colour
Pick-and-place robots sort parts on every factory line, but industrial arms cost lakhs. A four-axis arm that sees an object's colour and places it in the right bin teaches kinematics, servo control and sensing.
- Parts
- ₹4,100
- Build
- 14 weeks
- Board
- Arduino Uno
- Objectives
- 5
Block diagram
- IR sensorDetects an object at the pick spot
- Colour sensorReads the object's colour
- CameraCaptures a photo when the event happens+
- Arduino UnoPlans the moves
- 5 V 3 A supplyServo power
- PCA9685 servo driverDrives four servos smoothly
- 4-DOF armPicks and places
Objectives
- To compute joint angles for a target point with inverse kinematics.
- To identify red, green, blue and yellow objects reliably under room light.
- To pick and place each object in its bin within 8 s.
- To measure placement accuracy and success over 40 picks.
- To capture and store an image automatically when an event is detected.
Parts and specifications
- Arduino Uno R3 (CH340 clone)ATmega328P 16 MHz, 32 KB flash, 2 KB SRAM, 5 V logic, 6 analog inputs (10-bit), 6 PWM pins₹450Buy
- 4-DOF acrylic robot arm kitBase, shoulder, elbow and gripper, takes four SG90 or MG90S servos₹1,200Buy
- PCA9685 16-channel servo driver12-bit PWM at 24 to 1526 Hz, I²C 0x40, separate V+ terminal for servo power₹250Buy
- IR obstacle sensor moduleReflective IR pair with LM393, 2 to 30 cm set by trimmer, digital out, sunlight can false-trigger₹40Buy
- Coloured blocks and three bins₹150
- ESP32-CAM with OV2640ESP32 + 4 MB PSRAM + 2 MP OV2640 camera, microSD slot, needs 5 V 500 mA for stable Wi-Fi₹550Buy
Total about ₹4,100 at typical online prices. Tap a part for its pinout and datasheet notes.
Design calculations
Upper arm L1 = 8 cm, forearm L2 = 8 cm, target r = 12 cm, z = 2 cm: D = (r² + z² − L1² − L2²) / (2 L1 L2) = (144 + 4 − 128) / 128 = 0.156, elbow θ2 = acos(0.156) = 81°, shoulder θ1 = atan2(z, r) + atan2(L2 sin θ2, L1 + L2 cos θ2) = 9.5° + 41° = 50.5°. Base = atan2(y, x).
PCA9685 at 50 Hz has 4096 steps per 20 ms; 0.5 to 2.5 ms = 102 to 512 counts. 90° ≈ 307 counts.
Normalise r, g, b by clear (c) to remove brightness, then nearest stored reference in rgb space. Red block: r/c = 0.55, g/c = 0.22, b/c = 0.20.
Four servos can draw 2.5 A together when moving; the 5 A buck with a 1000 µF capacitor avoids resets.
Pin map
| Signal | Pin or connection |
|---|---|
| PCA9685 SDA / SCL | A4 / A5 (0x40); TCS34725 on the same bus (0x29) |
| Servo channels base / shoulder / elbow / gripper | PCA9685 ch 0 / 1 / 2 / 3, V+ from the 5 V 3 A buck |
| IR object sensor | D2 |
| Colour sensor LED | TCS34725 LED pin to D3 |
Firmware outline
- Calibrate: record pulse counts for 0° and 180° on each servo; store reference colours for each block.
- Wait for the IR sensor; move the sensor arm or read the colour at the pick spot.
- Compute IK for the pick point; move each joint in small steps (smooth motion) and close the gripper.
- Lift, compute IK for the bin of that colour, place, open, return home.
- Count sorted items per colour; flag unknown colours to a reject bin.
Test plan
| Test | Expected result |
|---|---|
| 40 blocks in four colours | Success rate and wrong bins |
| Room light vs lamp | Colour accuracy |
| Target points across the workspace | Placement error in mm |
| Cycle time | Under 8 s per block |
These rows start your results table when you plan the project.
Viva practice
Say your answer out loud first, then check. The first 2 answers are free; Maker opens all 5.
Make it yours
One or two upgrades for a mini project, two to four for a major one.
Datasheets and sources to cite
- Craig, Introduction to Robotics: Mechanics and Control
- NXP PCA9685 datasheet
- ams TCS34725 datasheet
About this project
How much does the robotic arm that picks and sorts by colour project cost?
About ₹3,400 for the parts in the base list: Arduino Uno R3 (CH340 clone), 4-DOF acrylic robot arm kit, MG90S or SG90 servos × 4, PCA9685 16-channel servo driver, TCS34725 colour sensor, IR obstacle sensor module, XL4015 buck (servo 5 V 3 A), 12 V 2 A DC adapter, Coloured blocks and three bins.
How long does it take?
About 12 weeks for the base project, built on an Arduino Uno. Each upgrade adds time.
Which branches is it suitable for?
Mechanical / Mechatronics, Electronics and Communication, Electrical and Electronics, as a major project.
Which pins and design calculations does it use?
PCA9685 SDA / SCL on A4 / A5 (0x40); TCS34725 on the same bus (0x29); Servo channels base / shoulder / elbow / gripper on PCA9685 ch 0 / 1 / 2 / 3, V+ from the 5 V 3 A buck; IR object sensor on D2. Worked calculations on this page: inverse kinematics (planar), servo pulse from angle, colour decision, supply.
How do I test it?
40 blocks in four colours: Success rate and wrong bins. Room light vs lamp: Colour accuracy. Target points across the workspace: Placement error in mm. Cycle time: Under 8 s per block.
What are the objectives?
To compute joint angles for a target point with inverse kinematics. To identify red, green, blue and yellow objects reliably under room light. To pick and place each object in its bin within 8 s. To measure placement accuracy and success over 40 picks.
