# New firmware for our pick & place, and a placement error cut by a factor of five | OneStack

> Case study: we replaced the controller firmware of a desktop pick & place to run it with OpenPnP. It now assembles our prototypes.

URL: https://www.onestack.it/en/case-studies/pick-and-place-openpnp

[← All case studies](/en/case-studies)In-house R&D · lab

# New firmware for our pick & place, and a placement error cut by a factor of five

Our lab started with a closed, imprecise desktop pick & place. We replaced its controller firmware to run it with OpenPnP and calibrated it nozzle by nozzle. It is still the machine we assemble prototypes on.

![3D render of a pick-and-place controller board: STM32F4 microcontroller, stepper motor drivers and connectors for axes, vacuum, lights and feeders](/_astro/controller-pnp.3whQaHFS_ZhBMRk.webp)![](/_astro/controller-pnp-xray.CMO0PqBP_1JH2KI.webp)

0.194 → 0.036 mm

placement error, before and after calibration

0402

passives placed automatically

Architecture after the conversion

**Assembly files**BOM and coordinates from CAD

**OpenPnP on the PC**jobs · fiducials · vision

**USB cameras**top and bottom

**Controller firmware**STM32F4 bare-metal · G-code over UART

**Mechanics**axes · Z cam · vacuum · feeders

## Context

Our lab started with a desktop pick & place. The machine had closed firmware, could only be programmed from its touch screen and had no link to a PC. Every board had to be set up by hand, and the accuracy was not enough for the smallest passives.

## The problem

Replacing the firmware of a working machine means touching motors, vacuum and cameras without any documentation from the manufacturer. A mistake can brick the machine or damage the head. And once reprogrammed, accuracy depends on calibration: a motion model off by a few hundredths of a millimetre is enough to move an 0402 off its pads.

## Technical choices, and why

**Backup first.** We saved the original firmware and checked the memory protection before writing anything, so the conversion stayed reversible.

**Bare-metal firmware that speaks G-code.** We started from an open-source project for the STM32F4 controller and extended it. The machine receives G-code on the serial port that used to drive the display, and a PC running OpenPnP becomes its control panel: jobs come straight from the CAD files.

**Cam-driven Z axis handled in firmware.** The two nozzles share a single motor that turns a cam. The controller converts between linear height and rotation, so for OpenPnP the axis is an ordinary one.

**New cameras and bottom vision.** The original cameras processed images on board and could not be accessed. We replaced them with USB cameras: each part is photographed on the nozzle and corrected in position and rotation before it is placed.

**Nozzle-by-nozzle calibration.** The residual error was not random: the two nozzles shifted parts in opposite directions. We measured it at 12 angles, corrected each nozzle separately, and moved the camera focus to the placement height.

## How we verified it

-   Placement error measured with the machine camera after each correction round, on real pads and parts.
-   Repeatability of the fiducial check on the board.
-   A verification pause after each alignment during tuning, with a re-measurement on the same part.

## Result

The placement error went from **0.194 to 0.036 mm**, below the camera resolution, with passives down to **0402**. It is still the machine we assemble prototypes on: jobs start from the design files, with nothing set up by hand.

## What we bring to your projects

Bare-metal firmware on STM32, motor and actuator control, serial protocols, and the method we used to find the error: measure, separate the causes and fix them one at a time.

## Services

-   Firmware development

## Technologies

-   STM32F4
-   Bare-metal
-   G-code over UART
-   OpenPnP
-   Bottom vision
-   Per-nozzle calibration

## More case studies

[

![3D render of the control board: microcontroller in the centre, connectors for the two isolated channels on the side, pluggable terminal blocks and power and service connectors](/_astro/interfaccia-rugged.CkQk4iYb_1A6Ozp.webp)![](/_astro/interfaccia-rugged-xray.CZb6dpZZ_Z1kxhOu.webp)

23 tests in ~75 s

Systems for harsh environments

### A rugged interface that updates in the field and never bricks

A portable, battery-powered unit that powers and controls two remote devices over isolated channels. The hard part was making it reliable far from any lab. Its firmware updates in the field and, if something goes wrong, rolls back on its own to the last working version.

Read the case →

](/en/case-studies/rugged-interface-secure-ota)[

![3D render of the measurement bench: the sensor under test and three boards inside a black anodised aluminium housing, with two BNC connectors and an M12 connector](/_astro/banco-sensore-capacitivo.DpjM9RDJ_2dpT9y.webp)![](/_astro/banco-sensore-capacitivo-xray.CdoncSBR_Z1LXalp.webp)

~1.4%

Test systems for high-reliability applications

### The test method would not have worked. We found out before building it

A bench that tells in seconds whether an electric-field sensor works, measuring capacitances of a few picofarads in air. The method planned at the start was ruled out with measurements, before any money went into hardware.

Read the case →

](/en/case-studies/capacitive-sensor-test)[

![3D render of the Bluetooth Channel Sounding anchor board: nRF54L15 SoC with chip antenna, accelerometer, power from USB-C or a 12–24 V terminal block](/_astro/ancora-ble.Ckke5SRn_1319HC.webp)![](/_astro/ancora-ble-xray.yah8tbey_Z2nf2oG.webp)

3 layers

Retail and large public spaces

### Indoor localization in shopping centres, without collecting personal data

Counting and following people flows in large public spaces, and locating with centimetre precision only what needs it. A three-layer architecture, each layer with the right radio technology.

Read the case →

](/en/case-studies/indoor-localization)

## Got a deadline?

Tell us about your project: within 48 hours you get a proposal with phases and dates. If needed, we sign an NDA before seeing your files.

[Request a proposal](/en/contact)[Urgent? Call +39 030 535 7183](tel:+390305357183)
