The Complete Signal Chain: From Light to Digital Data in Barcode Readers |
Executive Summary |
This article provides a comprehensive, accessible exploration of the signal chain in barcode readers---the complete pathway that transforms reflected light into usable digital data. We break down the entire journey, beginning with the optical collection of reflected light from a barcode symbol, following the analog signal through amplification and conditioning, and finally tracing the digitization and decoding processes that extract meaningful information. Rather than focusing on abstract theory, we ground every concept in concrete design examples and real products from industry leaders including Texas Instruments, Microchip Technology, and various pioneering patent holders. We examine how these companies have solved practical challenges like adaptive thresholding, ambient light rejection, edge detection, and reliable decoding in their commercial offerings. The article covers both traditional laser-based scanners and modern imager-based readers, with special attention to the critical analog-to-digital transition points where signal quality is most vulnerable. Throughout, we emphasize the mixed-signal nature of the challenge: how analog and digital processing must work in harmony, and how successful designs master the art of preserving signal integrity through every stage. The closing summary synthesizes the key lessons and offers practical insights for anyone seeking to understand or design barcode reading systems. |

|
Chapter 1: The Signal Chain - A Roadmap of the Electronics |
Before diving into individual circuit blocks, it is helpful to understand the complete signal chain of a typical barcode reader. Think of it as an assembly line where each station performs a specific operation on the signal, gradually transforming raw optical information into clean digital data. |
The chain begins when light reflects off the barcode symbol and is captured by a photodetector. The photodetector generates a tiny current proportional to the amount of reflected light it receives. This current enters the transimpedance amplifier, which converts it into a voltage. Next comes a series of amplification and filtering stages that boost the signal and remove noise. A digitizer then converts the analog signal into a stream of ones and zeros. Finally, a microcontroller or processor measures the widths of these pulses and decodes them according to the barcode standard being used. |
Each of these stages introduces its own challenges. The transimpedance amplifier must handle extremely small currents without adding too much noise. The filters must reject ambient light without distorting the barcode signal. The digitizer must set a threshold that correctly separates black from white, even when the contrast is poor. The microcontroller must accurately measure pulse widths, even when the scanning speed varies. And through it all, the analog and digital circuits must coexist on the same circuit board without interfering with each other. |
This chain is essentially the same whether the reader uses a laser scanner that sweeps a beam across the barcode or an imager that captures a picture of the entire barcode at once. The difference lies in how the light is projected and collected, not in the fundamental signal processing that follows. |
To understand how this chain works in practice, we will examine real-world implementations from leading companies, including the innovative approaches they have developed to overcome the inherent challenges of barcode reading. |

|
Chapter 2: The Photodetector - Converting Light to Current |
Once the light has been reflected from the barcode, it must be captured. The photodetector performs this task, converting optical power into an electrical current. In barcode readers, the photodetector is almost always a photodiode, although some older designs used phototransistors. |
Photodiodes are preferred over phototransistors for several reasons. Their response to light is linear over a wide range, meaning the output current is directly proportional to the incoming light intensity. Phototransistors, while offering higher gain, are notoriously non-linear and suffer from slow response times due to their internal capacitance. As Microchip Technology explains in their application notes on transimpedance amplifiers, the photodiode's output current is tiny---often in the nanoamp range---and must be handled with care. |
Photodiodes can be operated in two modes: photovoltaic and photoconductive. In the photovoltaic mode, the diode is unbiased, and the output voltage is directly related to the light level. This mode offers the lowest noise but is relatively slow. In the photoconductive mode, the diode is reverse-biased, which reduces its junction capacitance and increases the speed, but at the cost of higher dark current---a current that flows even when no light is present. For most barcode readers, which require high-speed response and can tolerate some dark current, the photoconductive mode is the better choice. |
The choice of photodiode also affects the overall performance. The BPW34, a common PIN photodiode, is frequently used in barcode readers due to its fast response and low capacitance. Its active area is large enough to capture sufficient light, and its spectral response is well-matched to red LEDs and laser diodes. |

|
Chapter 3: The Transimpedance Amplifier - The Heart of the Reader |
If any single circuit is the heart of a barcode reader, it is the transimpedance amplifier, or TIA. The TIA takes the tiny current from the photodiode and converts it into a usable voltage. The gain of the TIA is set by a feedback resistor: the output voltage is equal to the photodiode current multiplied by the resistance value. |
The TIA is a classic application of an operational amplifier, but it presents several unique challenges. First, the photodiode's capacitance, combined with the amplifier's input capacitance, creates a pole in the frequency response that can cause instability and oscillation. Second, the feedback resistor itself adds noise, and larger resistors produce more noise. Third, the op-amp must have sufficiently low input bias current and offset voltage so as not to swamp the tiny signal from the photodiode. |
Microchip's application note on transimpedance amplifiers provides a concrete example using their MCP6001U op-amp and a Panasonic PNZ334 PIN photodiode. In this design, the feedback resistor is carefully chosen so that the output reaches a usable voltage at the maximum photodiode current. The challenge is stabilizing this circuit, because the photodiode's capacitance, combined with the amplifier's input capacitance, would otherwise cause peaking and ringing. |
The solution is to add a small capacitor in parallel with the feedback resistor. This capacitor, typically just a few picofarads, compensates for the phase shift caused by the input capacitance and stabilizes the amplifier. However, it also limits the bandwidth. The larger the compensation capacitor, the slower the circuit becomes. There is always a trade-off between stability and speed. |
Texas Instruments has published reference designs for photodiode amplifiers suitable for barcode scanning, achieving bandwidths over one megahertz with single-supply op-amps. These designs use clever techniques, such as applying a small bias voltage, to prevent the output from saturating when no light is present. |

|
Chapter 4: The Analog Signal - From Photodiode to Voltage |
The output of the transimpedance amplifier is an analog voltage that varies with the reflectance of the barcode being scanned. When the beam is on a white space, the reflected light is strong, and the TIA output is high. When the beam is on a black bar, the reflected light is weak, and the TIA output is low. The transition between high and low occurs at the edges of the bars and spaces. |
This analog signal contains all the information needed to decode the barcode. However, it also contains noise and distortion. The signal may be contaminated by ambient light, electrical noise, and variations in the print quality of the barcode. The next stages of the signal chain are dedicated to cleaning up this signal and extracting the information it contains. |
Texas Instruments' TRF7960 RFID reader chip provides an excellent example of how a modern integrated circuit handles analog signal processing. The TRF7960 includes a receiver analog section with multiple inputs, gain stages, filtering with automatic gain control, and a digitizing stage. The receiver input stage is an RF level detector, and the following gain and filtering stages include adjustable bandpass filters with programmable frequency steps. This architecture allows the chip to adapt to different communication standards and signal conditions, a capability that is directly applicable to barcode reading. |
The TRF7960 also includes an RSSI measuring stage, which measures the strength of the demodulated signal. This feature is valuable for determining whether the reader is positioned correctly relative to the barcode and for adjusting the gain to optimize performance. |

|
Chapter 5: The Programmable Gain Amplifier - Adapting to Conditions |
Not all barcodes are created equal. Some are printed with high contrast, while others are faded, damaged, or printed on low-reflectance paper. The distance from the reader to the barcode also varies, affecting the amount of light that is reflected back to the photodetector. To handle this wide range of signal levels, barcode readers often include a programmable gain amplifier, or PGA. |
The PGA is placed after the TIA and allows the microcontroller to adjust the gain of the signal path based on the measured signal strength. The microcontroller typically performs a calibration at the beginning of each scan, measuring the peak-to-peak amplitude of the signal and then adjusting the gain so that the signal fits within the input range of the digitizer. |
Texas Instruments' application notes on this subject describe PGAs that are digitally controlled via a serial interface. The gain can be set in discrete steps, often in 3-dB increments. Some designs use a digital potentiometer in the feedback loop of an op-amp to achieve continuously variable gain. |
The challenge with any gain control is that the gain must be set quickly, before the barcode passes the scanning window. In a handheld reader, the entire barcode may be scanned in less than 100 milliseconds, so the gain must be established within the first few bar widths. This is typically done during the quiet zone at the beginning of the barcode, where no data is encoded. |
The TRF7960's automatic gain control loop is a sophisticated example of this principle. When activated, the AGC continuously monitors the input signal level. If the signal level is significantly higher than an internal threshold, gain reduction is activated. The AGC action is fast, typically finishing after just a few pulses. By default, the AGC action is blocked after the first few pulses to prevent it from interfering with the reception of the remaining data packet. This careful design ensures that the gain is optimized for the beginning of the signal, where it matters most. |

|
Chapter 6: The Digitizer - Converting Analog to Binary |
Once the analog signal has been amplified and cleaned up, it must be digitized. That is, it must be converted from a continuously varying voltage into a stream of ones and zeros that represent the bars and spaces of the barcode. This conversion is performed by the digitizer. |
There are two primary approaches to digitization: the comparator-based approach and the analog-to-digital converter, or ADC, approach. In the comparator approach, the analog signal is compared to a threshold voltage. If the signal is above the threshold, the output is a one; if below, the output is a zero. In the ADC approach, the analog signal is sampled at a high rate, and the resulting digital values are processed by software to determine where the bars and spaces are. |
The comparator approach is simpler and faster, but it requires a good threshold. If the threshold is too high or too low, the digitized output will be distorted. The ADC approach is more flexible because the software can use sophisticated algorithms to determine the optimum threshold, but it requires a fast ADC and more processing power. |
A patent by Tohoku Ricoh Co. describes a classic peak-hold circuit for converting analog signals to digital signals in barcode reading. The peak hold circuit generates an original signal corresponding to the analog signal, a first comparison signal for determining the changing point from black to white, and a second comparison signal for determining the changing point from white to black. The key innovation of this circuit is that it can independently shift the levels of the first and second comparison signals with respect to the original signal, allowing it to adapt to different print conditions and eliminate noise components. |
This approach is particularly valuable when the space portion of the barcode is contaminated or when the bar portion is partially omitted, as often happens with dot-matrix printing. By independently adjusting the threshold levels, the reader can correctly extract the barcode data even in the presence of significant noise. |

|
Chapter 7: The Adaptive Threshold - Finding the Right Level |
The key to successful digitization is setting the threshold correctly. If the threshold is set to 50% of the signal amplitude, and if the signal is perfectly symmetrical, then the digitized output will accurately represent the barcode. But real-world signals are rarely perfect. The threshold must adapt to the signal level, the contrast, and the noise. |
One approach is to use a peak-and-hold circuit to capture the maximum signal level (corresponding to a white space) and a valley-and-hold circuit to capture the minimum signal level (corresponding to a black bar). The threshold is then set halfway between these two levels. This adaptive threshold technique is widely used in commercial barcode readers and is described in many patents. |
A patent by Symbol Technologies describes a barcode scanner with a paper surface detection unit that uses a peak hold circuit to set the threshold for digitization. The peak value is held and then compared to a reference to determine if the reader is scanning a barcode. This technique is part of a broader power-saving scheme, where the LED array is driven alternately when no barcode is present and simultaneously when one is detected. |
Another patent describes a peak hold circuit where the analog signal is voltage-divided by resistors to extract the original signal and comparison signals. By using independently adjustable resistors, the circuit can set different threshold levels for black-to-white and white-to-black transitions. This flexibility allows the reader to adapt to the specific characteristics of the barcode being scanned, such as contamination of the white spaces or omissions in the black bars. |

|
Chapter 8: Hysteresis - Preventing Chatter |
When the analog signal is near the threshold, noise can cause the digitizer output to bounce back and forth, a phenomenon known as chatter. This is particularly problematic at the edges of the barcode, where the signal transitions from low to high or high to low. To prevent chatter, the digitizer includes hysteresis. |
Hysteresis is a technique in which the threshold for switching from low to high is slightly different from the threshold for switching from high to low. If the signal is rising, the output switches at a higher threshold; if the signal is falling, it switches at a lower threshold. This creates a dead zone in which the output does not change, effectively filtering out noise. |
A patent by PSC Inc. describes an adaptive hysteresis circuit for barcode readers. The circuit uses peak detectors to establish the switching thresholds, and it adjusts these thresholds automatically based on the signal amplitude. This ensures that even weak signals are digitized cleanly, without chatter. |
The adaptive hysteresis circuit uses the signal itself to set the thresholds. A positive peak detector and a negative peak detector capture the maximum and minimum signal levels, and a comparator with hysteresis uses these levels to set the switching points. This technique is fast, accurate, and works over a wide range of signal amplitudes. |
The patent also describes a peak separation circuitry that prevents false triggering. If the current sources were allowed to act without limit while the scanner is pointed at blank white paper, the peaks would converge upon a waveform that consists of nothing but a small noise signal. To prevent this, the high peak is allowed to settle on the analog waveform, but the low peak is prevented from getting too close to the waveform, ensuring a clean separation between the two states. |

|
Chapter 9: Differentiation - A Better Way to Find Edges |
Instead of digitizing the barcode signal directly, some readers digitize the derivative, or slope, of the signal. The derivative is zero when the signal is constant, positive when the signal is rising, and negative when the signal is falling. The edges of the barcode correspond to the peaks of the derivative. |
There are several advantages to using the derivative. First, the peaks of the derivative are independent of the signal level, so variations in contrast do not affect the edge detection. Second, the derivative has zero baseline wander, so there is no need for a complicated baseline restorer. Third, the derivative is insensitive to low-frequency drift, such as that caused by changing ambient light. |
A patent from the 1990s describes a reader that uses a differentiator to find the edges of the barcode. The differentiator produces a positive peak at the transition from black to white and a negative peak at the transition from white to black. These peaks are then digitized using a set of comparators with adaptive thresholds. |
The disadvantage of the derivative approach is that it is sensitive to high-frequency noise, which can produce false peaks. To mitigate this, the signal is often low-pass filtered before differentiation, or the derivative is integrated over time to reduce the effect of noise. |
A more recent patent from 2007 describes a barcode reader that converts the electric signal to a differential signal, detects extremes of the differential signal, and then determines whether those extremes are valid. This approach uses a memory to store information about valid extremes, and performs binarization processing based on this stored information. By measuring the inter-extreme time difference, the reader can distinguish between true edges and noise, reducing the time required for processing and the storage capacity needed. |

|
Chapter 10: Adaptive Thresholding with Differentiation |
When differentiation is combined with adaptive thresholding, the result is a powerful and robust digitization system. The signal is first differentiated to produce peaks at the edges. Then, a threshold is set based on the amplitude of these peaks. Only peaks that exceed the threshold are considered valid edges. |
A patent describes this approach in detail. The differentiated signal is passed through a peak detector that captures the maximum peak amplitude. This peak value is then multiplied by a factor to set the threshold. The threshold is thus proportional to the signal amplitude, ensuring that weak signals are still digitized correctly. |
The patent describes how the threshold factor was chosen as a good compromise between detecting only the strongest edges and missing some edges due to noise or low contrast. This empirical tuning is a common theme in barcode reader design---the theoretical optimum often differs from the practical optimum, and testing is required to find the best values. |
This adaptive thresholding technique is also described in another patent, which uses a peak hold circuit and a comparator to set the threshold based on the signal amplitude. The circuit is used to detect the presence of a paper surface, but the same principle applies to thresholding the barcode signal itself. The approach is elegant because it uses the signal itself to derive the threshold, making the circuit self-adaptive and robust. |
Chapter 11: Comparator-Based Digitization - A Practical Example |
To make these concepts concrete, let us consider a practical comparator-based digitizer as described in patents from the 1990s. These circuits are elegant in their simplicity and effective in their performance. |
The circuit begins with a differentiator that produces a signal proportional to the slope of the barcode reflectance. This differentiated signal is then amplified and applied to two comparators. One comparator has a positive threshold and detects positive-going edges; the other has a negative threshold and detects negative-going edges. The outputs of these comparators set and reset a flip-flop, producing a clean digital output. |
The thresholds are generated by a peak detector that captures the amplitude of the differentiated signal. The peak detector's output is divided by a resistor network to produce both a positive and a negative threshold. These thresholds automatically track the signal amplitude, so the digitizer works equally well for near and distant barcodes. |
This approach was used in many commercial slot readers and handheld scanners. The circuit was designed to be simple, robust, and cheap to manufacture, making it suitable for the mass market. The use of a differentiator combined with adaptive thresholds provides reliable edge detection even in challenging conditions. |

|
Chapter 12: The Multi-Bit Digitizer - Capturing Edge Strength |
An advancement over the simple comparator-based digitizer is the multi-bit digitizer, which captures not just the presence of an edge but also its strength. This additional information can be used by the decoder to improve performance, especially with poorly printed or damaged barcodes. |
A patent from Symbol Technologies describes a multi-bit digitizer architecture for standard and high-speed scanners. The architecture is adaptable and can be readily tuned for different scanning speeds. The system analyzes the first derivative of the analog signal and captures both the time and strength of each edge. |
The multi-bit digitizer addresses a fundamental problem with standard digitizers: as sensitivity is increased to cope with higher density symbols, poorly printed symbols may cause defects to be interpreted as valid edges. The multi-bit approach allows the decoder to try multiple thresholds on the same scan data, greatly improving the chance of decoding when only a few scans cross the barcode symbol. |
The architecture is implemented with the scan data analysis performed in the scan head, and the first derivative signal output to the main body of the reader. This arrangement reduces the number of signal lines between the scan head and the decoding terminal, making it practical for high-speed applications. |
Chapter 13: The Delta Distance Method - A Clever Decoding Technique |
The Delta Distance Method is an alternative approach to decoding barcodes that does not require directly counting bars and spaces. Instead, the method uses the distances between edges, which are more robust to variations in print quality and scanning speed. |
A patent from 1991 describes a barcode reader decoding system that implements the Delta Distance Method. In this system, an optical signal scattered from a barcode is detected and converted to a digital signal. The pulse generator generates toggle signals whenever the digital signal changes from high to low or low to high, and also generates opposite toggle signals. A counter counts the widths of these toggle signals, and various detection circuits extract the information needed to read the barcode data. |
The system includes a start guard bar detector, a basic module generator, a character width comparator, a center guard bar detector, an end guard bar detector, a similar character discriminator, a total character checker, and a parity checker. These blocks work together to ensure that the barcode data is correctly extracted, even when the barcode is scanned from either direction. |
A key feature of this system is that it uses a FIFO memory to store the data from the counter. The controller checks the outputs of the various detectors and stores the outputs of the parity checker, counter, and similar character discriminator in the FIFO memory. The microprocessor then processes this data to extract the original barcode information, which is transmitted to a host computer through an interface. |
The Delta Distance Method is particularly effective for handling ink-spread barcodes and high-speed scanning, where conventional counting techniques may produce errors. By focusing on the relative distances between edges rather than the absolute widths of bars and spaces, the method provides reliable decoding across a wide range of conditions. |

|
Chapter 14: Decoding Architecture - The Block Diagram |
To understand how all these components work together, let us examine the block diagram of a typical barcode reader decoding system as described in a patent. |
The system includes: |
A barcode detector that detects an optical signal scattered from a barcode and converts it to a digital signal. This is the optical front end of the reader. |
A pulse generator that generates toggle signals that toggle whenever the digital signal changes from high to low or low to high. It also generates opposite toggle signals. |
A counter that counts the respective widths of the toggle signals and produces count signals. |
A start guard bar detector that detects the start guard bar, which indicates the start of the barcode, from the count signals. |
A basic module generator that constructs a basic module by multiplying and adding the count signals when the start guard bar is detected. |
A character width comparator that checks whether a character is properly constructed using the basic module. |
A center guard bar detector that detects the center guard bar, which is the center signal of the barcode. |
An end guard bar detector that detects the end guard bar, indicating the end of the barcode. |
A similar character discriminator that prevents errors in character recognition by discriminating between counter values. |
A total character checker that checks whether the number of characters on the left of the center guard bar is the same as on the right. |
A parity checker that checks whether the barcode is entered from the left or right of the center guard bar and applies the appropriate parity. |
A controller that checks the outputs of the detectors and stores the relevant outputs in a FIFO memory. |
An error checker that checks for errors in the decoded data. |
A microprocessor that processes the data from the FIFO memory to extract the original barcode information. |
A transmitting/receiving unit and an interface for transmitting the decoded data to a host computer. |
This comprehensive architecture demonstrates the complexity of the decoding process and the importance of each stage in ensuring reliable barcode reading. |

|
Chapter 15: The Microcontroller - Brains Behind the Operation |
After the digitizer has produced a stream of ones and zeros, the microcontroller takes over. The microcontroller's job is to measure the widths of the pulses, interpret the pattern according to the barcode standard, and output the decoded data. |
In a typical barcode reader, the microcontroller includes a timer/capture unit that can measure the duration of pulses with high precision. The timer is started when the signal changes from low to high and stopped when it changes from high to low, or vice versa. The measured times are then compared to a set of expected widths to determine the value of each bar and space. |
Texas Instruments has been active in this area, providing reference designs that integrate the microcontroller with the analog front end. Their TRF7960 RFID reader chip, while primarily for RFID, shares many of the same building blocks as a barcode reader, including a configurable analog front end and a microcontroller interface. This integration reduces the number of components required and simplifies the overall design. |
A recent development from Texas Instruments is the AM62A processor, which includes a deep learning accelerator for barcode imaging. This processor can run a neural network that localizes barcodes in an image, even when they are damaged or partially obscured. This represents a significant advance in barcode reading technology, moving from simple digitization to sophisticated image processing. |
Chapter 16: Timer-Based Width Measurement - Measuring the Bars |
Measuring pulse widths accurately is essential for decoding barcodes. The microcontroller must measure the time between edges with resolution better than the narrowest bar width. For a typical barcode with a narrow bar width of 0.25 mm and a scanning speed of 100 mm/s, the narrow bar will be present for about 250 microseconds. A timer with a resolution of 0.5 microseconds would measure this bar with an accuracy of about 0.2%, which is more than adequate. |
The timer/capture unit of the microcontroller is the key to this measurement. In capture mode, the timer is free-running, and the value of the timer is latched whenever a specified event occurs on an input pin. The microcontroller can then subtract successive timer values to determine pulse widths. |
Texas Instruments' application notes on microcontrollers for barcode reading describe this technique in detail. The capture unit can be configured to trigger on both rising and falling edges, so the microcontroller can measure both the high and low times of the signal. |
In practice, the microcontroller must also handle variations in scanning speed. If the user scans the barcode faster, the pulse widths will be shorter. The decoder must normalize the measured widths by the overall time of the scan, comparing ratios of widths rather than absolute values. This speed normalization is essential for reliable decoding. |

|
Chapter 17: Edge Detection - Finding the Transitions |
The first step in decoding is to find the edges of the barcode---the transitions between bars and spaces. The edge detection logic is typically implemented in the digitizer, but the decoder may also perform additional edge detection in software. |
The edge detection process is critical because the edges are the only places where the barcode signal contains information. The widths of the bars and spaces are measured from the distances between edges. If the edges are detected incorrectly, the decoded data will be incorrect. |
The basic approach to edge detection is to compare the analog signal to a threshold. When the signal crosses the threshold, an edge is detected. The direction of the crossing (rising or falling) determines whether the transition is from black to white or white to black. |
More sophisticated approaches use the derivative of the signal to find the edges. The derivative is zero when the signal is constant and peaks at the edges. This approach is less sensitive to variations in signal level and provides more accurate edge detection. |
Chapter 18: Start and Stop Patterns - Finding the Beginning and End |
Every barcode symbology has a unique start and stop pattern that tells the decoder where the data begins and ends. For Code 39, for example, the start and stop character is an asterisk, which has a specific pattern of five bars and four spaces. The decoder searches for this pattern in the digitized signal; if it finds it, it knows that the following characters are data. |
The process of finding the start and stop patterns is the first step in decoding. The microcontroller scans the digitized signal, looking for a sequence of bars and spaces that matches the start pattern for the symbology being used. Once the pattern is found, the decoder can proceed to extract the data characters. |
In a practical design, the decoder may try multiple symbologies. The start pattern for Code 39 is different from that for UPC, which is different from that for Interleaved 2 of 5. The decoder must try each pattern in turn until it finds a match. This is known as auto-discrimination, and it is a standard feature in modern barcode readers. |
Some readers, particularly those based on imaging, can detect the barcode's orientation and skew. The decoder can then compensate for these distortions, allowing the reader to decode barcodes that are not perfectly aligned with the scanning direction. This is especially useful for handheld readers that are not held precisely. |

|
Chapter 19: Edge-to-Edge vs. Module-Width Decoding |
Once the start pattern has been found, the decoder must extract the data. There are two primary approaches: edge-to-edge decoding and module-width decoding. |
In edge-to-edge decoding, the decoder measures the distance between successive edges. For a barcode that encodes data in the widths of bars and spaces, these distances directly correspond to the data values. For example, in Code 39, each character consists of five bars and four spaces, with each bar or space being either narrow or wide. The decoder measures the widths and determines which are narrow and which are wide based on a ratio. |
In module-width decoding, the decoder determines the width of the basic module, which is the smallest unit of width in the barcode. All other widths are multiples of this module. The decoder measures the total width of the character and divides it by the total number of modules to find the module width. This approach is more robust to variations in scanning speed and print quality. |
Microchip's application notes on barcode decoding provide examples of both approaches. The module-width approach is generally preferred for modern readers because it is more tolerant of distortion and provides better performance in challenging conditions. |
Chapter 20: Speed Compensation - Adjusting for User Behavior |
One of the most challenging aspects of handheld barcode reading is that the scanning speed varies from user to user and from scan to scan. A user who scans quickly will produce narrower pulses than a user who scans slowly. The decoder must compensate for this variation. |
Speed compensation is typically done by measuring the total time of the scan, from the start pattern to the stop pattern. The decoder then normalizes the individual pulse widths by this total time. For example, if a character is supposed to be 10 modules wide and the total scan time is 1000 microseconds, each module is 100 microseconds. The pulse widths are then compared to this module width. |
A patent describes a speed compensation technique that uses the initial peak of the differentiated signal to set the threshold levels. The first peak, which occurs when the edge of the card passes the optics module, has an amplitude that is proportional to the scan speed. The thresholds are derived from this peak, so the digitizer's response is automatically adjusted for speed. |
This technique is elegant because it does not require any explicit speed measurement; the speed information is embedded in the signal itself. This makes the circuit simple and robust. |

|
Chapter 21: Error Checking - Ensuring Data Integrity |
Barcode data is not always read correctly. Print defects, scanning errors, and noise can all cause decoding errors. To detect these errors, barcode symbologies include error-checking mechanisms such as checksums and parity checking. |
Checksums are calculated from the decoded data and compared to a value encoded in the barcode. If the calculated checksum does not match the encoded value, the decode is considered invalid. Parity checking is used in some symbologies to verify that each character has the correct number of bars or spaces. |
A patent describes a parity checker that checks whether, in the characters generated from the counter, a barcode is entered from the left of a center guard bar or from the right. The parity checker applies an odd parity or an even parity to the FIFO memory, allowing the decoder to verify the integrity of the decoded data. |
The patent also describes an error checker that receives a total character signal and checks for errors. This ensures that the decoded data has the correct length and structure before it is transmitted to the host computer. |
Chapter 22: Retry Logic - Handling Bad Reads |
Not all scans are successful. The barcode may be damaged, the contrast may be poor, or the user may scan too quickly. In these cases, the reader must decide whether to report a failure or to try again. |
Retry logic is the decision-making process that handles bad reads. If the checksum fails, the reader may try again with a different gain setting or a different threshold. The reader may also retry the scan multiple times, hoping that one attempt will succeed. |
The retry logic is typically implemented in the microcontroller firmware. The firmware monitors the decoding process and, if it detects an error, it instructs the hardware to try again. The firmware may also report the error to the user, indicating that the scan was unsuccessful. |
The retry logic must be balanced against the need for speed. If the reader tries too many times, the user will be frustrated. A good design will make a few quick retries before giving up, minimizing the delay for the user. |

|
Chapter 23: The FIFO Memory - A Buffer for Data |
The FIFO (First-In, First-Out) memory is a buffer that stores the decoded data before it is processed by the microcontroller. The FIFO memory is essential for handling the asynchronous nature of barcode scanning: the data from the digitizer arrives at a variable rate, and the microcontroller may not be able to process it in real time. |
A patent describes a decoding system that uses a FIFO memory to store barcode data from a barcode interval counter controller. The data stored in the FIFO memory is sent out to the decoder in synchronization with a clock pulse. The decoder then produces a binary-coded decimal bit indicating a decimal character, and additional signals indicating left margin, right margin, center band, error, and so on. |
The FIFO memory allows the system to handle high-speed scanning without losing data. The data is stored in the FIFO as it arrives, and the microcontroller reads it out at its own pace. This decouples the data acquisition and processing functions, making the system more robust and easier to design. |
Chapter 24: The Interface - Connecting to the Outside World |
After the barcode has been decoded, the data must be transmitted to a host computer or point-of-sale system. The interface is the circuit that handles this transmission. |
The most common interface for barcode readers is USB, which provides both power and data communication. RS-232 serial interfaces are also common in older systems, and Bluetooth interfaces are increasingly popular for wireless communication. |
A patent describes a transmitting/receiving unit and an interface for transmitting output data from the microprocessor to a host computer. The interface includes a logic circuit consisting of NAND gates for transmitting serial data, and a buffer circuit for receiving signals from the host computer. |
The patent also describes the use of asynchronous transmission, where data is transmitted in serial form with start and stop bits. This is a simple and reliable method of communication that is widely used in barcode readers. |

|
Chapter 25: Power Supply - The Often-Overlooked Critical Component |
The power supply of a barcode reader is critical to its performance. Digital circuits, such as the microcontroller and memory, generate a great deal of noise. This noise can couple into the analog front end through the power supply lines, degrading the signal quality. |
To prevent this, the analog and digital sections of the reader should have separate power supplies. The analog supply should be clean, with low noise and good regulation. A low-dropout regulator, or LDO, is typically used for the analog supply, providing a stable voltage that is isolated from the digital supply. |
Texas Instruments' TRF7960 RFID reader chip provides a good example of power supply design for mixed-signal systems. The chip includes separate internal power supplies for the analog, digital, and power amplifier sections, providing excellent isolation. |
In a barcode reader, the analog supply should be bypassed with both a large tantalum capacitor and a small ceramic capacitor. The tantalum capacitor provides bulk energy storage, while the ceramic capacitor suppresses high-frequency noise. The capacitors should be placed as close as possible to the analog circuits to minimize the inductance of the connections. |
Chapter 26: Grounding - The Star Ground Strategy |
Grounding is a subtle but important aspect of barcode reader design. A poor ground can introduce noise into the analog signal, degrade the performance of the digitizer, and cause decoding errors. |
The star ground strategy is the standard approach. All grounds are connected at a single point, usually the negative terminal of the power supply. This prevents ground currents from flowing between different sections of the circuit and creating voltage drops. |
In practice, the ground plane of the PCB is divided into analog and digital sections, which are joined at the star point. The analog ground section should contain all the analog components, including the photodiode, TIA, PGA, and comparator. The digital ground section should contain the microcontroller, memory, and digital logic. |
Texas Instruments recommends this approach in their application notes on mixed-signal design. The analog and digital grounds should be connected by a single low-impedance path, such as a zero-ohm resistor or a ferrite bead. |

|
Chapter 27: PCB Layout - Keeping the Signal Paths Short |
The physical layout of the printed circuit board is crucial for achieving good performance. The signal paths should be as short as possible, especially the connections between the photodiode and the TIA. Long traces act as antennas, picking up noise and interfering with the signal. |
The photodiode is a high-impedance current source, and its output is very small. Any leakage current or capacitance on the trace can degrade the signal. For this reason, the photodiode should be placed very close to the TIA input, and the trace should be as short and as direct as possible. |
Microchip's application note describes a TIA design where the photodiode is placed on the same side of the PCB as the op-amp, with a very short connection between them. This minimizes the parasitic capacitance and reduces noise pickup. |
The use of surface-mount components is also beneficial. Surface-mount resistors and capacitors have lower parasitic inductance and capacitance than their through-hole counterparts, making them better suited for high-frequency applications. |
Chapter 28: Guard Rings - Protecting the High-Impedance Node |
A guard ring is a trace that surrounds a high-impedance node and is driven by a low-impedance buffer to the same voltage as the node. This prevents leakage currents from flowing into the node and keeps the voltage stable. |
In a TIA, the input node is at a virtual ground potential. A guard ring connected to ground can be placed around the input trace to provide a low-impedance shield. Any leakage current that tries to flow from the guard ring to the input trace will be shunted away, reducing error. |
This technique is described in various application notes from Texas Instruments and Microchip. The guard ring should be placed on both the top and bottom layers of the PCB, connected by vias. This provides a complete shield around the input node. |
The guard ring is particularly important in humid or dirty environments, where leakage currents through the PCB insulation can be significant. By reducing these currents, the guard ring improves the reliability of the reader. |

|
Chapter 29: EMI Shielding - Protecting Against Interference |
Barcode readers are often used in environments with significant electromagnetic interference, or EMI. Motors, wireless devices, and other electronic equipment can radiate noise that interferes with the sensitive analog circuits of the reader. |
To protect against EMI, the analog section of the reader is often enclosed in a metal shield. This shield is connected to the analog ground, providing a low-impedance path for interfering signals. The shield should be made of a highly conductive material, such as copper or aluminum. |
Ferrite beads are also used on the supply and signal lines to suppress high-frequency noise. A ferrite bead is a passive component that acts as a low-pass filter, attenuating high frequencies while passing DC and low frequencies. |
In the design of the TRF7960 RFID reader, Texas Instruments recommends careful attention to EMI shielding. The chip includes an internal band-pass filter that rejects out-of-band noise, further improving its immunity to interference. |
Chapter 30: Laser Diode Readers - An Alternative Approach |
While LED-based readers are common, many handheld scanners use a laser diode. A laser produces a coherent, collimated beam that can be focused to a very small spot. This allows the reader to read barcodes from a greater distance and with higher resolution. |
The laser diode itself requires a more complex drive circuit than an LED. The laser's output power must be carefully regulated to maintain a constant light level, and the diode must be protected from electrostatic discharge and overcurrent. |
Most laser readers include an automatic power control, or APC, circuit. A monitor photodiode inside the laser package senses the optical output and provides feedback to a control loop. This loop adjusts the drive current to keep the output power constant, regardless of temperature or aging. |
The laser beam is scanned across the barcode using a moving mirror. The mirror is typically oscillated by a galvanometer or rotated by a polygon. The scanning mechanism introduces additional challenges, such as the need to synchronize the photodetector with the mirror position. |

|
Chapter 31: The Laser Scanning Mechanism - The Moving Mirror |
The scanning mechanism is a critical part of a laser barcode reader. The laser beam must be swept across the barcode in a straight line, covering the entire width of the pattern. The speed and accuracy of the scan affect the quality of the resulting signal. |
The most common scanning mechanism uses an oscillating mirror driven by a galvanometer. The mirror is mounted on a pivot and is driven back and forth by a coil and magnet. The frequency of oscillation is typically around 50 Hz, so the barcode is scanned 100 times per second (once in each direction). |
The amplitude of the oscillation must be large enough to cover the barcode, and the scan must be linear, so the beam moves at a constant speed. The galvanometer control circuit includes a position sensor, often based on a Hall effect sensor or a piezoelectric sensor, to provide feedback to the drive amplifier. |
This technology is mature and well-proven, but it has mechanical limitations. The mirror and galvanometer are moving parts, so they are subject to wear and failure. In contrast, imaging-based readers have no moving parts, making them more reliable and durable. |
Chapter 32: Linear Image Sensor Readers (CCD/CIS) |
Imaging-based readers use a linear array of photodiodes, known as a CCD or CIS, to capture an image of the barcode. The array is read out sequentially, producing a video signal that represents the reflectance along the length of the array. This signal is then processed in the same way as the signal from a scanner. |
The advantage of an imaging-based reader is that it has no moving parts. The barcode is captured in a single exposure, so the reader is not dependent on scanning speed. This makes imaging-based readers more reliable and easier to use. |
The disadvantage is that the image sensor must be read out at a high speed, and the resulting signal must be processed with an ADC. This requires a more powerful processor and more complex circuitry than a simple comparator-based scanner. |
A patent from Symbol Technologies describes a reader that uses a line sensor and a peak hold circuit to detect the presence of a barcode. The reader then drives the LEDs to illuminate the barcode and captures the image. This design, from the 1990s, was an early example of an imaging-based barcode reader. |

|
Chapter 33: Correlated Double Sampling - Reducing Noise in Imaging |
CCD and CIS sensors are susceptible to several types of noise. Reset noise occurs when the pixel is reset before the integration period; it appears as a random offset in each pixel. Fixed-pattern noise is caused by variations in the sensitivity of the photodiodes. |
Correlated double sampling, or CDS, is a technique that reduces both types of noise. In CDS, the pixel output is sampled twice: once during the reset phase and once after the integration period. The difference between the two samples is taken, canceling the reset noise and any fixed-pattern offset. |
CDS is implemented with a pair of sample-and-hold circuits and a differential amplifier. The reset level is stored on one capacitor, and the signal level is stored on another. The amplifier then subtracts one from the other. |
This technique is widely used in digital cameras and video cameras, and it is equally applicable to barcode imagers. By reducing the noise, CDS allows the reader to capture clear images of barcodes even in challenging conditions. |
Chapter 34: Decoding via Software - The Digital Approach |
With the increasing power of microcontrollers and digital signal processors, many modern barcode readers decode the signal entirely in software. The analog signal is digitized by a high-speed ADC, and the resulting digital samples are processed by a software algorithm. |
This approach has several advantages. First, it is more flexible; the algorithm can be updated to support new symbologies or to improve performance. Second, it allows for more sophisticated signal processing, such as digital filtering and matched filtering. Third, it avoids the need for precision analog components, such as comparators and peak detectors. |
The software algorithm typically includes steps for baseline correction, edge detection, and decoding. The baseline correction removes any drift in the signal, such as that caused by ambient light. The edge detection finds the transitions between bars and spaces. The decoding step interprets the pattern according to the barcode standard. |
Texas Instruments' AM62A processor takes this approach to the next level by using a deep learning accelerator to localize barcodes in an image. The processor can decode barcodes at up to 120 frames per second, making it suitable for high-speed applications. |

|
Chapter 35: Digital Matched Filters - Improving SNR |
One of the key techniques used in software decoding is the matched filter. A matched filter is a digital filter that is designed to maximize the signal-to-noise ratio for a known signal pattern. In barcode reading, the known pattern is the expected shape of the bar or space. |
The matched filter is implemented by correlating the received signal with a template of the expected signal. The correlation peaks at the point where the received signal most closely matches the template. These peaks indicate the locations of the edges or the centers of the bars and spaces. |
By using a matched filter, the reader can recover the barcode signal even when it is buried in noise. This allows the reader to decode barcodes that would be unreadable with a simple comparator. |
The matched filter is particularly effective when the noise is white and Gaussian. In practice, the noise in a barcode reader is often non-white, due to the presence of 50/60 Hz hum and other interference. The filter can be designed to reject these specific frequencies, further improving performance. |
Chapter 36: Enhancing Filters - Improving Signal Quality |
Enhancement filters are used in barcode readers to improve the quality of the analog signal before digitization. These filters can sharpen the edges, suppress noise, and compensate for the effects of blurring caused by the finite spot size of the scanning beam. |
A patent from Symbol Technologies describes an enhancement filter that improves the signal quality for barcode scanning. The filter is designed to compensate for the low-pass characteristics of the scanning system, which blur the edges of the barcode. By boosting the high-frequency components of the signal, the filter produces a sharper waveform that is easier to digitize. |
The enhancement filter has a frequency response that is the inverse of the scanning system's transfer function. This is achieved by placing poles and zeros at specific frequencies. The filter can be implemented with standard op-amp circuits, making it practical for use in commercial readers. |
The patent also describes how the enhancement filter can be tuned to compensate for different levels of blurring. When the image is focused, the filter has a moderate effect; when the image is blurred, the filter has a stronger effect. This adaptive filtering improves the reader's performance across a range of operating conditions. |

|
Chapter 37: Analog Front-End Integration - The Single-Chip Solution |
For applications where space and cost are at a premium, an integrated analog front end, or AFE, is an attractive option. The AFE contains the TIA, PGA, filter, and digitizer on a single chip, reducing the component count and simplifying the PCB layout. |
Texas Instruments offers a variety of AFEs for optical sensing applications. The TRF7960 is a fully integrated AFE for RFID applications, but its architecture is similar to what would be used in a barcode reader. The chip includes a receiver with RF detection, gain, filtering with AGC, and a digitizing stage. It also includes an RSSI measuring stage, which measures the strength of the demodulated signal. |
The TRF7963RHBR is another example of a highly integrated AFE from Texas Instruments. This chip is designed for 13.56 MHz RFID reader/writer systems and includes an RF amplifier, data framing engine, and SPI interface. While primarily for RFID, the chip's analog front-end architecture is instructive for barcode reader design. |
The integrated AFE is controlled via an SPI interface, allowing the microcontroller to configure the gain, filter settings, and other parameters. The chip also includes a built-in oscillator and power-down mode for low-power operation. This level of integration makes it easy to design a compact, reliable barcode reader. |
Chapter 38: The DS5250 and Magnetic Stripe Card Readers - A Parallel Example |
While the focus of this article is on optical barcode readers, it is instructive to look at a related technology: magnetic stripe card readers. These readers use similar principles of analog signal conditioning and digitization, and they provide a useful parallel example. |
Analog Devices has published an application note on interfacing the DS5250 secure microcontroller with a magnetic stripe card reader. The magnetic stripe card reader contains circuitry to decode the magnetic fluxes on the magnetic stripe into a stream of bits. The DS5250 manages the higher-level tasks: translating these bits into characters, then reading and verifying data fields. |
The magnetic stripe card reader has interface pins for STROBE and DATA. The STROBE signal is driven by the microcontroller to clock out card data bits, and the DATA signal carries the card data bits. The microcontroller reads the DATA signal directly, because the minimum VIH level for the microcontroller's port pins is compatible with the 3V I/O levels used by the card reader. |
This example demonstrates that the principles of barcode reader design---analog signal conditioning, digitization, and microcontroller-based decoding---are applicable to a wide range of data capture applications. |

|
Chapter 39: Microchip's Magnetic Stripe Reader - Another Parallel |
Microchip Technology has also published a user guide for a magnetic stripe reader using their dsPIC and PIC24F devices. This reader demonstrates how a microcontroller can be used to process analog signals from a magnetic stripe and decode the data. |
The reader uses an exponential averaging technique to filter the noise prior to the signal detection algorithm. While the card is swiped, the software algorithm performs the F2F decoding and stores the time between consecutive peaks into RAM. After the swipe has finished, the read data is decoded and checked for errors. |
The dsPIC solution is interrupt-based, with the device put into sleep mode to save power. It wakes up during the swipe, decodes the track, prints it on the serial terminal, and goes back to sleep mode. The PIC24F solution is polling-based, but otherwise similar. |
This example illustrates the use of software-based decoding and power management, both of which are important considerations in barcode reader design. |
Chapter 40: The Decoder - Processing the Digital Data |
The decoder is the final stage of the signal chain. Its job is to take the stream of ones and zeros from the digitizer and convert it into the data represented by the barcode. |
The decoder must handle several tasks. First, it must find the start and stop patterns to determine where the data begins and ends. Second, it must measure the widths of the bars and spaces and determine which are narrow and which are wide. Third, it must convert these patterns into characters according to the barcode symbology. Fourth, it must check the checksum or parity to verify the integrity of the data. |
The decoder can be implemented in hardware, software, or a combination of both. Hardware decoders are faster but less flexible; software decoders are slower but can be updated to support new symbologies. Most modern barcode readers use software decoders, which are implemented in the microcontroller or processor. |
The decoding process is described in detail in patents such as the one for the Delta Distance Method. This method uses the distances between edges to determine the data, rather than directly counting the widths of bars and spaces. This approach is more robust to variations in print quality and scanning speed. |

|
Chapter 41: The Host Interface - Communicating the Data |
After the data has been decoded, it must be transmitted to a host computer or point-of-sale system. The host interface is the circuit that handles this transmission. |
The most common interface for barcode readers is USB, which provides both power and data communication. RS-232 serial interfaces are also common in older systems, and Bluetooth interfaces are increasingly popular for wireless communication. |
The host interface typically includes a transmitting/receiving unit that converts the parallel data from the microcontroller into serial data for transmission. The data is transmitted in a format that is compatible with the host computer, such as ASCII characters. |
Some interfaces also include a buffer or FIFO memory to store the data while it is being transmitted. This allows the microcontroller to continue processing data while the previous data is being transmitted, improving the overall throughput. |
Chapter 42: Error Handling - Dealing with Failures |
Despite the best efforts of the designer, some barcode scans will fail. The barcode may be damaged, the contrast may be poor, the user may scan too quickly, or the reader may be subject to interference. |
Error handling is the process of detecting and responding to these failures. The most common approach is to use error checking, such as checksums or parity, to detect errors in the decoded data. If an error is detected, the reader may retry the scan or report a failure to the user. |
The retry logic is typically implemented in the microcontroller firmware. The firmware monitors the decoding process and, if it detects an error, it instructs the hardware to try again. The firmware may also report the error to the user, indicating that the scan was unsuccessful. |
The retry logic must be balanced against the need for speed. If the reader tries too many times, the user will be frustrated. A good design will make a few quick retries before giving up, minimizing the delay for the user. |

|
Chapter 43: Performance Optimization - Getting the Most from the Reader |
To achieve the best performance from a barcode reader, the designer must optimize every stage of the signal chain. This includes selecting the right components, laying out the PCB carefully, and tuning the firmware. |
Component selection is critical. The photodiode must have the right spectral response and speed. The op-amp must have low noise and sufficient bandwidth. The microcontroller must have a fast timer and sufficient processing power. The designer must balance these requirements against cost and power consumption. |
PCB layout is also critical. The analog and digital sections must be separated, the signal paths must be short, and the power supply must be well decoupled. EMI shielding may be required in harsh environments. |
Firmware optimization is the final step. The decoder algorithm must be efficient and robust. The error handling must be thorough but not too slow. The power management must extend battery life without compromising performance. |
Chapter 44: Testing and Calibration - Ensuring Performance |
Before a barcode reader can be shipped, it must be tested and calibrated. The calibration ensures that the reader meets the specifications for gain, threshold, and decoding accuracy. |
The calibration process begins with a test pattern, typically a high-contrast barcode on a white card. The reader is placed at a known distance from the test pattern, and the gain is adjusted so that the signal amplitude is within the specified range. The threshold is then adjusted so that the digitized output matches the known pattern. |
Some readers store the calibration values in an EEPROM, so the calibration is retained even when the power is turned off. This makes the reader easy to use and eliminates the need for frequent recalibration. |
The testing process includes verifying the decoding accuracy for a variety of barcodes, including low-contrast and damaged barcodes. The reader must also be tested for immunity to ambient light and electromagnetic interference. |

|
Chapter 45: Summary - The Complete Signal Chain in Perspective |
The signal chain of a barcode reader is a remarkable example of mixed-signal engineering. It begins with the optical collection of reflected light and ends with the transmission of decoded data to a host computer. Along the way, the signal is amplified, filtered, digitized, and decoded in a carefully orchestrated sequence. |
We have seen how the transimpedance amplifier converts the tiny current from the photodiode into a usable voltage, and how compensation is used to ensure stability. We have examined the comparator and the adaptive threshold, and how differentiation can improve edge detection. We have considered the microcontroller and the software that performs the final decoding. |
We have also looked at specific examples from Texas Instruments, Microchip Technology, and Analog Devices. The TRF7960 RFID chip, the MCP6001U op-amp, and the DS5250 microcontroller provide a wealth of design options. And the AM62A processor with its deep learning accelerator points the way to the future. |
The key lessons from our exploration are these: |
The signal chain must be treated as a system. Every stage matters, from the photodetector to the microcontroller. A weakness in any stage can degrade the overall performance. |
Noise is the enemy. The signal from the photodiode is tiny, and it is surrounded by noise. The designer must use careful circuit design, PCB layout, and filtering to preserve the signal-to-noise ratio. |
Adaptive techniques are essential. The threshold, the gain, and the decoding algorithm must adapt to variations in the signal, the environment, and the user's behavior. |
Mixed-signal design is the art. The analog and digital circuits must be designed to coexist without interference. This requires careful attention to grounding, power supply decoupling, and PCB layout. |