Keyence SR Barcode Scanner Siemens PLC PROFINET Communication Setup

Overview: Integrating a Keyence SR series barcode scanner with a Siemens PLC via PROFINET enables high-speed, reliable data capture for track-and-trace, quality inspection, and automated sorting applications. This guide covers the complete setup process, from hardware wiring to PLC program logic.

1. Hardware and Network Requirements

Before starting, ensure you have the following components:

  • Keyence SR-1000, SR-2000, or similar series barcode scanner with PROFINET option (e.g., SR-PN1 module).
  • Siemens S7-1200 or S7-1500 PLC with PROFINET interface (e.g., CPU 1214C or CPU 1511).
  • 24 VDC power supply for the scanner.
  • Ethernet cables (CAT5e or higher) and an industrial Ethernet switch if multiple devices are used.
  • TIA Portal engineering software (V15 or later recommended).

The Keyence SR scanner acts as a PROFINET IO device, exchanging data cyclically with the PLC. The typical data includes decoded barcode strings, read status, and control commands.

2. Installing the GSDML File

Keyence provides a GSDML file that describes the scanner’s PROFINET capabilities. Download the latest GSDML file from the Keyence website or obtain it from the scanner’s configuration tool (SR-HMI or Keyence AutoID Network Navigator).

Steps in TIA Portal:

  1. Open your project and go to OptionsManage general station description files (GSD).
  2. Browse to the folder containing the Keyence GSDML file and select it. Click Install.
  3. After installation, the Keyence SR scanner will appear in the hardware catalog under Other field devicesPROFINET IOBarcode/RFID Readers.

3. Configuring the PROFINET Network

Add the scanner to the PLC’s PROFINET network in the device configuration:

  • Drag the Keyence SR device from the catalog to the network view.
  • Connect it to the PLC’s PROFINET port.
  • Assign a unique device name (e.g., “sr-scanner1”) and IP address in the same subnet as the PLC (e.g., 192.168.0.2).
  • Set the update time according to your application speed requirements (typically 2–8 ms).

The default I/O data modules usually include input words for barcode data (up to 64 bytes) and status, and output words for trigger and control. You can select the appropriate module size based on the expected barcode length.

4. Scanner Parameterization

Use the Keyence setup software (SR-HMI) to configure the scanner’s reading parameters, such as symbologies, trigger mode, and data formatting. Ensure the PROFINET communication settings match the PLC configuration:

Parameter Recommended Setting
IP Address Assignment Set by IO controller (PLC)
Device Name Must match TIA Portal name exactly
Data Format String (ASCII) or raw bytes
Trigger Mode External trigger via PROFINET output bit

5. PLC Programming for Data Exchange

In the PLC program, the scanner’s input and output data are mapped to process image areas. For example, if you configured 64 bytes of input and 4 bytes of output, you can access them using peripheral addresses or transfer them to DBs.

A typical data structure in a Siemens PLC might look like this:

Input Data (from scanner to PLC):

Byte 0–1: Status word (e.g., read complete, error codes)

Byte 2–3: Barcode length

Byte 4–67: Barcode data string (up to 64 ASCII characters)

Output Data (from PLC to scanner):

Byte 0: Control bits (bit 0 = trigger, bit 1 = reset, etc.)

Use the MOVE or BLKMOV instructions to transfer the barcode string into a String data type for further processing. Always check the status bits to ensure valid data before using the barcode content.

6. Testing and Troubleshooting

After downloading the configuration to the PLC, verify the PROFINET connection:

  • Check the LED indicators on the scanner: a solid green Link/Act light and flashing green Status light indicate normal operation.
  • In TIA Portal, use the Online & Diagnostics function to see if the device is reachable and data is being exchanged.
  • Use a watch table to monitor the input data bytes while scanning a test barcode.

Common issues include mismatched device names, incorrect IP configuration, or insufficient I/O data length. Ensure the GSDML file version matches the scanner firmware. If the scanner does not appear in the hardware catalog, reinstall the GSDML file and update the hardware catalog.

Tip: For high-speed applications, consider using the scanner’s buffering mode to avoid data loss. Also, implement a heartbeat or watchdog timer in the PLC to detect communication interruptions.

7. Advanced Integration: Using Data in the Control System

Once the barcode data is reliably received, it can be used for various automation tasks:

  • Product tracking: Compare scanned barcode with a database to verify product identity.
  • Sorting: Use the barcode to route items to different conveyors or stations.
  • Quality control: Log barcodes with timestamps for traceability.

For larger systems, multiple scanners can be connected to the same PROFINET network, each with a unique device name. The PLC can handle several IO devices simultaneously, making it easy to scale up the solution.

By following this guide, engineers can quickly establish robust communication between Keyence SR scanners and Siemens PLCs, enabling efficient data capture in modern industrial environments.

Similar Posts