Explainer
Why a badge scanner reaches a Click PLC through a host device
Short answer
A contactless badge reader such as the HID Omnikey 5025CL presents itself to a computer over USB, not to a PLC serial or Ethernet port, so the C2-03CPU cannot receive it directly. Put a small computer or gateway in between: it runs the reader driver and passes one credential value with a new-read flag over Modbus, and the Click consumes each read once with an edge-detected handshake.

On this page
A contactless badge reader does not plug into a Click PLC, and no ladder trick changes that. The HID Omnikey 5025CL is a USB smart-card reader: it presents itself to a computer, which enumerates it and pulls the card data. The C2-03CPU carries RS-232, RS-485 and Ethernet ports but no USB host that can run a card-reader driver stack, so a direct connection is not there to configure. Put a small computer or gateway between reader and PLC: the host captures the badge, writes one credential value plus a new-read flag to the Click over Modbus TCP, and ladder consumes each read exactly once.
The standards a badge reader speaks #
Badge readers reach their host over a short list of interfaces: USB in CCID mode, USB keyboard emulation, or Ethernet on the models that offer it. The Omnikey 5025CL's documented host interface is USB. Under the USB-IF CCID device class specification, the reader enumerates on the bus as a smart-card slot, and the host drives the card through it by exchanging APDU command-and-response pairs; the PC/SC specification defines the host-side interface an application uses to reach that slot. Those are computer jobs: a USB host controller, an operating-system driver, an application holding a card session. A PLC has a scan engine and fixed protocol roles, not an application layer where a reader driver installs. The decision falls straight out of the standards: whatever receives this reader must run a computer's software stack.
What the C2-03CPU ports accept #
The C2-03CPU documentation lists one RS-232 port on an RJ12 connector (Port 2), one RS-485 port on three pins (Port 3), a 10/100 Ethernet port on RJ45, WiFi LAN and Bluetooth on this CLICK PLUS model, a micro-B USB port for programming, an option slot and a microSD slot. Ethernet traffic runs over TCP and UDP, and the hardware manual notes EtherNet/IP is available on RJ45 ports only. Nothing in that list enumerates a CCID reader, and the serial ports expect devices that speak their documented serial protocols, Modbus RTU among them. Wiring the reader's plug to the RJ12 or the three-pin terminal is an electrical and protocol mismatch, not a shortcut, and no ladder logic repairs it. Treat compatibility as proven only when both manuals document the same interface and protocol — the same trap as assuming a shared network card proves a logger will talk to a Do-more PLC.
The host device between reader and PLC #
The working architecture has four steps:
- The reader presents each badge to its documented host: a computer with the USB port and the reader's driver.
- The host formats the credential to the data contract, or validates it if your rules put that check at the host.
- The host writes the credential and a new-read flag to the PLC. For a Click, that is a Modbus TCP write of two 16-bit registers and a bit — the same exchange pattern as reading a CLICK PLC float over Modbus TCP in an HMI.
- The PLC applies the machine's authorization and sequence logic to the value and answers with an acknowledge bit.
The host can be the panel PC that already runs visualization at the machine, or a computer that lives in the cabinet for exactly this job: an industrial mini PC reads the badge over USB and talks Modbus TCP to the Click with no screen attached. If a reader model offers an Ethernet host mode speaking a protocol the Click accepts, the computer's job shrinks to format checks and heartbeat; most readers have no such mode, so plan for the computer.
The data contract and the ladder handshake #
Fix four fields before writing rungs:
- Credential: two 16-bit registers holding facility code and card number, mapped to consecutive addresses on the Click's Modbus server.
- NewRead: one bit the host sets on each new complete read.
- Ack: one bit the PLC sets once it has consumed a read.
- Heartbeat: a register the host increments on a fixed interval, for example once per second, so the PLC can alarm when it stops changing.
The handshake then runs: the host writes the credential and sets NewRead; the PLC detects NewRead with a rising-edge one-shot, latches the two registers into a 32-bit integer, compares it against the authorized list, and sets Ack; the host sees Ack and clears NewRead and the credential registers; the PLC sees NewRead fall and resets Ack. The edge detection is what makes one badge fire one event — a value sitting in a register cannot retrigger anything.
Worked example, using the common 26-bit badge format as the encoding: an 8-bit facility code spans 0 to 255 and a 16-bit card number spans 0 to 65,535, so credential = FC × 65,536 + CN. A badge with facility code 12 and card number 34,567 gives 12 × 65,536 + 34,567 = 786,432 + 34,567 = 820,999. The worst case is 255 × 65,536 + 65,535 = 16,777,215, which fits a 32-bit signed integer of maximum 2,147,483,647 with 128 times the headroom, so the combined encoding is safe; keeping the two registers separate and comparing them as a pair works too.
Commission it boundary by boundary #
- Reader at its documented host, before the PLC is involved: confirm a badge produces a complete, repeatable credential value every time.
- Host to PLC with a fixed test value: confirm the Click receives both registers without truncation, word swap or character conversion.
- Handshake: confirm one badge produces exactly one PLC event and the next badge processes independently.
- Failure behavior: power-cycle the host and the PLC separately and confirm the link returns to a known state, with no stale read replayed as a new authorization.
When something fails, keep the boundaries separate: reader-to-host, host-to-PLC, then PLC logic. Changing reader settings and ladder at the same time hides the fault.
The decision for each case #
Case 1, a USB CCID reader such as the Omnikey 5025CL: the computer host is mandatory. Run the reader's driver there, transfer the credential with the new-read flag over Modbus TCP, and edge-detect in ladder. Case 2, a reader set to keyboard emulation: any host that accepts keystrokes works, and the PLC-side contract is unchanged. Case 3, a reader with an Ethernet host mode in a protocol the Click's ports accept: the host job reduces to format checks and heartbeat, and the handshake stays. Case 4, a direct wire from the reader to the RJ12 or the three-pin serial port: rejected, because the interfaces do not match.
Where the accept-or-reject decision lives is the same question as whether an HMI needs a PLC or can talk to I/O directly; for machine access, put the comparison in the PLC and let the host relay only the value. Keep the badge path a standard-control data link: an emergency stop or a guarded-access function stays on its own safety-rated hardware, and the badge handshake must not carry it.
Questions asked
What changes if the reader is set to keyboard emulation instead of CCID?
The host no longer needs a smart-card driver stack, so any device that accepts keystrokes, such as a panel PC with a text field focused at the reader, can capture the badge. Read the value from the text field, format it per the data contract, and keep the same new-read flag, acknowledge bit and edge-detected handshake in the PLC. Confirm the reader's emulation mode and its terminator character in the reader manual before you depend on the capture.
What if a second badge arrives before the first handshake finishes?
The host must refuse to overwrite a read still in flight: it does not set the new-read flag again while that flag is waiting for the acknowledge. Count or log the skipped badge so the event is not silently lost, and keep the PLC's credential registers at the last complete read. If your gate legitimately sees badges faster than one handshake, move the accept decision into the host instead of the PLC.
Why does the received credential arrive as the wrong number or garbage characters?
Look for word-order and representation mismatches: a two-register value can arrive with its words swapped, and digits sent as ASCII characters arrive as their character codes rather than their numeric value. Capture one test badge, write down the bytes the host sends, compare them register by register with what the Click received, and correct the swap or the conversion in the host before touching the ladder.
Can a badge reader connect to the Click's Ethernet port directly?
Only if the reader itself is offered with an Ethernet host mode in a protocol the Click's Ethernet ports accept, such as a Modbus TCP server role, and its manual documents that role with its port numbers. Most badge readers, including USB models like the HID Omnikey 5025CL, have no Ethernet host interface, so plan on the computer host regardless. Do not treat a reader and PLC sharing a switch as compatibility.


