This repository provides comprehensive sample code and configuration scripts for the Waveshare Barcode Scanner Module. This compact 1D/2D code reader uses advanced image recognition algorithms to decode various barcode and QR formats from paper or screens quickly and accurately.
- Cross-Platform Support: Ready-to-use examples for Arduino, Raspberry Pi, and Raspberry Pi Pico.
- Versatile Decoding: Supports a wide range of 1D and 2D barcode formats (QR, Data Matrix, PDF417, EAN, UPC, etc.).
- Rich Configuration: Scripts to customize LED indicators, buzzer alerts, exposure, sensitivity, and scanning modes.
- Multiple Interfaces: Supports UART, USB, and Keyboard emulation modes.
Waveshare-Barcode-Scanner-Module/
βββ Arduino/ # C++ sketches for Arduino boards
β βββ Read/ # Basic scanning & data reading example
β βββ [1-21]-*/ # Configuration scripts (Baudrate, sensitivity, etc.)
βββ Raspberry Pi/ # Python scripts for RPi (GPIO UART)
βββ RPI PICO/ # MicroPython scripts for Raspberry Pi Pico
βββ Barcode Scanner Module Code Manual.pdf # Technical manual
βββ README.md # This documentation
Use SoftwareSerial to communicate with the module.
- RX (Module) -> Pin 12 (Arduino TX)
- TX (Module) -> Pin 11 (Arduino RX)
- VCC -> 3.3V / 5V
- GND -> GND
Connect via the primary UART (/dev/ttyS0 or /dev/serial0).
- RX (Module) -> GPIO 14 (TXD)
- TX (Module) -> GPIO 15 (RXD)
- VCC -> 3.3V / 5V
- GND -> GND
Note: Ensure UART is enabled in
raspi-config.
Connect via UART0.
- RX (Module) -> GP0 (TX)
- TX (Module) -> GP1 (RX)
- VCC -> 3.3V
- GND -> GND
- Open the Arduino IDE.
- Navigate to
Arduino/Read/Read.inoand upload it to your board. - Open the Serial Monitor (set baud rate to 9600).
- Scan a barcode; the decoded data will appear in the monitor.
- Ensure
pyserialis installed:pip install pyserial - Run the basic reading script or any configuration script:
python "Raspberry Pi/1-Common_Setting.py"
- Flash your Pico with MicroPython firmware.
- Use Thonny IDE or
ampyto upload the scripts. - Run any
.pyfile from theRPI PICOdirectory to configure or read from the scanner.
Both Python and Arduino folders contain scripts numbered 1 to 21 for specific tasks:
- Common Setting: LED, Buzzer, and Mode selection.
- Scan Command: Trigger scan via software command.
- Setting Code: Enable/Disable setting barcode scanning.
- Set Interface: Switch between UART and USB modes.
- Baudrate Set: Change communication speed (Default: 9600). ... and more (see file names for details).
For detailed command formats and advanced protocol information, refer to the Barcode Scanner Module Code Manual.pdf.
This project is open-source. Please refer to the repository's license file for usage terms.
Maintained by Kalpvrux