
Closed-Loop Manufacturing: Cross-Linking AOI and SMT Machine Telemetry
An optical defect and the machine event that caused it happen minutes apart and live in separate databases. Time-windowing SQL joins close the loop — here is how.
- Published
- April 20, 2026
- Author
- Hrushiekesh Kanjula Reddy
- Read time
- ~6 min
- Category
- engineering

In a traditional manufacturing environment, inspection data and production data live in separate universes. The AOI machine generates defect reports. The SMT placement machine generates telemetry logs. These two data sources have never spoken to each other. Engineers correlate them manually — looking at a defect report, then pulling up the machine log for that hour, then manually checking if anything unusual happened during the time that board was inside the machine.
That process takes 20 minutes per defect investigation. The assembly hub's cross-linkage layer does it in a SQL query.
The Core Challenge: Linking Without a Shared Key
The fundamental problem is that AOI inspection results and SMT machine telemetry don't share a common identifier. The AOI machine doesn't know the machine head ID. The SMT machine doesn't know the AOI defect code. The only shared datum is time — both systems recorded events that happened during the same production window.
This rules out a standard JOIN ON foreign_key. The link has to be temporal: find the machine telemetry that was active during the time window when a specific board was inside the SMT machine.
The Time-Window Join
Every board gets a serial number, and the SMT machine logs an entry_time and exit_time for each board. The AOI inspection records the board's serial number when it's inspected. The query that links them:
SELECT
a.board_serial,
a.defect_type,
a.defect_location,
a.inspection_time,
m.head_id,
m.nozzle_type,
m.error_code,
m.event_timestamp
FROM aoi_defects a
JOIN board_production_windows bpw
ON a.board_serial = bpw.board_serial
JOIN machine_telemetry m
ON m.event_timestamp BETWEEN bpw.machine_entry_time
AND bpw.machine_exit_time
WHERE a.defect_type IN ('TOMBSTONE', 'MISALIGNMENT', 'MISSING_COMPONENT')
AND a.inspection_date > DATE('now', '-7 days');The BETWEEN clause is the time-window join. It says: for this board (which was inside the machine from entry_time to exit_time), find every machine telemetry event that occurred during that window.

Enriching with Component Context
The time-window join produces a list of machine events that coincided with a defective board's production window. That's useful, but it's not yet actionable — you need to know which specific component the machine was working on during each event.
Adding the defect attribution layer from the previous post (the forward-fill CTE) enriches each telemetry event with its attributed component:
WITH attributed_telemetry AS (
SELECT
m.*,
COALESCE(m.component_ref,
LEAD(m.component_ref) OVER (
PARTITION BY m.head_id ORDER BY m.event_timestamp
)) AS attributed_component
FROM machine_telemetry m
),
defect_investigation AS (
SELECT
a.board_serial,
a.defect_location AS aoi_flagged_ref,
a.defect_type,
at.head_id,
at.nozzle_type,
at.error_code,
at.attributed_component AS machine_attributed_ref,
-- Do they agree?
at.attributed_component = a.defect_location AS refs_match
FROM aoi_defects a
JOIN board_production_windows bpw ON a.board_serial = bpw.board_serial
JOIN attributed_telemetry at
ON at.event_timestamp BETWEEN bpw.machine_entry_time
AND bpw.machine_exit_time
WHERE at.error_code IS NOT NULL
)
SELECT * FROM defect_investigation WHERE refs_match = TRUE;When refs_match = TRUE, you have the highest-confidence finding: the component that AOI flagged as defective is the same component that the machine reported an error on during that board's production window. This is a confirmed causal link, not a correlation.

What the Cross-Linkage Reveals
Running this query over a week of production data typically produces a handful of high-confidence findings. In my experience, three patterns emerge repeatedly:
Nozzle-specific component failures. A specific nozzle type consistently shows up in confirmed causal links for tombstone defects on 0402 capacitors. The nozzle's inner diameter is slightly worn — still within spec, but producing inconsistent vacuum on the smallest components. Catching this before the weekly nozzle maintenance cycle means replacing it two days early instead of after it starts dropping parts.
Temperature-correlated misalignments. Cross-linking timestamps with temperature sensor data (also logged by the machine) sometimes reveals that misalignment errors cluster in the first 20 minutes of a production shift — before the machine reaches operating temperature and its thermal expansion stabilizes. A 5-minute warm-up cycle before running serialized boards eliminates the defect cluster.
Pick order interactions. Occasionally, a specific sequence of component picks — placing a large IC followed immediately by a small resistor on the adjacent head — produces placement accuracy issues on the resistor. The inertia from the heavy IC pick affects the head's position when it moves to the resistor. Reordering the placement sequence in the program eliminates the interaction.
None of these insights are visible in the AOI data alone or the machine telemetry alone. They only emerge from the cross-linked view.
The Reporting Dashboard
The cross-linkage queries feed a dashboard in the assembly hub UI that displays confirmed defect-cause pairs in real time. Engineers can click on any board serial number and see its complete production story: which heads placed which components, which telemetry events occurred during its window, and which AOI defects were found — all in one view.

This replaces the 20-minute manual investigation with a 30-second query. Over a production shift with dozens of defects to investigate, the cumulative time saving is substantial. More importantly, it means investigations actually happen — when root cause analysis takes 20 minutes, engineers skip it for minor defects. When it takes 30 seconds, every defect gets investigated and every data point feeds back into process improvement.
Closed-loop manufacturing isn't a product you buy — it's a data architecture you build. The cross-linkage layer is where that architecture delivers its value.