Label printer and barcode reader

Label printer and barcode reader
Y. Shimaki (June 15, 2015)
Last modified: /Users/MasahiroYAMANAKA/orochi-devel/documentation/OrochiBarcode/report.
tex on 2015-06-15 16:39
Abstract
Hot to set up label printer and barcode reader for client computer is described in this document.
Contents
1
INTRODUCTION
1
2
BARCODE READER
1
3
LABEL PRINTER
3.1 Tepra . . . . . . . . . . . . .
3.2 Sisyphus for Medusa on Win32
3.3 Orochi label . . . . . . . . . .
3.4 Tepra duplicate . . . . . . . .
2
2
3
3
3
4
History
1
INTRODUCTION
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
4
Supported software and hardware are shown in Table 1. Install Ruby for Windows to c:/Ruby21/1 .
Table 1: Supported software and hardware
software/hardware vendor / product
OS
Microsoft Windows 7
web browser
Mozilla Firefox
label printer
King Jim’s TEPRA with SPC 10
barcode reader
Code Reader 2.0 or 3500
Perl
Cygwin
Ruby
Ruby for Windows 2.1.5
2
BARCODE READER
Device Configure a barcode reader using setup-codes shown on Figure 1. To let barcode reader know Bluetooth address of host computer, you have to prepare a device-connection code. Find 6-byte Bluetooth-address
of the computer (e.g., 28-37-37-22-B8-55). Visit vendor’s web http://www.codecorp.com/bdaddr.php#
bdaddress and enter 12-digit numbers that you got (28373722B855). Print the code and hang it around the
computer. First time you connect the scanner to the computer, you have to pair the device with passcode
12345678.
1
You may have Ruby on Cygwin too. In that case you have two Ruby systems. Ruby on Cygwin is not supported by Orochi.
1
(a) M052_01 (b) M418_02 (c) M188_02(d) M261_01(c) M188_02(e) M170_04 (f) M746_01(c) M188_02
Figure 1: Setup-codes for barcode reader: (a) Clear All CodeXML Rules (b) Reset RS232 Factory Defaults
(c) Save Settings (d) QR Code On (e) Set Suffix to CR+LF (f) Enable Auto Save Last Bluetooth Address;
There are more options. For example, you can change time duration before sleeps . See manual for detail.
Computer Add a COM port to Windows by following steps. Go “Bluetooth Devices” in Control Panel and
click “Bluetooth Settings”. Then go “COM Ports” tab and click “add.” Create a port with “incoming” property.
Typically “Serial Port Name” of the new port is COM4. Clear all ports to avoid confusion when necessary.
Also remove all “Code Reader” related icons from “Devices and Printers” in Control Panel when necessary.
Note that communication between software and scanner consists of two steps, that are scanner↔COM4 and
COM4↔software. The former is via Bluetooth and latter has nothing to do with Bluetooth. In other word,
software does not know if the input is from Bluetooth.
You can check Bluetooth connection by “Tera Term” (http://sourceforge.jp/projects/ttssh2/).
Launch it and try to monitor input from the serial port. If the software recognizes the port dedicated for
Bluetooth connection, scan the device-connection code. If asked, pair the device by typing the passcode. The
scanner is supposed to beep once. If it beeps multiple times (like four), try to scan the code again. Scan a
barcode on your stone. You will see input from the scanner at console of “Tera Term.”
The port should be described in a configuration file. Orochi applications refer to ˜/.orochirc as of
November 8, 2014. The port COM4 should be expressed as serial_port: /dev/ttyS3 in the file. Note that
device number in cygwin is one less than COM number.
3
LABEL PRINTER
Install device driver and program “SPC 10” provided by King Jim. Change system locale to Japanese
during installation. Before go into next steps, make sure you can print something using from the software. A
botched setup will likely make you miserable for quite some time.
3.1
Tepra
Installation Orochi applications print label using Ruby gem named tepra. Install the gem as shown below.
DOS > gem source -a http://dream.misasa.okayama -u.ac.jp/rubygems/
DOS > gem install tepra
DOS > gem update tepra
The program will be installed on somewhere appropriate. Check where it is. Issue following command to have
test label.
DOS > which tepra
/cygdrive/c/Users/dream/bin/tepra
DOS > tepra print "1234567890 ,Allende"
Failure is because the program cannot find printer. This often happens when printer is connected on Wi-Fi
instead of USB. Identify name of the printer on SPC 10 such as KING JIM SR5900P-NW. Put it to a configuration file ˜/.teprarc. A line should look like :printer: KING JIM SR5900P-NW. On November 11
(2014), TK encounters a situation that SPC 10 requires restart.
Label-print from Android App The program tepra works as label-print server for Android App ‘Sisyphus’. When tepra is launched without argument, it runs web server on http://localhost:8889/. Create
a shortcut of tepra.bat and place it in ˜/AppData/Roaming/Microsoft/Windows/StartMenu/Programs/
Startup/. Acess to http://localhost:8889/ by Firefox and print URL with barcode so that the Android
App can be configured quickly. The URL will look like http://192.168.11.103:8889/. Place the label
2
onto the label printer. On the Android App, push ‘Configuration’ tab. Push ‘Label’ subsection and set the URL
by scan of the code. Not you have to let PC have same IP address. Ask network administrator if necessary.
Label-print from Firefox on PC When tepra is launched with option print with argument of existing
*.csv, it prints labels as shown below.
DOS > type mystones.csv
1234567890 ,Allende
3456789098 ,Vigarano
DOS > tepra print mystones.csv
During record browsing on Medusa, to click “label” icon initiates download *.csv. To print label from
web browser, the CSV file should be deflected to tepra print. As of March 22 (2015), we setup web
browser in following manner.
1. Create BAT file with single line tepra print %1
2. Convert the BAT file into EXE file by third party’s utility Bat_To_Exe_Converter
3. Correlate CSV file and the EXE file on Firefox’s Options
3.2
Sisyphus for Medusa on Win32
To create a record in Medusa and have a label at the same time, you use web application sisyphus. Install
it via Ruby gem named sisyphus-for-medusa. Functionality that this tool provide is subset of those by
Android App ‘Sisyphus’. If the Android App is working great, this tool is not that useful.
DOS > gem source -a http://dream.misasa.okayama -u.ac.jp/rubygems/
DOS > gem install sisyphus -for -medusa
DOS > gem update sisyphus -for -medusa
DOS > which sisyphus
/usr/local/bin/sisyphus
DOS > sisyphus
A program named sisyphus will be installed to somewhere appropriate. The program is a web server that
runs on http://localhost:8888/. Check where it is by which sisyphus and launch it. Access to it by
web browser. On creation of a record, you have a label automatically.
Create a shortcut of sisyphus.bat and place it in ˜/AppData/Roaming/Microsoft/Windows/StartMenu/
Programs/Startup/. We recommend to create a bookmark to http://localhost:8888/ and keep in
Bookmarks Toolbar on Firefox.
3.3
Orochi label
To creates a label with stone-ID, use an utility orochi-label. It takes stone-ID as an argument and obtains
stone-name from Medusa. Then it tosses them to an external program tepra. This is useful when you do not
know name of stone but ID.
$ orochi -label
20110119154409 -142 -363
# = > tepra print "20110119154409 -142 -363 ,Heaven"
When failed to resolve, it creates a label without name.
$ orochi -label
19999999999999 -999 -999
# = > tepra print "19999999999999 -999 -999 ,19999999999999 -999 -999"
The program reads a configuration file ˜/.orochirc. The file should look like below.
uri: dream.misasa.okayama -u.ac.jp/demo
user: admin
password: admin
3.4
Tepra duplicate
To duplicate a label, use an utility tepra-duplicate. The program duplicates label using barcode reader and
label printer. It tosses letters obtained by barcode reader to external program orochi-label. This is useful
when you want to place stone’s name and ID on notebook.
3
Setup is detailed in help of the program. It is a Perl script and requires a lot of modules. Install them as
shown below2 .
$ perl -e shell -MCPAN
cpan[1] > o conf prerequisites_policy follow
cpan[2] > o conf commit
cpan[3] > install Bundle::CPAN Bundle::LWP Device::SerialPort
4
History
• March 22, 2015: First release
List of Figures
1
Setup-codes for barcode reader: (a) Clear All CodeXML Rules (b) Reset RS232 Factory Defaults (c) Save Settings (d) QR Code On (e) Set Suffix to CR+LF (f) Enable Auto Save Last
Bluetooth Address; There are more options. For example, you can change time duration before
sleeps . See manual for detail. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2
List of Tables
1
Supported software and hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1
You may have several version of Perl on your system. For example, you may have both /usr/bin/perl and /opt/local/bin/perl on
Mac. Invoke appropriate Perl to setup.
2
4