środa, 17 kwietnia 2013

Speed up paper forms processing with CODE39 barcodes and Symbol LS2208 barcode scanner


It's not a discovery that barcodes make life easier. Barcodes can speed up any process that needs to have some data read from paper or package - and this is done by human. But did you know that introducing barcodes in your project could be very easy?

Scenario

Imagine following scenario. There is a process which includes printing a paper document. Then paper document comes from hands to hands. And finally comes to an operator who needs to trigger some job in computer system related to that paper form. For example: the operator needs to open window, look up for data related to paper, complete form, save it.

Looking up for data could be time consuming and could be a place for human mistakes. This is the place where barcodes come in.

Where to start?

Barcodes are quite wide subject - type of codes, standards, generating, control codes, rights to use. This is not article about it. If you're totally new to barcodes, you should get know CODE39 for a beginning - the simplest one. This type of code is a very good point to start as it's very simple to understand, very simple to generate without 3rd-party libraries, recognized by every barcode reader and there are no restrictions to use it. For comparision: EAN13 that could be found on Coca Cola can it's much more complicated story.

All you need to get started with CODE39 is:

  • download CODE39 fonts (ask uncle Google for free ones)
  • get know CODE39 syntax which is very simple (please, read forward)

Code39 syntax and generating barcodes

Generally you can code into CODE39 short alphanumeric strings. Every digit or letter has its representation in exactly one bar code (one font). First and last char in code must be asterisk (*) which means start and stop.



So if you want to have 123456789 coded into CODE39, just add asterisks to get *123456789* and change font to CODE39 font. You may try it with WordPad or Microsoft Word. Now imagine 123456789 is for example document ID or some primary key and you want to add it to Crystal Report form. It simple as to change a font (from Times New Roman to Code39). Ok, deploying fonts into set of computers is another story but you may build an MSI package a deploy it with Group Policy in Windows Server.

Good source to get know CODE39 better is Wikipedia article: http://en.wikipedia.org/wiki/Code_39

Well, well - half of work is done. We have got barcodes with ID-s printed on paper forms. Now it time to read it and to trigger some action.

Scanning barcodes

Let me introduce Symbol LS2208. Symbol LS2208 is simple laser barcode reader. It's ready to work just after unboxing. It is very popular and it costs ca. 100 USD.



Symbol comes as RS232 or USB connected devices. In USB version is great plug and play device as it does not require any drivers. It acts as a second keyboard. This also mean you don't need any SDK nor to recompile your software solution to have it worked with Symbol.

First exercise: print some CODE39 codes from WordPad or Microsoft Word (as described earlier) onto the paper (laser reader cannot read from display). Plug Symbol into USB. Then open Notepad and scan your codes into it.

You will find that barcodes read your 123456789 easily in both directions (I mean you don't worry that someone scan your code upside down). You also find that asterisks (*) are omitted, so you won't need to parse them out. You will also notice that every next scan result is written down in the same line without any separation (123456789123456789123456789).

Symbol LS2208 configuration

Now it's time to tune things up. Best about Symbol is that you can reconfigure its behavior and you can also do it very easy. To do so - open printed manual (or print interesting pages to paper) and scan configuration codes with reader. If you fucked everything up - start again from defaults - just find "Set All Defaults" configuration code in manual and scan it.

Great news about configuring Symbol scanner is that configuration is stored in device flash memory - and not in computer. Once configured it may be plugged into another computer and behaves as expected.

What may be done with configuration codes? I suggest you to study Symbol manual by yourself to find interesting behaviors for your project. Most basic behaviors are: adding prefix and suffix to read code. For example - you want to have sent ENTER key along with your code to your app (so user don't have to touch keyboard after scanning). No problem!

With configuration codes you may filter out some unwanted codes. Let's say you have different type of codes on paper form and you don't want your users to scan improper ones.

Another great feature of Symbol LS2208 is continuous scan. Just place scanner in handler (included in the box) and Symbol starts to light constant red line on the table without need to pull the trigger. Just move your paper form (the barcode section) under the line. Now find in manual set of configuration codes to set some insensitivity to the same code if its scanned twice (when you move your paper back and forth). Do some practice with it to find best time of insensitivity.

Additional tips and sample configuration

In this article I've shown you how to have barcodes printed and read with minimal effort. Last tips: Add CODE39 fonts to your project repository. Prepare scanner configuration as a set of control codes - start with "Set All Defaults", save it as PDF document and also add to your project repository - you will be able to configure second device in seconds.