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.
|Non-Linux FOSS: libnotify, OS X Style||Jun 18, 2013|
|Containers—Not Virtual Machines—Are the Future Cloud||Jun 17, 2013|
|Lock-Free Multi-Producer Multi-Consumer Queue on Ring Buffer||Jun 12, 2013|
|Weechat, Irssi's Little Brother||Jun 11, 2013|
|One Tail Just Isn't Enough||Jun 07, 2013|
|Introduction to MapReduce with Hadoop on Linux||Jun 05, 2013|
- Containers—Not Virtual Machines—Are the Future Cloud
- Non-Linux FOSS: libnotify, OS X Style
- Linux Systems Administrator
- Validate an E-Mail Address with PHP, the Right Way
- Lock-Free Multi-Producer Multi-Consumer Queue on Ring Buffer
- Senior Perl Developer
- Technical Support Rep
- UX Designer
- RSS Feeds
- Introduction to MapReduce with Hadoop on Linux
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?