Yes, you can connect a QR Code scanner directly to a computer or PLC via RS232. This is done by connecting the scanner's TX (Transmit) pin to the computer's RX (Receive) pin, and GND to GND, then configuring the device as a standard keyboard wedge. The scanner simulates keyboard input, so no drivers are needed, only correct serial settings.

What You'll Need

  • A QR Code scanner with a DB9 or RJ12 interface (or an RS232-to-USB adapter if the scanner is USB).
  • A computer, PLC, or serial terminal running Windows, Linux, or a compatible industrial OS.
  • A serial communication cable (null modem) or an RS232-to-USB cable.
  • Configuration software (like PuTTY, Tera Term, or a PLC HMI) to test the connection.
  • A Phillips head screwdriver (if opening the scanner housing to check wiring).

Step-by-Step

  1. Identify the Scanner's Connector Type. Most industrial QR scanners use a 9-pin DB9 male connector, often color-coded. USB scanners use a rectangular USB port. Ensure you have the correct cable (DB9-to-DB9 for direct connection, USB-to-DB9 for PC connection).
  2. Prepare the Serial Cable. If using a straight-through DB9 cable, you must make a null modem crossover. Connect Pin 2 (RX) on the PC side to Pin 3 (TX) on the scanner side. Connect Pin 3 (TX) on the PC to Pin 2 (RX) on the scanner. Connect Pin 5 (GND) to Pin 5. All other pins can be left unconnected or tied together.
  3. Physically Connect the Device. Plug the serial cable into the QR scanner. If the scanner has a power supply, connect it. If it is powered by the serial line (self-powered), ensure the cable is connected before turning on the host device.
  4. Configure the Host Device. On the host computer or PLC, open the serial communication settings. The most common settings are:
  • Baud Rate: 9600, 19200, or 115200 (check the scanner's manual; 9600 is standard).
  • Data Bits: 8.
  • Stop Bits: 1.
  • Parity: None.
  • Flow Control: None (software flow control, like XON/XOFF, is rarely used for simple wedge scanners).
  1. Test the Connection. Open a terminal program like PuTTY. Select the correct COM port. Click "Open". Point the QR scanner at a QR code. If successful, the decoded data (e.g., a URL or text) will appear in the terminal window.
  2. Configure the Scanner (if needed). Many scanners allow you to change the output format (e.g., add a trailing newline character). This is usually done by scanning a configuration barcode found in the scanner's manual or quick start guide. This barcode changes the scanner's internal settings to match your specific application needs.

Common Mistakes

The most frequent error is using a straight-through cable instead of a null modem cable. A straight-through cable sends signals down the same line, which prevents data from flowing between devices. Always verify the pinout or use a null modem adapter. Another common issue is incorrect baud rate. If the host device expects 9600 baud but the scanner is set to 115200, or vice versa, the data will appear as gibberish or be completely unreadable.

Tips

When setting up the connection, it is good practice to set the terminal program to "Echo Local Echo" or enable a visual indicator when data is received. This confirms that data is physically traveling across the serial line. If you plan to use the scanner in a noisy industrial environment, ensure the cable is shielded and the connections are tight. Loose pins or unshielded wiring can cause intermittent drops in communication, leading to missed scans.

Troubleshooting

If the QR scanner does not work, start with the basics. Check that the cable is firmly plugged into both devices. Verify the COM port selection in your terminal software. Ensure the baud rate, data bits, stop bits, and parity match exactly between the sender (scanner) and the receiver (PC/PLC). If the terminal shows garbage characters, the baud rate is likely incorrect.

If the terminal is silent, the issue might be the cable. Swap the RX and TX wires on both ends to create a null modem configuration. If the scanner has a power LED, check if it is on. Some scanners require external power and will not work if only the serial line is connected. If you have access to another computer, try the scanner and cable on that machine to isolate the problem to the device or the software.

Frequently Asked Questions

Do I need to install drivers for a QR code scanner?

No. Most QR code scanners act as a keyboard wedge. They emulate a standard keyboard, sending keystrokes directly to the computer. This means no driver installation is required on the host device.

Can I use a USB scanner with RS232?

Yes, but you need an interface. A standard USB scanner cannot plug directly into an RS232 port. You must use an RS232-to-USB adapter, which acts as a bridge between the two protocols.

What is the Null Modem cable?

A null modem cable is a special type of serial cable that crosses the transmit and receive lines. This allows two DTE devices (like a computer and a scanner) to communicate directly without the need for a third device, like a modem.

How do I change the output format of the scanner?

You change the output format by scanning a configuration barcode. These barcodes are unique to each manufacturer and model. Scan the barcode corresponding to your desired setting, such as adding a carriage return or changing the delimiter character.

What does Baud Rate mean?

Baud rate is the speed of data transmission. It is measured in bits per second. For example, a Baud rate of 9600 means the scanner sends 9600 bits of data every second. Both devices must agree on this rate for communication to work.

Why is my scanner sending data to the wrong window?

Since scanners simulate keyboards, they send data to whatever window currently has focus. Ensure your terminal program is the active window or that the software you are using for data entry is open and ready to receive input.