Project · Engineering

Cork Sorting Machines

Industrialisation of 3 cork sorting machines: controller firmware, embedded inference, API and React interface.

Ref.
02.01
Period
2025 - 2026
Status
Completed
Organization
Verréo
Stack
  • C++
  • Python
  • React
  • ONNX Runtime
  • Docker

Key points

  1. 3 machines taken from contractors' prototypes to production-ready systems.
  2. Hardware-triggered capture + inference pipeline (1–5 cameras, <100 ms per camera).
  3. HID camera drivers and an error-checked serial protocol.

Context

ReyCorks is a Verréo project that sorts used wine corks so they can be recycled by material.

The corks are collected in bins like this one (Fig. 1), then go through sorting machines that photograph each cork and route it by material: natural, agglomerated or synthetic.

During my internship I built the classification model. This contract was about the machines around it.

Fig. 1A ReyCorks collection bin, where the corks start.
A wooden collection bin with a window, full of used corks

Fig. 1A ReyCorks collection bin, where the corks start.

Three machines

Three machines had been delivered by contractors as proofs of concept: they worked in a demo, not for hours on a production floor. My job was to make them reliable enough for production, and I rewrote their software from scratch, from the firmware to the operator's screen.

  • The POC (Video 1): corks placed by hand pass under the camera.
  • The pre-industrial machine (Video 2): one cork at a time through a lit tunnel.
  • Picasso (Video 3): a feeder bowl lines the corks up on a conveyor.
Video 1The POC
0:00 / 0:00

Video 1The POC

Video 2The pre-industrial machine
0:00 / 0:00

Video 2The pre-industrial machine

Video 3Picasso
0:00 / 0:00

Video 3Picasso

I can only show the machines from the outside: the mechanics belong to Verréo and its partners. The software is what I owned.

From cork to decision

Each machine follows the most basic pattern in industrial sorting: detect, analyse, decide (Fig. 2).

Fig. 2Detect, analyse, decide: the same loop on all three machines.
Three boxes in a row linked by arrows: Detection, Analysis, Decision

Fig. 2Detect, analyse, decide: the same loop on all three machines.

  1. Detection. A controller drives the mechanics and sees when a cork is in place. It triggers the capture on 1 to 5 cameras, depending on the machine, through camera drivers I wrote (HID).
  2. Analysis. An embedded computer classifies the images, in under 100 ms per camera.
  3. Decision. The class goes back to the controller, which sends the cork to its bin. The two talk over a serial protocol I designed with error checking, so a corrupted message is detected instead of acted on.

The loop is fully asynchronous: while one cork is being analysed, the next ones are already detected and photographed, so several corks are in the machine at once. That is how it keeps up with at least one cork per second.

Software

Around that loop, I optimised the software by isolating what the sorting needs from everything else.

Isolation

Critical parts apart

Detection, analysis and decision run on their own: the rest of the software can stop or restart without stopping the sorting.

Deployment

Containers

Each service runs in its own container. The three machines run the same stack, and an update is easy to deploy and roll back.

Operator

Web interface

A backend API and a React interface, opened in a browser, to start the machine, follow it and adjust it.

Faster models

The classification models had to keep up with the line. I exported them, quantised them (INT8) and optimised them for inference: 40 ms per image on a CPU, 2 to 3 times faster than before.

In production

Figures from a recent session on the pre-industrial machine, as the operator's interface reports them.

65/min

Corks per minute

99%

Average confidence

99%

Corks above 80 % confidence

82%

Manufacturers identified

Corks the machine cannot place (2 % here) go to a default output instead of a wrong bin.

#embedded#computer-vision#full-stack#industrial