Code readingExplainer

QR code reader vs barcode reader on an HMI serial link

A QR code reader behaves like a barcode reader on an HMI serial link: same wiring, baud and terminator. What changes is payload length and buffer sizing.

LumaSpec Vision11 min read Share on LinkedIn

On this page 11 sections
  1. 01Same characters out of the port, whatever the symbology
  2. 02How a scan reaches the HMI over serial
  3. 03The two USB modes, and where each fits
  4. 04What QR actually changes: the payload, not the port
  5. 05Worked example: timing a 120-character recipe QR
  6. 06Size the string tag and the recipe around the payload
  7. 07Picking the reader, the port and the cable
  8. 08Checks before you order
  9. 09When the usual answer is wrong
  10. 10Set-up checklist
  11. 11Questions

You want the operator to scan a code on the part and have the HMI load that part's processing data. Your labels are moving from 1D barcodes to QR codes, and the question is whether the panel side changes too. It barely does. At the interface a QR code reader is a barcode reader: it decodes the symbol and sends the payload as plain characters over RS-232 or USB, closed by a terminator. The same cable style, baud rate and terminator settings carry over.

What changes is how many characters arrive — a QR symbol can carry hundreds where a 1D code carries a few dozen — so the string tag, the baud rate and the recipe parsing need to match the longer payload. This page gives the numbers and the settings, then picks the reader, port and cable for each mounting case.

Same characters out of the port, whatever the symbology

Every code reader, 1D or 2D, runs the same chain: an imager captures the symbol, a decoder converts it to the payload, and an output stage pushes that payload to the host as a character string. The panel never sees Code 128 or QR. It sees PART-4711-B3 and a carriage return.

That answers the software question: the barcode-reader function on the panel waits for characters on a port and commits them on the terminator. A QR code reader feeds it exactly the way a 1D scanner does. The port choices are the standard set — RS-232 serial, USB, Ethernet — and you pick them by distance and mounting, not by symbology: handheld readers for the operator-driven case, fixed readers for the station above the part.

How a scan reaches the HMI over serial

The serial frame is the payload characters followed by a terminator, almost always a carriage return (ASCII 13). Some readers ship with a CR LF suffix instead, and the panel can treat the extra line feed as data — set the suffix deliberately, as the CR LF suffix guide shows.

The port settings sit on both ends and must match: baud rate, data bits, parity, stop bits. Readers commonly default to 9,600 baud, 8 data bits, no parity, 1 stop bit; set both sides explicitly instead of trusting the defaults.

Wiring is three conductors: reader transmit to panel receive, ground to ground, and the reverse line if the reader accepts commands. RS-232 stays comfortable to about 15 m at these rates — the original standard guarantees 15 m at up to 20 kbit/s — so keep runs inside that or move to Ethernet. For the wiring walk-through into a PLC-side port, see wiring a barcode scanner RS-232 string to a PLC serial port.

The two USB modes, and where each fits

A USB scanner reaches the host in one of two modes. In HID keyboard mode it types the payload as keystrokes and closes with Enter, so any panel with a USB host port and a text field takes it; the USB barcode scanner on a PLC HMI guide compares keyboard mode with the serial option. Keyboard mode has a known weak spot over remote-desktop sessions, where keystrokes drop or repeat — the keyboard wedge troubleshooting guide covers that case.

In COM-port emulation mode the reader creates a virtual serial port, and the data discipline is exactly the serial discipline: fixed rate, terminator, buffer sized to the payload. Choose it when you want one code path for both a serial reader and a USB reader.

A PLC is the exception to USB keyboard mode: a PLC's USB host port is not a desktop USB stack, and most PLCs cannot take an HID keyboard scanner at all. The why serial still wins on a PLC USB port article sorts out where that port can and cannot be used.

What QR actually changes: the payload, not the port

Payload is the one real difference. A 1D code on a part label carries maybe 10-30 characters — part number, batch, date — because symbol width grows with every character until the label runs out of room. A QR symbol codes in two dimensions, so capacity is set by the symbol version and error-correction level in the QR specification (ISO/IEC 18004): a version 40 symbol at level L holds 7,089 numeric or 4,296 alphanumeric characters. You will not print version 40 on a part, but a version 10 symbol at level L — a 15-20 mm square — still holds 271 numeric or 185 alphanumeric characters, roughly ten times a 1D label code.

1D barcode reader QR code reader
Output to the panel character string + terminator character string + terminator
Typical part-label payload 10-30 characters 100-500 characters
Capacity ceiling label width 7,089 numeric / 4,296 alphanumeric (version 40, level L)
Panel port settings that change none none
String tag to size for 32 characters 128-320 characters
Transfer at 9,600 baud 8N1 ~21 ms for 20 characters 125 ms for 120 characters

The first and fourth rows are identical, which is the whole point. The last two rows are what you engineer.

Serial transfer time follows from the frame:

t = N × 10 ÷ baud rate 8N1 framing: 1 start + 8 data + 1 stop = 10 bits per character

Worked example: timing a 120-character recipe QR

Say the QR on the part carries the recipe itself — part number, eight process parameters and delimiters, 120 characters in total.

At 9,600 baud 8N1: 120 × 10 = 1,200 bits, and 1,200 ÷ 9,600 bit/s = 0.125 s. The string lands 125 ms after the decode.

At 57,600 baud: 1,200 ÷ 57,600 = 0.0208 s, about 21 ms.

At 115,200 baud: 1,200 ÷ 115,200 = 0.0104 s, about 10 ms.

The 20-character 1D code it replaces took 20 × 10 ÷ 9,600 = 20.8 ms at 9,600 baud. A 120-character QR at 57,600 baud therefore feels on the panel exactly like the old 1D code did.

Decision: operator-initiated recipe load — leave the port at 9,600, because 125 ms is invisible next to human reaction time. Scan gating a moving line or a robot pick — set 57,600 baud as the floor so the recipe lands inside a control cycle, and 115,200 where both ends support it.

Size the string tag and the recipe around the payload

Buffer first. The string tag or receive buffer holds payload plus terminator plus any prefix you configured. For the 120-character example that is 121 characters, so set a 128-character tag. If version 10 payloads are on the roadmap, 271 numeric characters plus the terminator means a 320-character tag. Size once from the largest payload you will ever print, not today's.

Then decide what the code carries:

  1. ID plus lookup. The QR holds a part or recipe ID; the panel or PLC looks the recipe up in its own storage. Small symbol, short string, fast read — the default, and the pattern in scan a barcode to select a recipe on your HMI.
  2. Full payload. The QR carries every parameter, split by a delimiter such as a comma or semicolon, and the panel parses fields into tags. No recipe table to maintain, at the cost of the bigger buffer and a parser that ignores partial scans.

Either way the string arrives as one burst closed by the terminator, so the framing rules that keep a serial receive buffer clean are the same as for 1D data; the serial framing guide walks through them.

Picking the reader, the port and the cable

Match the reader to where the scan happens, then the port to the distance.

Handheld at the panel. The operator presents the reader to the part. A wired handheld with a USB interface plugs straight into the panel's USB host port, and the model below is the typical starting point; the handheld code readers include wireless versions for operators who walk the line.

Handheld code readersHikrobot MV-IDH2000P/13NR/05RN/U Industial Wired Handheld Code ReaderMV-IDH2000P/13NR/05RN/U
Interface
USB
Connection
Wired
$179.00View part

Fixed over the part. When the part comes to the station, no operator is needed. At bench distance, the LS-CRD-0047 reads at a 60-120 mm reading distance over USB 2.0; the fixed code readers reach further and carry Ethernet interfaces.

Fixed code readersCompact fixed industrial barcode reader, 1.2 MP, USB 2.0, 60-120 mm reading distance (LS-CRD-0047)LS-CRD-0047
Resolution
Up to 3 MP
Shutter
Global
Interface
USB
$559.00View part

Serial into the panel. When the panel side is a plain RS-232 port and you want COM-port framing, filter the fixed readers by serial interface — the MV-ID6200PM-00C-NNG, for example, is a fixed logistics reader that lists Serial among its interfaces.

Fixed code readersHikrobot MV-ID6200PM-00C-NNG 20 MP logistics code reader, high performanceMV-ID6200PM-00C-NNG
Interface
Serial
Resolution
16-25 MP
Sensor format
1"
Shutter
Global
$5,699.00 · quotedView and quote

The cable. Code-reader cables break the reader's multi-pin connector out to the panel world: the MV-IDA-PE-M12A17pF-openRJ45DB9-HF-5m, for instance, runs 5 m and splits a 17-pin M12 A-coded connector into open leads, RJ45 and DB9, in a high-flex jacket for drag-chain runs. Open ends land on a terminal block or a converter; the DB9 lands on the panel port. The code reader cables list the connector styles per reader series.

CablesHikrobot MV-IDA-PE-M12A17pF-openRJ45DB9-HF-5m Integrated cable, GigE, high-flex, 5 m, 17-pin to open/RJ45/DB9MV-IDA-PE-M12A17pF-openRJ45DB9-HF-5m
Type
Code Reader Cables
$49.00View part
Build the whole station

The configurator matches a camera, lens, light, light controller and cables to each other, step by step, and lists only parts that fit what you already picked.

Start with the camera

Checks before you order

  • Port and mode decided: RS-232, USB keyboard or USB COM-port emulation — one per end, before cabling.
  • Serial settings identical both ends: 9,600 or 57,600 baud, 8 data bits, no parity, 1 stop bit.
  • Suffix: a single CR unless the panel expects CR LF.
  • String tag: payload + terminator + prefix; 128 characters for the 120-character QR, 320 if version 10 payloads are coming.
  • Cable run: inside ~15 m for RS-232; Ethernet interface or converter beyond.
  • Bench test with a known payload: print a 120-character QR and confirm every character and the done flag arrive once per scan — the first-connection checks in fixed code reader setup over USB are the routine. Wrong characters rather than missing ones point to a rate or framing mismatch; the garbage characters guide lists the fixes.

When the usual answer is wrong

  • The payload keeps growing. Stop enlarging the buffer and shrink what the code carries: move the recipe into panel or PLC storage and encode only the ID. The symbol prints smaller and reads faster.
  • The reader sits far from the panel. Past the RS-232 ceiling, serial is the wrong tool — choose an Ethernet-interface reader or a serial-to-Ethernet converter carrying the data as plant tags, as in the serial-to-Ethernet converter guide.
  • The operator scans away from the panel. A wireless handheld with a base station into the PLC serial port keeps the same character discipline; the cordless scanner to a PLC guide covers the base-station wiring.
  • Every PLC serial port is taken. Read the scanner through the HMI and hand the string to the PLC from there — the barcode reader through the HMI guide shows the routing.

Set-up checklist

Work down the bench in this order:

Link

  1. Output mode chosen per end: RS-232, USB keyboard or USB COM-port emulation.
  2. Cable run inside ~15 m for RS-232, or an Ethernet converter selected.
  3. Connectors matched: reader socket, cable, panel port.

Data

  1. Baud, data bits, parity and stop bits set identically on both ends — 57,600 8N1 for QR payloads beyond roughly 50 characters.
  2. Suffix set to a single CR.
  3. String tag sized to payload + terminator, rounded up: 128 for 120 characters, 320 for version 10 payloads.

Proof

  1. A known 120-character QR reads complete, with the panel's done flag set once per scan.
  2. A deliberate miss — reader aimed away — delivers nothing, not a truncated string.

Next step: shortlist the reader in the code-reader finder, pick the breakout cable in the accessories finder, or start at the system configurator and work camera to cable in order. If the panel side is a PLC rather than an HMI, the barcode scanner interface to a PLC guide lays out the same port choice in PLC terms. The rest of the serial-link and recipe-load guides sit on the code-reading topic page.

Questions

Does a QR code reader need different software on the HMI than a barcode reader?

No. The panel's barcode-reader function receives characters and a terminator; it never sees which symbology produced them, so 1D scanners and QR readers share the same port setup. The only software-side change is the string tag length and any recipe field parsing, which follow the payload you encode. Set baud rate, data bits, parity, stop bits and suffix once, and both reader types work through the same tag.

How many characters can a QR code carry compared with a 1D barcode?

A QR symbol tops out at 7,089 numeric or 4,296 alphanumeric characters at version 40 with error correction L. A practical part-marking symbol — version 10 at level L, printed at 15-20 mm — still holds 271 numeric or 185 alphanumeric characters. A 1D code on a part label typically carries 10-30 characters because symbol width grows with the payload. Design the label around the recipe's needs, not around the maximum.

What baud rate should I set for QR data on the serial link?

Match both ends and size for the payload. At 9,600 baud 8N1 a 120-character QR takes 125 ms to transfer; at 57,600 it takes 21 ms. Leave 9,600 in place for operator-initiated recipe loads; set 57,600 or 115,200 on reader and panel when the scan gates a running line. Keep 8 data bits, no parity, 1 stop bit unless the reader's manual states a different frame.

Can I reuse the cable from my old 1D scanner with a 2D reader?

Sometimes. The RS-232 discipline is the same, but three things differ between readers: the connector and its pinout, the electrical level (a TTL-output reader is not RS-232 and needs a converter), and the defaults stored in the reader — baud rate, parity and suffix. Confirm those three against the panel port, and the old run carries the new reader's characters unchanged.

Why does my QR scan arrive truncated at the HMI?

Almost always buffer length, not the reader. The string tag or receive buffer is shorter than the payload, so the tail is discarded. Size the tag to payload plus terminator — 121 characters minimum for the 120-character example, so use 128 or 256 — and confirm the suffix is a single CR. If extra or repeated characters appear instead, the framing rules for the serial receive buffer are the place to look.