Build a Pick-and-Place Robot That Knows It Missed
An arm that picks parts from a tray and sorts them into two bins, detects an empty grasp, retries, and logs how many cycles it got right.
What you are building
An arm that empties a tray. Parts go in one of two bins depending on something you can tell about them — size, colour, which fixture they came from — and the machine runs unattended until the tray is empty or something goes wrong, at which point it stops and says which state it stopped in.
The robot is not the interesting part. Four-DOF arm kits are £40 and the kinematics are a page of trigonometry. The interesting part is that a pick-and-place machine is judged on a percentage, and getting from “it worked on video” to “it did fifty in a row” is a different engineering problem from getting it to move at all.
Two things get you there, and both are in the gripper.
The two decisions that matter
1. The finger must not be stiff
This is the one that surprises people, so it is worth stating plainly before you print anything.
Your gripper’s knob is a position — a servo angle. The object’s limits are forces: a floor below which it falls out, a ceiling above which it is destroyed. The exchange rate between them is the series stiffness k of everything between the horn and the object, so the window you actually have to aim at is
window (mm) = ( min(F_crush, F_servo) − F_slip ) / k
A rigid printed finger is around 25 N/mm. A hobby servo on a 30 mm lever arm resolves about 0.524 mm of jaw travel. Run the numbers for a strawberry and the window is 0.108 mm — five times finer than one step, which means there is no command that works and no amount of tuning finds one.
| Finger | k | Window | Servo positions that work |
|---|---|---|---|
| Rigid printed | 25 N/mm | 0.108 mm | 0 |
| Foam pad | 4 N/mm | 0.677 mm | 1 |
| Spring in series | 0.8 N/mm | 3.386 mm | 7 |
| Printed flexure | 0.35 N/mm | 7.739 mm | 15 |
Put a 40p extension spring between the horn and the finger and the problem goes away. Size yours in the lab with your own object and your own lever arm before committing filament, and read servo gripper force, stall and compliance for the full argument.
2. There has to be a verify step
The cycle is approach, descend, grasp, verify, lift, transfer, place. Without the verify state, every failure is silent: the gripper closes on nothing, the arm carries air across the table and opens over the bin, and the counter says it worked.
A lever microswitch on the inside of one finger costs fifty pence and one input pin, and it is the single highest-value part in this build. Read it after a 300–400 ms dwell — a compliant finger rings after closing and sampling during the ring gives you a coin flip — debounce it across three consecutive readings, and give the state machine a RECOVER state with a bounded retry. The state machine tutorial has the whole thing.
The build, in order
- Decide the end effector. If your parts are flat and reachable from above, price a suction cup and a small pump first — it will beat anything you print. Otherwise, two fingers. Gripper types and grip force.
- Measure your object. Mass on a kitchen scale, crush force on the same scale with a few sacrificial parts, μ with a luggage scale dragged across the pad material. These three numbers decide the design, and the ones you find online are wrong for your part.
- Check force closure. If the faces where the pads land are tapered more than
atan(μ), nothing you do with force will hold it, and you need a V-groove or a different grasp point. Friction and force closure. - Size the gripper in the lab. Lever arm from the widest object, then check the window against the servo step. The gripper simulator.
- Print the gripper with a flexure or a spring in series, TPU pads, a hard stop, and a microswitch. Servo gripper.
- Wire five servos properly. PCA9685 over I²C, separate servo rail, decoupling. Do this before you write firmware or you will spend a day debugging resets that are a power problem.
- Write the state machine, non-blocking, with
VERIFYandRECOVER. Pick-and-place state machine. - Bound the acceleration with a motion profile, so the grip you sized survives the transfer.
- Run fifty and count.
The measurement
Fifty consecutive cycles, unattended, with a counter and a fault log that records which state each failure happened in. That is the deliverable, and it is much more demanding than a video.
| Result | What it means |
|---|---|
| Above 95% | You have a machine. Move on to sensing the pose rather than hard-coding it |
| 80–95% | Usually the approach pose, or not enough settle time before the verify |
| Below 80% | Usually power, or a grip sized without the acceleration term |
| Fails late in the run only | Servo heating, or pads getting dirty. Both are real and both look like ghosts |
The failure table in the state machine tutorial maps most symptoms to causes.
What this project is not
It does not do vision, and it does not plan around obstacles. The tray is in a known place, the bins are in known places, and the arm goes where it is told. That is deliberate — the point of this build is that grasping is a separate, harder-than-it-looks problem from positioning, and conflating the two is why first pick-and-place builds stall.
When you want the arm to find the part rather than be told where it is, that is camera calibration and marker pose, and it sits on top of a working pick cycle rather than replacing one.
Project roadmap
The build path
Follow the tech tree from parts to a robot that follows a taped line. Each node unlocks when its prerequisites are done, and your progress saves on this device.
0 / 21 done
Components
- Chassis4-DOF Robot Arm KitThe acrylic or metal frame that turns four servos into a base-shoulder-elbow-gripper manipulator.
- ActuatorServo GripperOne servo, two fingers, and the one number nobody on the listing tells you.
- ActuatorSG90 Servo MotorThe nine-gram servo behind most robot arms, grippers, and steering.
- DriverPCA9685 Servo DriverDrive 16 servos over two I²C pins—the board behind most robot arms and hexapods.
- ControllerArduino UnoThe forgiving 8-bit board most people meet robotics through.
- SensorLever MicroswitchThe one bit of sensing that tells a robot it has already hit something.
- PowerRobot Battery & Power PackThe difference between a robot that runs and one that keeps resetting.
Tutorials in this path
- Beginner · 30 minRobot Gripper Types and How to Size Grip ForcePick the gripper type, then size the force with the term everyone forgets: acceleration.
- Intermediate · 25 minFriction, Force Closure and Why Two Contacts Is a BetWhy the object squirts out however hard you squeeze, and what the friction cone actually says.
- Intermediate · 30 minServo Gripper Force, Stall and Why Compliance WinsThe knob is a position, the walls are forces, and stiffness is the exchange rate between them.
- Intermediate · 35 minA Pick-and-Place State Machine That Survives FailureApproach, grasp, verify, lift, place — and what to do when the verify says no.
- Advanced · 22 min readInverse Kinematics of a Two-Link Robot ArmWhy a two-link arm has two solutions, where it can and cannot reach, and what a singularity really is.
- Intermediate · 18 min readDrive Servos with the PCA9685 (I²C PWM Driver)Set the frequency, turn angles into pulse widths, and move sixteen servos from two I²C pins — safely powered and calibrated.
- Intermediate · 40 minMotion Profiles: Trapezoidal and S-Curve AccelerationRamp a move instead of commanding it — trapezoidal profiles, jerk limits, and what S-curve actually costs.
- Beginner · 17 min readFinite-State Machines for Robot BehaviorReplace tangled robot conditionals with explicit states, events, transitions, timeouts, and recovery.
- Beginner · 30 minWhy Your Robot Resets When the Motors StartThe reset that looks like a code bug is almost always the battery. Budget the current, then measure the sag.
- Beginner · 30 minWhy delay() Breaks Robots: Timing With millis()A robot sitting in delay() is blind. Replace it with millis(), and get the rollover comparison right.
Practise before you wire
Tune it in the live simulator
The build path routes through a browser lab. Find gains that follow the track cleanly here, then transfer them to the real robot.
Frequently asked questions
What is the hardest part of a pick-and-place build?
Not the arm and not the kinematics — it is that the gripper commands a position and the object cares about a force. With stiff printed fingers the usable window between dropping a part and crushing it works out around a tenth of a millimetre, while one step of a hobby servo moves the jaws about half a millimetre. No command lands in the window. The fix is a spring or a flexure in series, which opens the window in proportion to 1/k, and it is the decision that makes or breaks the whole project. Size it in the gripper simulator before you print anything.
Why does my robot arm drop the part when it moves?
Because you sized the grip for the weight and the move needs more. Required grip force is m(g + a)·SF/(μ·n), and on a brisk arm the acceleration term is bigger than gravity. A grasp that holds 58 g standing still at 1.63 N needs 1.93 N through a 250 mm lift in 0.9 s and 2.59 N if you do it in 0.35 s — and it lets go about 40 ms into the move, before the arm has visibly travelled, which is why it reads as the gripper failing rather than as arithmetic. Bound the acceleration with a motion profile or grip harder; usually the profile is the cheaper fix.
How do I know whether the gripper actually picked something up?
A lever microswitch on the inside face of one finger, wired to an input pin with a pull-up. About fifty pence, one wire, and it is a direct digital answer. Put it on the compliant part of the finger so it trips at a repeatable force, debounce it in software (three consecutive readings, not one), and read it after a 300–400 ms dwell so you are not sampling the finger's ring. Current sensing also works and additionally catches a crush, but it needs a calibrated threshold and it drifts as the battery sags.
Do I need inverse kinematics for this?
Not strictly — you can teach poses by hand and store the joint angles, and for a fixed tray and two fixed bins that is genuinely enough. You need IK the moment you want a straight-line approach and retreat, because those are Cartesian moves and hand-taught joint angles will not give you one. Since diving at a part from an angle knocks it over and lifting along a curve drags it, most builds end up wanting the straight segments, and that means IK.
How many servos and how much power?
Five: base, shoulder, elbow, wrist and gripper. That is more channels than an Uno should be timing itself, so use a PCA9685 over I²C. Power is the part people underestimate — five hobby servos moving together pull several amps of inrush, and the board's 5 V regulator will brown out and reset the controller mid-pick. Give the servos their own supply with a common ground and a few hundred microfarads near the board.
What counts as done?
Fifty consecutive cycles with a counter and a fault log, unattended. That is a far better target than a video of one successful pick, because it forces you to build the verify step, the bounded retry and the power supply that does not sag — which are exactly the three things that separate a demo from a machine. Below 95% there is always one specific cause, and the log tells you which state it failed in.