The Memory of White and Black: How Peak Detectors Remember the Signal's Extremes |
Subtitle: A Deep Dive into the Circuits that Capture the Brightest and Darkest Moments - with Real-World Designs from Symbol, Zebra, Honeywell, Datalogic, Texas Instruments, and Analog Devices |
Opening Summary |
The adaptive threshold is the key to reliable barcode reading, but how does the scanner know where to set that thresholdThe answer lies in a pair of circuits that act as the scanner's memory: the peak detectors. One peak detector remembers the brightest part of the signal - the white spaces. The other remembers the darkest part - the black bars. The threshold is then set exactly halfway between these two remembered levels. |
This article is dedicated to the peak detector - the circuit that captures and holds the signal's extremes. We will explore the classic analog peak detector, which uses a diode, a capacitor, and a resistor to perform this memory function. We will examine the key design parameters: the charging time, the discharging time, and the diode's forward voltage drop. We will look at how major companies have implemented peak detectors in their products. We will see how Symbol (now Zebra) used a simple but carefully tuned peak detector in the LS2208. We will explore Honeywell's use of an active peak detector with an op-amp to eliminate the diode's forward voltage drop. We will examine Datalogic's use of a dual-peak detector for their advanced automatic gain control. We will also look at Texas Instruments' and Analog Devices' reference designs, which include peak detectors as a standard building block. |
By the end of this journey, you will understand that the peak detector is not just a simple diode and capacitor but a carefully engineered circuit that must balance speed, accuracy, and noise immunity. You will see how the choice of the diode, the capacitor, and the resistor all contribute to the peak detector's ability to faithfully remember the signal's extremes. |

|
Full Article |
Section 1: The Peak Detector's Mission - To Remember |
The peak detector is a circuit that captures and holds the maximum (or minimum) value of a signal. In a barcode scanner, two peak detectors are used: a positive peak detector for the white spaces (the maximum signal voltage) and a negative peak detector for the black bars (the minimum signal voltage). The outputs of these two peak detectors are then combined to generate the adaptive threshold. |
The positive peak detector works as follows: when the signal rises, the diode conducts, charging the capacitor to the signal's peak voltage. When the signal falls, the diode is reverse-biased, and the capacitor holds the peak voltage. The resistor in parallel with the capacitor provides a slow discharge path, allowing the peak detector to track slow changes in the signal's average level. |
The negative peak detector works similarly, but with the diode reversed. It captures the signal's minimum voltage (the most negative or least positive). The two peak detectors together provide a memory of the signal's range. |

|
Section 2: The Diode - The Gatekeeper |
The diode is the gatekeeper of the peak detector. It allows the capacitor to charge when the signal is higher than the capacitor's voltage (for the positive peak detector) and blocks the discharge when the signal is lower. |
The diode's forward voltage drop is a critical parameter. When the diode conducts, there is a voltage drop across it (typically 0.3-0.7 volts for a silicon diode and 0.2-0.4 volts for a Schottky diode). This voltage drop means that the capacitor charges to the signal's peak voltage minus the diode drop. This introduces an error. |
To minimize this error, a Schottky diode is often used. Schottky diodes have a lower forward voltage drop than standard silicon diodes. Some designs use an 'active' peak detector, which uses an op-amp to eliminate the diode's forward voltage drop. |

|
Section 3: The Capacitor - The Memory Element |
The capacitor is the memory element of the peak detector. It stores the charge that represents the peak voltage. The capacitor's value determines the peak detector's time constant. |
The charging time of the capacitor is determined by the diode's forward resistance and the capacitor's value. The charging time must be short enough to track the signal's peaks. The discharging time is determined by the resistor and the capacitor's value. The discharging time must be long enough to hold the peak during the barcode, but short enough to track slow changes in the signal's average level. |
The capacitor's value is typically 0.1 to 10 microfarads. A larger capacitor gives a longer holding time but a slower charging time. A smaller capacitor gives a faster charging time but a shorter holding time. |

|
Section 4: The Resistor - The Release Valve |
The resistor is the release valve of the peak detector. It provides a slow discharge path for the capacitor. The resistor's value, together with the capacitor's value, determines the time constant. |
A larger resistor gives a longer discharge time, which is good for holding the peak, but it makes the peak detector slower to respond to changes in the average level. A smaller resistor gives a faster response to changes but a shorter holding time. |
The resistor's value is typically 100 kilohms to 1 megaohm. A 1-megaohm resistor with a 1-microfarad capacitor gives a time constant of 1 second. |

|
Section 5: Symbol's LS2208 - The Classic Peak Detector |
Symbol's LS2208 uses a classic passive peak detector. The positive peak detector uses a Schottky diode (BAT54S, a dual Schottky diode), a 1-microfarad capacitor, and a 1-megaohm resistor. The negative peak detector uses another Schottky diode (the other half of the BAT54S), a 1-microfarad capacitor, and a 1-megaohm resistor. |
The BAT54S is a popular choice because it has a low forward voltage drop (about 0.2-0.3 volts at the low currents used in this circuit). The 1-microfarad capacitor and the 1-megaohm resistor give a time constant of 1 second. This is long enough to hold the peak during the barcode, but short enough to track changes in the ambient light. |
The outputs of the two peak detectors are fed to a resistor divider. The midpoint voltage is the adaptive threshold. The threshold is fed to the comparator's inverting input. |
Section 6: The Peak Detector's Time Constant - A Critical Trade-Off |
The time constant of the peak detector is a critical trade-off. A long time constant (e.g., 1 second) provides good holding of the peak, but it makes the peak detector slow to respond to changes in the ambient light. A short time constant (e.g., 0.1 seconds) provides a faster response to changes, but it may not hold the peak during a long barcode. |
The optimal time constant depends on the application. For a hand-held scanner, the user moves the scanner across the barcode in about 0.5 seconds. The time constant should be longer than this to hold the peak during the scan. A time constant of 1 second is typical. |
For a conveyor-belt scanner, the barcode moves past the scanner at a constant speed. The time constant can be shorter because the scan time is known. A time constant of 0.1-0.2 seconds is often used. |

|
Section 7: The Diode's Forward Voltage Drop - A Source of Error |
The diode's forward voltage drop is a source of error in the peak detector. The capacitor charges to the signal's peak voltage minus the diode drop. This means that the threshold is not exactly at the midpoint of the signal. |
The error is small if the signal's amplitude is large. For a 2-volt signal, a 0.3-volt diode drop is only a 15% error. For a 0.5-volt signal, the error is 60%, which is significant. |
To minimize the error, a Schottky diode is used. The BAT54S has a forward voltage drop of about 0.2 volts at low currents. This is much lower than a standard silicon diode's 0.6-volt drop. |
Section 8: The Active Peak Detector - Eliminating the Diode Drop |
An active peak detector uses an op-amp to eliminate the diode's forward voltage drop. The op-amp is connected as a buffer, with the diode in the feedback loop. The op-amp's high gain ensures that the output voltage is exactly equal to the signal's peak voltage, regardless of the diode's forward voltage drop. |
The active peak detector is more accurate than the passive peak detector. It is also faster because the op-amp provides a low-impedance drive to the capacitor. However, the active peak detector is more complex and more expensive. |
Honeywell's 1900 imager uses an active peak detector in its analog front-end. The active peak detector is used to generate the adaptive threshold for the comparator. The active peak detector is integrated into the sensor's analog front-end chip. |

|
Section 9: The Dual Peak Detector - For Two Thresholds |
Some scanners use a dual peak detector to generate two thresholds. The two thresholds are used to classify the signal into three levels: black, gray, and white. This is used for ternary barcodes, as discussed in the previous chapter. |
The dual peak detector uses two positive peak detectors and two negative peak detectors. The two positive peak detectors are set to different levels (e.g., 60% and 25% of the peak). The two negative peak detectors are similarly set. |
The dual peak detector is a more complex circuit, but it is necessary for ternary barcodes. Datalogic's research on ternary barcodes uses a dual-threshold detection system. |
Section 10: The Peak Detector in Texas Instruments' TIDA-00857 |
Texas Instruments' TIDA-00857 reference design uses a passive peak detector, similar to the LS2208. The design uses a Schottky diode (BAT54S), a 1-microfarad capacitor, and a 1-megaohm resistor for both the positive and negative peak detectors. |
The TIDA-00857's peak detector is a classic, proven design. It is simple, robust, and effective. The use of a Schottky diode minimizes the forward voltage drop. |

|
Section 11: The Peak Detector in Analog Devices' Reference Design |
Analog Devices' reference design uses an active peak detector. The active peak detector is built around a high-speed op-amp (the AD8615). The op-amp is connected as a non-inverting buffer with the diode in the feedback loop. |
The active peak detector provides a very accurate peak voltage, with no diode drop. It also has a fast response time, making it suitable for high-speed scanning. The reference design includes both positive and negative peak detectors. |
Section 12: The Peak Detector and the Noise |
The peak detector is susceptible to noise. If a noise spike occurs, the peak detector may capture the spike as the peak, causing the threshold to be too high. To reject noise, the peak detector's time constant is set to a value that is longer than the noise spikes. |
The peak detector's response to noise can be improved by using a 'slow' peak detector that does not respond to very short pulses. This is often done by using a resistor in series with the diode to limit the charging current. |

|
Section 13: The Peak Detector and the Signal's Edges |
The peak detector must capture the signal's peaks and valleys accurately. The signal's edges are the transitions between the bars and spaces. The peak detector must have a fast response to the edges to capture the correct peak value. |
The peak detector's response to the edges is determined by the diode's forward resistance and the capacitor's value. A larger capacitor gives a slower response. A smaller capacitor gives a faster response. |
Section 14: The Peak Detector and the Ambient Light |
The ambient light creates a DC offset on the signal. The peak detector tracks the signal's peaks and valleys relative to the offset. The threshold is set to the midpoint between the peak and valley. The ambient light does not affect the threshold because it shifts both the peak and valley equally. |
However, if the ambient light changes rapidly, the peak detector must track the change. The time constant must be short enough to track the change. |

|
Section 15: The Peak Detector and the Temperature |
The peak detector's performance is affected by temperature. The diode's forward voltage drop changes with temperature. The capacitor's value changes with temperature. The resistor's value changes with temperature. |
The active peak detector is less affected by temperature because the op-amp's feedback loop compensates for the diode's forward voltage drop. The passive peak detector is more affected by temperature. |
Section 16: The Peak Detector and the Component Tolerances |
The peak detector's accuracy is affected by component tolerances. The diode's forward voltage drop can vary from unit to unit. The capacitor's value can vary by +/- 10%. The resistor's value can vary by +/- 1%. |
The variations in the component values cause variations in the threshold. The variations are usually small enough not to affect the scanner's performance. The comparator's hysteresis compensates for small variations in the threshold. |

|
Section 17: The Peak Detector and the 'Decode Security' Setting |
The 'Decode Security' setting in Honeywell's scanners is related to the peak detector. The Decode Security setting adjusts the aggressiveness of the adaptive threshold. A lower setting makes the threshold more aggressive, which is useful for low-quality barcodes. A higher setting makes the threshold more conservative. |
The Decode Security setting effectively adjusts the peak detector's time constant. A lower setting gives a shorter time constant, which makes the peak detector more responsive to changes. A higher setting gives a longer time constant, which makes the peak detector more stable. |
Section 18: The Peak Detector and the 'Minimum Contrast' Setting |
Datalogic's scanners have a 'Minimum Contrast' setting. This setting specifies the minimum contrast between the black and white levels. The contrast is the difference between the peak and valley. The threshold is set to the midpoint. |
The Minimum Contrast setting can be adjusted manually. If the automatic threshold is not suitable, the user can set the threshold manually. This is useful for very low-contrast barcodes, where the automatic peak detector may not work reliably. |

|
Section 19: The Peak Detector and the 'ROI Threshold' |
Datalogic's scanners also have a 'ROI Threshold' setting. This setting specifies the minimum contrast within the region of interest (ROI). The ROI is the part of the image that is decoded. The ROI Threshold ensures that the decoder only decodes areas with sufficient contrast. |
The ROI Threshold is independent of the peak detector. The peak detector sets the adaptive threshold; the ROI Threshold sets a quality level for the image. |
Section 20: The Peak Detector and the 'Object Sense' Mode |
The 'Object Sense' mode in Datalogic's scanners uses the peak detector to detect when an object is present. The peak detector monitors the signal's amplitude. If the amplitude exceeds a certain level, the scanner assumes that an object is present and starts scanning. |
The peak detector in this mode is used as a presence detector. It is a simple and reliable way to detect objects. The threshold is set to a fixed level, not an adaptive level. |

|
Section 21: The Peak Detector and the 'Automatic Threshold' in Datalogic's AV7000 |
The 'Automatic Threshold' in Datalogic's AV7000 uses a peak detector algorithm. The algorithm automatically determines the contrast between the black and white levels. The algorithm analyzes the histogram of the pixel values. The threshold is set to the midpoint between the two peaks of the histogram. |
This is a digital peak detector. It does not use a diode and capacitor; it uses a software algorithm. The digital peak detector is more accurate and more flexible than the analog peak detector. |
Section 22: The Peak Detector and the 'Derivative-Based' Threshold |
MicroVision's derivative-based threshold uses the signal's first derivative to adjust the threshold. The peak detector in this case is used to measure the derivative amplitude. The threshold is set based on the derivative amplitude. |
This is a more advanced peak detector. It does not just capture the signal's peak and valley; it captures the rate of change of the signal. This provides better noise immunity and more accurate edge detection. |

|
Section 23: The Peak Detector and the 'Static and Dynamic' Threshold |
MicroVision's patent also describes a threshold that consists of a 'static portion' and a 'dynamic portion'. The static portion is a constant value. The dynamic portion is based on the charge or discharge profile of a capacitor. |
The dynamic portion of the threshold is generated by a peak detector circuit. The peak detector charges and discharges a capacitor. The capacitor's voltage is used as the dynamic portion of the threshold. |
Section 24: The Peak Detector and the 'Ternary Barcode' System |
The dual-threshold system for ternary barcodes uses two peak detectors. The two peak detectors generate two thresholds: one between black and gray, and one between gray and white. |
The two thresholds are generated by attenuating the envelope of the barcode signal. The envelope is generated by a low-pass filter. The envelope is then attenuated to create the two reference levels. These are effectively peak detectors with different attenuations. |

|
Section 25: The Peak Detector and the '2D Ternary Barcode' System |
The 2D ternary barcode system uses a time-sharing laser emission method. The system effectively doubles the scanning speed by using two lasers. The peak detectors are used to capture the signals from both lasers. |
The peak detectors in this system must be fast enough to handle the high scanning speed. The time-sharing method is a clever way to achieve a high speed without requiring ultra-fast peak detectors. |
Section 26: The Peak Detector and the 'Reflectance Profile' |
MicroVision's patent describes the adaptive threshold based on the 'first derivative of a reflectance profile'. The reflectance profile is the signal from the photodetector. The peak detector is used to measure the derivative. |
The peak detector in this case is a differentiator. It measures the rate of change of the signal. The threshold is set based on the derivative amplitude. |

|
Section 27: The Peak Detector and the 'Static Portion' |
MicroVision's patent also describes the threshold as comprising a 'static portion'. The static portion is a constant voltage. The static portion provides a baseline for the threshold. |
The static portion is added to the dynamic portion. The dynamic portion is the output of the peak detector. The sum of the static and dynamic portions is the adaptive threshold. |
Section 28: The Peak Detector and the 'Dynamic Portion' |
The dynamic portion of the threshold is the output of the peak detector. The peak detector charges and discharges a capacitor. The capacitor's voltage is the dynamic portion. |
The dynamic portion is based on the charge or discharge profile of the capacitor. The charge profile depends on the signal's amplitude. The discharge profile depends on the time constant. |

|
Section 29: The Peak Detector and the 'Charge Profile' |
The charge profile of the capacitor is determined by the diode's forward resistance and the capacitor's value. A lower forward resistance gives a faster charge. A smaller capacitor gives a faster charge. |
The charge profile determines how quickly the peak detector responds to the signal's peaks. A fast charge profile is needed for high-speed scanning. |
Section 30: The Peak Detector and the 'Discharge Profile' |
The discharge profile of the capacitor is determined by the resistor and the capacitor's value. A larger resistor gives a slower discharge. A larger capacitor gives a slower discharge. |
The discharge profile determines how long the peak detector holds the peak. A slow discharge profile is needed for long barcodes. |

|
Section 31: The Peak Detector and the 'Attenuation' of the Envelope |
In the ternary barcode system, the envelope of the signal is attenuated. The attenuation is used to generate the two thresholds. The envelope is the low-frequency component of the signal. |
The attenuation is a fixed value (e.g., 60% and 25%). The attenuated envelope is used as the threshold for the comparator. This is a simple and effective way to generate the thresholds. |
Section 32: The Peak Detector and the 'Time-Sharing Laser Emission' |
The 2D ternary barcode system uses a time-sharing laser emission method. This method uses two lasers that are pulsed alternately. The peak detectors capture the signals from the two lasers. |
The time-sharing method effectively doubles the scanning speed. The peak detectors must be fast enough to handle the alternating signals. |

|
Section 33: The Peak Detector and the 'Sampling Rate' |
The peak detector's sampling rate is determined by the time constant. A shorter time constant gives a higher effective sampling rate. A longer time constant gives a lower effective sampling rate. |
The sampling rate must be high enough to capture the signal's peaks and valleys. The signal's frequency is determined by the scanning speed and the bar width. |
Section 34: The Peak Detector and the 'Resolution' |
The peak detector's resolution is the smallest change in voltage that it can detect. The resolution is determined by the diode's forward voltage drop and the noise. |
The active peak detector has a higher resolution than the passive peak detector. The active peak detector eliminates the diode's forward voltage drop. |

|
Section 35: The Peak Detector and the 'Accuracy' |
The peak detector's accuracy is the difference between the measured peak and the actual peak. The accuracy is determined by the diode's forward voltage drop, the component tolerances, and the temperature drift. |
The active peak detector has a higher accuracy than the passive peak detector. The active peak detector compensates for the diode's forward voltage drop. |
Section 36: The Peak Detector - A Summary of Best Practices |
Based on our exploration, let us summarize the best practices for implementing the peak detector in a barcode scanner: |
1. Choose the Right Type: For most applications, a passive peak detector with a Schottky diode is sufficient. For high-accuracy applications, an active peak detector is preferred. |
2. Set the Time Constant: The time constant must be long enough to hold the peak during the barcode, but short enough to track changes in the ambient light. A time constant of 0.5-2 seconds is typical. |
3. Select the Components Carefully: Use a Schottky diode with a low forward voltage drop. Use a low-leakage capacitor (e.g., a film or ceramic capacitor). Use a metal film resistor with a low temperature coefficient. |
4. Consider the Temperature: The peak detector's performance is affected by temperature. Use components with low temperature coefficients. Consider using an active peak detector to compensate for temperature drift. |
5. Test the Peak Detector: The peak detector must be tested with a variety of signals, under a variety of conditions, to ensure that it is working correctly. |

|
Final Summary |
The peak detector is the circuit that remembers the signal's extremes. It captures the white level (the peak) and the black level (the valley) and holds them. The adaptive threshold is then set to the midpoint between these two remembered levels. |
We have seen how major companies have implemented peak detectors in their products. Symbol's LS2208 uses a classic passive peak detector with a Schottky diode. Honeywell uses an active peak detector in their imagers. Datalogic uses a dual peak detector for their advanced automatic gain control. Texas Instruments and Analog Devices provide reference designs that include peak detectors. |
The peak detector is a critical component of the barcode scanner. It enables the adaptive threshold, which is essential for reliable barcode reading. The peak detector is a simple circuit in concept, but its design requires careful consideration of the time constant, the diode's forward voltage drop, and the component tolerances. |
The peak detector is the memory of the scanner. It remembers the brightest and darkest moments, and it uses that memory to make the right decision on every bar and space. |