← back to projects
Project 01 · Robotics · Machine Vision

Gift Box Packing Cell

A Dobot M1 Pro SCARA, two conveyor belts and a USB camera that pack Christmas gift boxes: one card and two candies go into each box, then the lid. Built by a team of three in Applied Robotics Project II at HAMK, Robotics Laboratory B118.

In progress · Oct 2026 – nowTeam of 3Python 3.11YOLO11nRoboDKDobot TCP/IP
Watch the demoSource on GitHub
The cell in the lab
The cell in Robotics Laboratory B118: M1 Pro on its base, object belt in front, box belt behind, camera above.
01 — Highlights

Results on the real cell

64.4 sfastest full box: card, two candies and lid, 100 % speed, no pauses (18 Nov 2026)
4 / 23boxes filled and closed / runs started on the real cell, 17–18 Nov
0.92 mmcamera-to-robot calibration mean error over 5 marks
0.99 / 1.00YOLO11n precision / recall on the validation set (mAP50 0.99, mAP50-95 0.89)
9 checksin the safety gate before the robot may move, one-time arm token per run

Four boxes is a small sample, and the V1 pass criterion is not yet agreed with the teacher. The numbers above are from the logged runs in testing/live_runs/.

02 — Demonstration

The cell at work

Pick and place on the real cell. The robot picks the card from the object belt with the vacuum cup and places it in the open box on the box belt. The candies follow the same way, then the lid. Video recorded in the lab during week 3 (Enamul Choton).

Fastest logged box, run 20261118_100236. Every real run writes a CSV log with each robot command and reply, every detection and the camera pictures. The cycle below is read straight from that log:

WAIT_BOX3.4 sFEED6.2LOOK8.2PICK candy 19.9 FEED18.4LOOK23.1PICK card24.8 FEED33.5LOOK37.4PICK candy 238.8 CLOSE_LID47.0RELEASE_BOX53.0BOX_DONE64.4 s

ONE BOX, STEP BY STEP · CAMERA PICTURES FROM THE RUN LOG

6.2 s: box arrived and standing still
6.2 s

Box arrived at the slot and is standing still.

6.5 s: object belt running
6.5 s

Object belt runs until the needed items reach the pick area.

9.9 s: look, pick candy 1
9.9 s

Look: red candy found, turn −86°. Candy 1 of 2.

24.8 s: look, pick the card
24.8 s

Look: white card at (195.9, −49.3) mm, turn −89°.

38.8 s: look, pick candy 2
38.8 s

Look: second candy, turn −87°. Then the lid at 47.0 s.

56.0 s: closed box
56.0 s

Closed box. The camera watches it leave; done at 64.4 s.

03 — How it works

System overview

USB cameraabove both belts
→
YOLO11ncard, candy, box, lid
→
Homographypixel → robot X/Y, 0.92 mm
→
cell_livestate machine, safety gate, log
→
Dobot M1 ProTCP 29999 / 30003
→
DO1–2 vacuum · DO3/4/16 beltTB6600 stepper driver
  1. The box belt brings an open box until an E18-D80NK sensor stops it. It runs on its own Arduino UNO R4 WiFi.
  2. The camera checks that the box is standing still at the taught box slot.
  3. The robot starts the object belt with its digital outputs. It stops when the items the box still needs are in the pick area.
  4. The robot moves out of view. YOLO finds the card and candies, and the homography turns pixels into robot coordinates.
  5. The robot picks each item with the vacuum cup, turns it to the box angle and places it, then puts the lid on.
  6. An operator takes the closed box away and the next box comes in.

Safety gate. Before the robot can move, the software checks a speed cap, the teacher’s approval (name and date), taught points within reach, calibration, vision model, output wiring, an operator at the e-stop, and the J1 range for the path home. Passing the gate issues a one-time arm token that is used up by that single run.

Operator console. A browser console at 127.0.0.1:8765 shows device checks, the live camera with detections, the cycle state and the run logs.

Simulation first. The same cycle runs offline with simulated devices or in a RoboDK station of the cell, so the logic was tested before the robot moved.

Operator console, overview page
Operator console, overview page
Operator console during a run
Operator console during a run
RoboDK station of the cell
RoboDK station of the cell
04 — Machine vision

Detection and calibration

YOLO11n trained on 147 lab images and validated on 22, four classes: card, candy, box and lid. Pixel positions are mapped to robot X/Y with a homography fitted on five calibration marks that the robot touched. When the camera turned 6.3° in its holder, a view correction re-fitted the calibration without recalibrating.

YOLO validation predictions
YOLO validation predictions
Confusion matrix, validation set
Confusion matrix, validation set
Training curves, 2026-11-14
Training curves, 2026-11-14
Early detection test on single items
Early detection test on single items
Calibration marks seen by the camera
Calibration marks seen by the camera
Teaching the calibration marks with the robot
Teaching the calibration marks with the robot
Item angle measured for the turn before placing
Item angle measured for the turn before placing
All four classes detected on the belts
All four classes detected on the belts
05 — Hardware

What the cell is made of

PartModel / detail
RobotDobot M1 Pro, 4-axis SCARA, reach 400 mm, J1 ±85°
GripperVacuum cup on DO1, blow-off on DO2
Object beltDTCB conveyor, stepper motor, TB6600 driver. DO3 start/stop, DO4 direction, DO16 enable
Box beltDTCB-2418-0718 conveyor, Arduino UNO R4 WiFi, E18-D80NK proximity sensor
CameraUSB RGB camera above the belts. An Arduino Nicla Vision was tested first and dropped for low image quality
PCWindows 11 laptop, Ethernet to the robot, TCP ports 29999 and 30003
Robot placing a candy in the box
Robot placing a candy in the box
Box belt with stepper driver and sensor
Box belt with stepper driver and sensor
Belt electronics before the enclosure
Belt electronics before the enclosure
06 — Engineering

Problems found on the real cell

J1 joint limit

The first pick faulted: a straight move from home needed J1 at about 90°, the M1 Pro allows ±85° (controller alarm 23).

fix: route home → above box slot → item

Box slot off by 78 mm

Items were placed beside the box. The taught slot did not match the box position.

fix: slot taught again, camera confirms the box

Camera moved 6.3°

The camera rotated in its holder between sessions, so pixel-to-robot mapping drifted.

fix: view correction re-fits the calibration

Lid step

Some runs paused near the 375 mm reach limit and the lid does not always close fully.

status: open, next on the list
07 — Team

Who did what

Sazzad Ibna Mahfuz

Integration & software

Integrated the robot, conveyors, camera and vision into one working cell. System architecture, RoboDK simulation, cell control software (cell_live), safety gate, operator console, run logging, supervised runs on the real cell.

Rashmika Ruwanpathirana

Hardware

Robot tests, belt wiring and drivers, box belt Arduino, electronics enclosure design.

Enamul Choton

Vision

OpenCV, YOLO dataset and training, camera-to-robot calibration, taught points.

Supervisor: Leo Li, HAMK.

08 — Next

Road to the final demo

← BackAll projects Next project →Refrigerator Control on a Beckhoff PLC