Smart Manufacturing

IoT Quality Control in Manufacturing: Real-Time Checks with In-Line Sensors and MQTT

Learn how in-line sensors, gauges and test stations publish measurements over MQTT for real-time quality checks, how to design topics and payloads, and how the same data feeds SPC and traceability.

IoT quality control manufacturing line with in-line sensors and gauges publishing measurements to a cloud MQTT quality dashboard
Run this on your own MQTT brokerGet a private, managed MQTT broker on the Free plan and start from ready-made code samples.
Try it free Code samples No card required

IoT quality control in manufacturing means measuring product and process quality continuously at the line, instead of discovering problems at final inspection or from a customer complaint. This guide shows which in-line sensors to use, how to publish their measurements over MQTT, how to run real-time specification checks and how the same data stream feeds statistical process control and traceability.

From Sampling to Continuous Quality Data

Traditional quality control relies on sampling: an inspector takes a few parts per hour, measures them in a lab or at a gauge station, and writes the results into a spreadsheet or a quality system. It works, but it has well-known weaknesses. Problems that start between samples run unnoticed until the next check. Results arrive late and are hard to link to the exact process conditions that produced the part. And the data rarely reaches the people who could act on it in time.

Connected quality control changes three things:

  1. Coverage. In-line sensors and automatic gauges measure every part or a high share of parts, not a handful per shift.
  2. Latency. Results are available within seconds, so the line can be stopped or adjusted before the next hundred parts are made.
  3. Context. Each measurement travels with the part serial number, the machine, the recipe and the process parameters, which turns defects into explainable events.

Where Quality Data Comes From

Source Typical measurement Interface Notes
Digital gauges and calipers Dimensions USB, Bluetooth, RS-232 Cheap way to digitise manual checks
Laser and optical sensors Thickness, width, position, gap Analog, IO-Link, Ethernet Measures every part at line speed
Vision systems Presence, defects, labels, dimensions Ethernet, often with built-in MQTT or TCP output Pass/fail plus measured features
Checkweighers and scales Weight and fill Serial or Ethernet Standard in food and pharma
Leak, pressure and torque testers Test values and pass/fail Serial, Ethernet, PLC tags End-of-line functional tests
Process sensors Temperature, pressure, flow, speed PLC or edge gateway Explains why quality changed
Environmental sensors Humidity, room temperature Wireless sensors Matters for adhesives, coatings, food

The last two rows are easy to overlook. Quality problems are almost always caused by process conditions, so capturing temperature, pressure or line speed alongside the measurement is what makes root-cause analysis possible later.

An MQTT Architecture for IoT Quality Control in Manufacturing

MQTT fits quality data well because one measurement usually has several consumers: the line display, the quality engineer's SPC dashboard, the traceability database and possibly the MES. With publish/subscribe, the gauge publishes once and every consumer subscribes independently. The what an MQTT broker does article explains the pattern in detail.

A typical flow:

  1. Sensors, gauges and test stations connect to an edge gateway (a PLC, an industrial PC with Node-RED, or a small Python service).
  2. The gateway adds the part serial number, station, recipe and timestamp, and publishes one message per measurement or per part.
  3. A quality service subscribes, checks each value against specification limits and publishes a verdict.
  4. A historian or database subscriber stores everything for SPC and traceability.
  5. Dashboards subscribe to live values and verdicts.

Topic design

Follow an ISA-95 style hierarchy and separate raw measurements from verdicts:

acme/plant1/assembly/line3/station40/quality/measurement
acme/plant1/assembly/line3/station40/quality/verdict
acme/plant1/assembly/line3/station40/quality/spec        (retained)

Publishing the active specification as a retained message is a useful trick. Every consumer that connects immediately learns the current limits for that station, and a recipe change only requires publishing a new spec.

Payload design

{
  "ts": "2026-10-16T09:31:07.412Z",
  "serial": "A3-2610-004812",
  "recipe": "HOUSING-B",
  "characteristic": "bore_diameter_mm",
  "value": 22.012,
  "unit": "mm",
  "gauge": "G-40-1",
  "process": {"spindle_temp_c": 31.4, "coolant_temp_c": 21.8}
}

Include the serial or batch ID in every message, use explicit units, and keep one characteristic per message or a clearly named object of characteristics per part. Avoid positional arrays whose meaning lives only in someone's head.

Real-Time Specification Checks

The simplest useful quality service compares each value with its lower and upper specification limits and publishes a verdict. The Python example below (paho-mqtt 2.x) keeps specifications in retained messages, so changing a limit never requires a restart. It runs against the public test broker; replace the prefix with your own unique ID.

import json
import paho.mqtt.client as mqtt

PREFIX = "connectmq/demo/b6a0e4/line3"
specs = {}  # station -> {characteristic: {"lsl":..., "usl":...}}

def on_connect(client, userdata, flags, reason_code, properties):
    client.subscribe(f"{PREFIX}/+/quality/spec", qos=1)
    client.subscribe(f"{PREFIX}/+/quality/measurement", qos=1)

def on_message(client, userdata, msg):
    station = msg.topic.split("/")[4]
    data = json.loads(msg.payload)

    if msg.topic.endswith("/spec"):
        specs[station] = data
        print("spec loaded for", station, data)
        return

    limits = specs.get(station, {}).get(data["characteristic"])
    if limits is None:
        verdict = "no_spec"
    elif limits["lsl"] <= data["value"] <= limits["usl"]:
        verdict = "pass"
    else:
        verdict = "fail"

    out = {"ts": data["ts"], "serial": data["serial"],
           "characteristic": data["characteristic"], "value": data["value"],
           "verdict": verdict}
    client.publish(f"{PREFIX}/{station}/quality/verdict", json.dumps(out), qos=1)
    if verdict != "pass":
        print("NOT PASS", out)

client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2, client_id="qc-checker-b6a0e4")
client.on_connect = on_connect
client.on_message = on_message
client.connect("broker.connectmq.com", 1883, keepalive=60)
client.loop_forever()

Publish a specification and a measurement from the command line to test it:

mosquitto_pub -h broker.connectmq.com -p 1883 -i spec-b6a0e4 -q 1 -r \
  -t "connectmq/demo/b6a0e4/line3/station40/quality/spec" \
  -m '{"bore_diameter_mm": {"lsl": 21.990, "usl": 22.020}}'

mosquitto_pub -h broker.connectmq.com -p 1883 -i gauge-b6a0e4 -q 1 \
  -t "connectmq/demo/b6a0e4/line3/station40/quality/measurement" \
  -m '{"ts":"2026-10-16T09:31:07Z","serial":"A3-2610-004812","characteristic":"bore_diameter_mm","value":22.012}'

For simple limits you can skip code entirely: the ConnectMQ portal's threshold alert rules can watch a numeric field and log every excursion in the alerts log. The code-based service becomes useful when limits depend on recipe or when verdicts must be published back for other systems.

Beyond Pass/Fail: Catching Drift Early

A part inside specification can still be a warning. If bore diameters are creeping toward the upper limit because a tool is wearing, pass/fail checks stay green until the first failure. Statistical process control solves this by watching the process behaviour rather than individual parts, detecting trends, shifts and increased variation while every part still passes. The real-time SPC tutorial builds control charts on top of exactly this measurement stream.

Process-side signals help too. A rising bore diameter that correlates with spindle temperature points to thermal growth; one that correlates with cut count points to tool wear monitoring as the fix.

Traceability Comes for Free

Because every message carries a serial number, storing the stream in a database gives you a quality record per part: which station measured it, with which gauge, under which recipe and process conditions. When a defect is found at a customer, you can answer "which other parts were made under the same conditions" in minutes. The manufacturing traceability system guide covers the database side, genealogy and event design.

Implementation Checklist

  1. Start with one critical characteristic on one station, ideally one that already causes scrap or complaints.
  2. Digitise the measurement with a connected gauge or sensor; avoid retyping values.
  3. Attach context at the edge: serial, recipe, station, gauge ID, timestamp.
  4. Publish with QoS 1 so measurements are not silently lost on network hiccups.
  5. Publish specs as retained messages per station and recipe.
  6. Add a verdict service and show results at the line within seconds.
  7. Store everything in a database for SPC and traceability; the broker is a transport, not an archive.
  8. Secure it: private broker credentials, TLS, and the MQTT security best practices applied to every gateway.

Hosting the Quality Backbone

Quality data is business critical and often confidential, so the public demo broker is only for experiments. In production, a managed MQTT broker gives every station authenticated, encrypted access without you running broker servers, and the ConnectMQ portal's live topic explorer makes it easy to verify that every station is publishing what you expect. For the plant-wide context, read the smart manufacturing guide.

Run Your Quality Data on ConnectMQ

ConnectMQ provides a private MQTT 5 broker with TLS, retained messages, QoS 1 and 2 on paid plans, a live topic explorer and threshold alert rules. Create a broker on the free Serverless plan at app.connectmq.com, no credit card required, and connect your first quality station today.

Frequently Asked Questions

What is IoT quality control in manufacturing?

It is the use of connected sensors, gauges and test stations to measure quality continuously at the line, with results shared in real time with operators, engineers and quality systems.

Which protocol should quality stations use?

MQTT works well because one measurement can be consumed by dashboards, SPC, databases and the MES at the same time without point-to-point integrations.

Do I need to measure every part?

Not always. Measure every part where automatic sensors make it cheap, and digitise manual sampled checks elsewhere. The biggest gain often comes from attaching context to each measurement.

How is this different from SPC?

Specification checks judge individual parts as pass or fail. SPC watches process behaviour over time and detects drift and shifts before parts fail.

Related articles

OEE vs TEEP vs OOE: Which Metric Should You Use?

OEE, OOE and TEEP share the same performance and quality factors but measure against different time bases. This comparison works through one example and lists the MQTT signals each metric needs.

7 min read

All articles →

Your private MQTT broker is a few clicks away

Create an account, get your broker credentials and connect your first device — no servers to install, patch or scale.