

The Waveshare Barcode Scanner is a compact and efficient device designed to read and decode barcodes. It is capable of scanning both 1D and 2D barcodes, making it versatile for a wide range of applications. This scanner is commonly used in retail, inventory management, logistics, and embedded systems. It can interface with microcontrollers, such as Arduino, Raspberry Pi, or computers, to transmit scanned data for further processing.








The Waveshare Barcode Scanner typically uses a 4-pin interface for UART communication. Below is the pinout:
| Pin | Name | Description |
|---|---|---|
| 1 | VCC | Power supply input (3.3V to 5V) |
| 2 | GND | Ground connection |
| 3 | TXD | Transmit data (output from the scanner) |
| 4 | RXD | Receive data (input to the scanner) |
For USB communication, the scanner uses a standard USB interface and does not require manual pin connections.
To use the Waveshare Barcode Scanner with an Arduino UNO, follow these steps:
Wiring:
VCC pin to the Arduino's 5V pin. GND pin to the Arduino's GND pin. TXD pin to the Arduino's RX pin (digital pin 0). RXD pin to the Arduino's TX pin (digital pin 1).Upload Code: Use the following Arduino sketch to read barcode data and display it in the Serial Monitor.
// Waveshare Barcode Scanner Example Code
// This code reads data from the scanner and displays it in the Serial Monitor.
void setup() {
Serial.begin(9600); // Initialize Serial communication at 9600 bps
Serial.println("Waveshare Barcode Scanner Ready");
}
void loop() {
// Check if data is available from the scanner
if (Serial.available() > 0) {
String barcodeData = ""; // Variable to store the scanned data
// Read all available characters from the scanner
while (Serial.available() > 0) {
char c = Serial.read(); // Read one character
barcodeData += c; // Append character to the string
delay(5); // Small delay to ensure all data is read
}
// Print the scanned barcode data to the Serial Monitor
Serial.print("Scanned Data: ");
Serial.println(barcodeData);
}
}
TXD pin directly to a 3.3V microcontroller without a level shifter if the scanner is powered at 5V. No Data Received in Serial Monitor
Scanner Not Powering On
VCC and GND pins are properly connected and the power source provides adequate voltage.Unreadable or Garbled Data
Scanner Fails to Read Barcodes
Q1: Can the scanner read barcodes from a screen (e.g., smartphone)?
A1: Yes, the Waveshare Barcode Scanner can read barcodes displayed on screens, provided the screen brightness and contrast are adequate.
Q2: How do I change the scanner's baud rate?
A2: The baud rate can be changed by sending specific configuration commands to the scanner. Refer to the manufacturer's manual for detailed instructions.
Q3: Is the scanner compatible with Raspberry Pi?
A3: Yes, the scanner can be connected to a Raspberry Pi via UART or USB. Use the appropriate GPIO pins or USB port for communication.
Q4: Can the scanner decode custom barcode formats?
A4: The scanner supports standard 1D and 2D barcode formats. Custom formats may not be supported unless they conform to standard encoding schemes.
By following this documentation, you can effectively integrate and use the Waveshare Barcode Scanner in your projects. For advanced configurations, refer to the manufacturer's user manual.