Raspberry Pi Barcode Scanner


Download Scanner app


Raspberry Pi Barcode Scanner
The "dsreader" Barcode Scanner app is a Raspberry Pi application that easily transforms your Raspberry Pi into a fully functional barcode scanner. All you need is a simple web camera.

This application can be used not only on Raspberry Pi but also on any compatible Linux ARM device, such as Orange Pi.

By combining such a compact Linux device with a barcode scanner, you can create a powerful and versatile system suitable for a wide range of applications. In the following sections, when we refer to Raspberry Pi, we will also mean any other compatible devices.

Decodes all popular barcodes:
Linear:
Interleaved 2/5, Industrial 2/5, Code 39, Code 39 Extended, Codabar, Code 11, Code 128, Code 128 Extended, EAN/UCC 128, UPC-E, UPC-A, EAN-8, EAN-13, Code 93, Code 93 Extended, DataBar Omnidirectional (RSS-14), DataBar Truncated (RSS-14 Truncated), DataBar Limited (RSS Limited), DataBar Stacked, DataBar Expanded, DataBar Expanded Stacked.
2D:
PDF417 (Compact, Micro)
QRCode, Micro QRCode
DataMatrix
Aztec Code

See tutorial on YouTube

Getting Started

For this example, we will perform all actions from the Linux terminal running directly on the Raspberry Pi.

Download "dsreader" app

pi@raspberrypi ~ $ wget http://datasymbol.com/download/dsreader.zip

The file 'dsreader.zip' will be saved in the current folder on the Raspberry Pi.



Unzip "dsreader"

pi@raspberrypi ~ $ unzip dsreader -d scanner

Extract all files into the 'scanner' folder (you can choose any other name).



Set execute permissions for 'dsreader'.

pi@raspberrypi ~ $ cd scanner
pi@raspberrypi ~ $ chmod 777 dsreader




Start "dsreader" Barcode Scanner App

pi@raspberrypi ~/scanner $ ./dsreader

If the camera is connected, the scanner will start immediately and can already decode barcodes. If the camera has manual focus, it needs to be adjusted.



Connecting an LED and a beeper

The dsreader application can now control an LED connected to the Raspberry Pi.


pi@raspberrypi ~/scanner $ sudo ./dsreader -l 27

Now, if an LED is connected (in this example to pin 27), it will blink after a barcode is successfully decoded.


Connecting a buzzer


pi@raspberrypi ~/scanner $ sudo ./dsreader -l 27 -b 14




Various settings of the 'dsreader' scanner

pi@raspberrypi ~/scanner $ ./dsreader -h

Usage:  dsreader [OPTIONS]
Example:  sudo dsreader -l 27 -u 50 -s 500 -m 2
Example:  sudo dsreader -v /dev/video1
Options:
  -h --help     Display this usage information
  -d --daemon   run as daemon
                Example: -d
  -v --device   Input video device name (default - /dev/video0)
                Example: -v /dev/video0
  -l --led      Pin number to flash the LED (default - don't use)
                Example: -l 27
  -u --leddur   LED flash duration (in ms) (default - 100)
                Example: -u 200
  -b --beep     Pin number to beep (default - don't use)
                Example: -b 14
  -r --beepdur  Beep duration (in ms) (default - 200)
                Example: -r 200
  -w --width    Video frame width (default - 640)
                Example: -w 320
  -h --height   Video frame height (default - 480)
                Example: -h 240
  -f --frame    Frame time limit in ms, 0-unlimited (default - 200)
                Example: -f 0
  -s --pause    Total pause after decoding (in ms) (default - 800)
                Example: -s 100
  -p --port     TCP/IP port for barcode sending (default - 1234)
                Example: -p 8765
  -m --miss     Skip frames for reduce CPU load (default - 1)
                Example: -m 3



Supports:
Linear: Interleaved 2/5, Industrial 2/5, Code 39, Code 39 Extended, Codabar, Code 11, Code 128, Code 128 Extended, EAN/UCC 128, UPC-E, UPC-A, EAN-8, EAN-13, Code 93, Code 93 Extended, DataBar Omnidirectional (RSS-14), DataBar Truncated (RSS-14 Truncated), DataBar Limited (RSS Limited), DataBar Stacked, DataBar Expanded, DataBar Expanded Stacked.
2D: PDF417 (Compact, Micro), QRCode (Micro), DataMatrix, Aztec Code
Platforms:
Windows 32 & 64, 10(UWP), Phone 8/8.1/10,Windows Mobile, Android, Linux, Raspberry Pi, MacOS, iPhone