Linux Reads Bar Codes
Bar codes printed on machine-readable labels simplify automatic identification of various things. The Linux kernel device driver module developed by Hewlett-Packard provides serial port access to an HP handheld wand-style bar code reader. An interface circuit is presented for connecting the wand to a PC serial port, and we develop software for reading the Bookland bar code. The Bookland bar code is used in the book trade for encoding the International Standard Book Number (ISBN). Because Bookland and the Universal Product Code (UPC) both use the European Article Number (EAN) bar code patterns for encoding decimal digits, it turns out that our software also decodes the UPC, widely used for groceries and other retail merchandise.
The Hewlett-Packard HBCS-A300 Bar Code Wand (Figure 1) brings out a 3-wire serial interface consisting of two power lines and a signal line. When provided with +5 Vdc power and ground, the open-collector signal line can be pulled up with a resistor to the positive rail so that it becomes a TTL-compatible logic level output. As the wand moves over a bar code pattern, the output signal from the wand is low for a white bar, high for a black bar. This logic level signal does not swing negative, and therefore is not RS-232-compatible. As it turns out, however, it doesn't have to be. Inside a PC, the RS-232 signal and control lines typically are connected to a 1489-type bipolar-to-TTL signal translator called an RS-232 receiver. Information from the wand passes correctly through a 1489-type signal translator because the signal translator's threshold voltages are +1 and +2 volts when the IC's response control pin is left open, as it normally is. In that configuration, the translator operates as an inverting buffer for TTL-compatible signals. A white-level input signal below +1 volts translates into TTL-compatible high at the UART input pin, while a black-level input signal above +2 volts translates into TTL-compatible low.
The wand cable is equipped with a DIN connector that Hewlett-Packard describes as a 5-pin connector. It is really a 6-pin DIN connector with the center pin omitted. Sometimes this kind of DIN connector is described as a 5-pin ``240 degree'' connector. The ``other'' 5-pin DIN connector, such as on the PC/AT keyboard, is the one you will get if you are not careful what you ask for; it has five pins arranged in a 180-degree arc. The socket that matches the Hewlett-Packard wand is a 6-pin DIN socket, such as Mouser catalog number 16PJ224, or Digi-Key 275-1020-ND.
Surplus bar code wands obtained from Electronic Goldmine, and also from All Electronics, had the DIN connector wired differently from the pin-out given in Hewlett-Packard's data sheet. Both pin-outs are shown in Figure 2. Different wiring could have been the result of engineering change or possibly manufacturing snafu. In any case, once the power and signal lines had been identified and properly connected, the surplus wands worked the same as new.
The wand responds to light and dark bars. A nonreflecting black bar results in a logic high (+5 volt) level output, while a reflecting white space results in a logic low (ground level) output. There is, however, more to the story. That quick description implies static behavior, but the wand's response is not static at all. Light-source control and light-sensor signal processing circuits located inside the wand appear to be identical to the circuit diagrammed in Hewlett-Packard's data sheet for the 24-pin special-purpose HBCC-0500 integrated circuit (see Figure 3). That circuit creates dynamic behavior. Whenever the wand sees no transition, either white to black, or black to white, it times out after a short delay, and the output reverts to the low (white) level. It turns out that this behavior simplifies processing of the video signal received from the wand. The timeout expires after a very short delay, so there is high probability that the output signal will be in a known state, the low (white) state, when the wand is first picked up to begin a scan. In our software, this timeout feature is also used to detect abnormal termination, such as occurs when the wand is lifted off early or stopped in the middle of a bar code. Even if the wand is stopped on a black bar the circuit quickly times out and the output reverts to the white (low) level.
Practical Task Scheduling Deployment
July 20, 2016 12:00 pm CDT
One of the best things about the UNIX environment (aside from being stable and efficient) is the vast array of software tools available to help you do your job. Traditionally, a UNIX tool does only one thing, but does that one thing very well. For example, grep is very easy to use and can search vast amounts of data quickly. The find tool can find a particular file or files based on all kinds of criteria. It's pretty easy to string these tools together to build even more powerful tools, such as a tool that finds all of the .log files in the /home directory and searches each one for a particular entry. This erector-set mentality allows UNIX system administrators to seem to always have the right tool for the job.
Cron traditionally has been considered another such a tool for job scheduling, but is it enough? This webinar considers that very question. The first part builds on a previous Geek Guide, Beyond Cron, and briefly describes how to know when it might be time to consider upgrading your job scheduling infrastructure. The second part presents an actual planning and implementation framework.
Join Linux Journal's Mike Diehl and Pat Cameron of Help Systems.
Free to Linux Journal readers.Register Now!
- Paranoid Penguin - Building a Secure Squid Web Proxy, Part IV
- SUSE LLC's SUSE Manager
- Google's SwiftShader Released
- Murat Yener and Onur Dundar's Expert Android Studio (Wrox)
- Managing Linux Using Puppet
- My +1 Sword of Productivity
- Non-Linux FOSS: Caffeine!
- SuperTuxKart 0.9.2 Released
- Parsing an RSS News Feed with a Bash Script
- Doing for User Space What We Did for Kernel Space
With all the industry talk about the benefits of Linux on Power and all the performance advantages offered by its open architecture, you may be considering a move in that direction. If you are thinking about analytics, big data and cloud computing, you would be right to evaluate Power. The idea of using commodity x86 hardware and replacing it every three years is an outdated cost model. It doesn’t consider the total cost of ownership, and it doesn’t consider the advantage of real processing power, high-availability and multithreading like a demon.
This ebook takes a look at some of the practical applications of the Linux on Power platform and ways you might bring all the performance power of this open architecture to bear for your organization. There are no smoke and mirrors here—just hard, cold, empirical evidence provided by independent sources. I also consider some innovative ways Linux on Power will be used in the future.Get the Guide