Start/Stop Patterns: The Anchor Points of the Barcode World |
Executive Summary |
This article provides a comprehensive exploration of start and stop patterns, the essential anchor points that enable barcode decoders to locate, orient, and parse barcode symbols. We examine how these unique patterns serve as the 'bookends' of a barcode, allowing the decoder to determine where the data begins and ends, which direction the barcode is oriented, and which symbology is being used. Rather than focusing on abstract theory, we ground every concept in concrete design examples and real patent disclosures from industry leaders including Symbol Technologies, Intermec, and Metrologic. We explore how decoders locate start/stop patterns within captured images, how the patterns are used to establish unit measurements for decoding, and how they enable robust decoding even when the barcode is damaged or out of focus. The article covers both traditional 1D barcodes like Code 39 and Codabar, as well as 2D matrix codes, with special attention to the practical algorithms that make modern barcode reading possible. The closing summary synthesizes the key lessons and offers practical guidance for anyone implementing barcode decoding algorithms. |

|
Chapter 1: The Bookends of the Barcode |
Imagine trying to read a sentence where you don't know where the words begin or end, and you don't even know which direction the text is facing. That is the challenge a barcode decoder faces every time it scans a symbol. The start and stop patterns are the decoder's anchor points---the bookends that tell it where the data begins, where it ends, and how to interpret what lies between. |
The start and stop patterns are unique sequences of bars and spaces that appear at the beginning and end of a barcode symbol. They serve multiple essential functions. First, they identify the symbology being used---different barcode types have different start/stop patterns. Second, they tell the decoder which direction the barcode is oriented---whether the reader is scanning from left to right or right to left. Third, they provide a reference for measuring the widths of the data elements, enabling the decoder to compensate for variations in scanning speed and print quality. |
A patent from Symbol Technologies explains the significance of start/stop patterns in a bar code symbol: 'A true quiet zone follows or precedes a start/stop character. Identification subsystem searches along the selected scan line at high resolution to identify a start/stop character.' The quiet zone is the blank area that must precede and follow a barcode, and the start/stop character is the pattern that immediately abuts it. |

|
Chapter 2: The Structure of a Barcode Symbol |
A typical 1D barcode symbol consists of several distinct components, arranged in a specific order. Using Code 39 as an example, the structure is representative of most linear barcodes: the left-hand quiet zone, the start character, the data characters, an optional check digit, the stop character, and the right-hand quiet zone. |
The quiet zones are blank areas (usually white) that must be present at both ends of the symbol. They allow the decoder to recognize where the barcode begins and ends. In Code 39, the quiet zone must be at least 10 times the width of the narrowest element (the X dimension). |
The start and stop characters are special patterns that mark the boundaries of the data. In Code 39, both the start and stop characters are the asterisk character. The encoder includes the asterisk at the beginning and end of the symbol, and the decoder looks for this pattern to locate the symbol. Depending on the scanner, the asterisks may be included in the human-readable text. |
The data characters encode the actual information. In Code 39, each character consists of five bars and four spaces, with three of the nine elements being wide and the rest narrow. The pattern of wide and narrow elements determines which character is represented. |

|
Chapter 3: Code 39's Start/Stop Character |
Code 39 is one of the most widely used barcode symbologies, particularly in industrial and non-retail environments. Its start/stop character---the asterisk---has a unique structure that is essential for decoding. |
The Code 39 start/stop pattern consists of a specific sequence of wide and narrow elements. In a modern software implementation, the decoder searches for this pattern to locate the barcode. The Dart language implementation of a Code 39 decoder provides a practical example: |
```dart |
// Find start pattern (*) |
final startInfo = _findStartPattern(runs); |
if (startInfo == null) return null; |
``` |
This code searches the run-length encoded data for the asterisk pattern. If the pattern is not found, the decoder returns null---no barcode has been detected. |
Once the start pattern is found, the decoder extracts the narrow width measurement from it. This narrow width becomes the reference for decoding the rest of the symbol. The start pattern typically provides nine runs of data, which the decoder skips before reading the first data character. |
After processing the data characters, the decoder looks for the stop pattern (again the asterisk). When it finds the stop pattern, it validates the quiet zone after it. If the quiet zone is too small, the decode is rejected. |

|
Chapter 4: Codabar's Start/Stop System |
Codabar is a symbology with a distinctive start/stop system. It uses four possible start characters (A, B, C, D) and four corresponding stop characters (also A, B, C, D, or their equivalents T, N, *, E). This provides 16 possible start/stop combinations. |
The Codabar start/stop characters are not just markers---they are part of the encoded data. The decoder must present the start and stop characters as part of the decoded value. This is different from Code 39, where the asterisk is a fixed marker that is not part of the data. |
In Codabar, the main characters (digits 0-9, dash, and dollar sign) each consist of four bars and three spaces, with one wide bar and one wide space. The start/stop codes are structurally different: they have one wide bar and two adjacent wide spaces. This structural difference makes them easily distinguishable from data characters. |
The four start/stop character equivalents (A/T, B/N, C/*, D/E) provide flexibility. This allows Codabar to encode additional information in the choice of start and stop characters, though in practice this feature is often not used. |

|
Chapter 5: Locating Start/Stop Patterns in 2D Symbols |
For 2D barcodes like Data Matrix and QR codes, the concept of start/stop patterns is extended to finding the symbol's boundaries and orientation. A patent from a barcode decoder manufacturer describes a comprehensive method for locating start and stop patterns in a 2D image. |
The decoder scans the image data horizontally across rows, looking for start or stop patterns. The start pattern for a 2D symbol typically consists of a characteristic pattern of bars and spaces at the symbol's edge. When the decoder finds at least two start patterns or two stop patterns, it can determine the orientation of the symbol. |
The process involves several steps: |
1. The decoder searches for start or stop patterns in the image data. |
2. If at least two patterns are found, a line is drawn through them to determine the orientation. |
3. The decoder will try to accumulate more than two patterns, up to a predetermined limit. |
4. The 'best' patterns are selected---those with no defects and as far apart as possible. |
5. Alternatively, all detected patterns can be used to fit a straight line using a least squares fit. |
This robust approach ensures that the decoder can handle damaged symbols. If some start or stop patterns are obscured, the decoder can still determine the symbol's orientation from the remaining patterns. |

|
Chapter 6: Determining Symbol Orientation |
Once the start and stop patterns are located, the decoder must determine the symbol's orientation. This is essential for correctly interpreting the data. |
The orientation is determined by the relative locations of the start and stop patterns. A straight line perpendicular to the rows of the symbol can be drawn through two points representing the start or stop patterns. This line defines the orientation. |
The decoder uses the orientation information to locate the four corners of the symbol. For the start pattern, this is done by first determining a straight line through the center of the first bar of the start pattern. Then, starting from two points located inside the first bar, the decoder searches outward along this line for the edges of the symbol. |
The corner points are found by detecting large changes in gray level along the search line. The edges of the symbol are determined by these changes. A similar procedure is carried out for the stop pattern to find the other two control points. |

|
Chapter 7: Verifying the Symbol is a Rectangle |
After the control points are located, the decoder must verify that they form a rectangle. This validation step ensures that the symbol has been correctly identified and that the orientation is correct. |
The verification process involves checking that adjacent sides of the symbol are at right angles to each other. This is done by converting the sides into vectors and computing their dot products. If the absolute value of the dot product is less than a small threshold, the lines are deemed perpendicular. |
If all adjacent sides are perpendicular, the symbol is confirmed to be rectangular. If any two adjacent lines are not perpendicular, the symbol is rejected. |
If the control points do not form a rectangle, it is likely that one or more corners are damaged. The decoder then attempts to correct the damage by determining two control lines along the top and bottom edges of the symbol and checking if each control line has been determined correctly. |

|
Chapter 8: Corner Defect Correction |
When a symbol is damaged---a corner torn away or obliterated by a stain---the control points will not form a rectangle. The decoder has a method for correcting such damage. |
The decoder determines two control lines along the top and bottom edges of the symbol. It then checks to see if each control line has been determined correctly. For example, if one of the corners is torn away, one of the control lines will be incorrect. |
To determine whether a control line is correct, the decoder finds two neighboring lines parallel to the control line and on opposite sides. These neighboring lines are a predetermined distance, such as five pixels, away from the control line. If the control line is correct, one neighboring line should contain both a start and a stop pattern, while the other should contain neither. |
Once it is determined that one control line is correct, the other control line is corrected so that it is parallel to the correct control line. The new control line can then be verified by determining two neighboring lines as before. This process effectively corrects the damaged corner. |

|
Chapter 9: Establishing Unit Measurement from Start/Stop Patterns |
The start and stop patterns are not just locators---they are also a powerful tool for determining the unit measurement used to decode the symbol. The unit measurement is the width of a narrow element, which is essential for interpreting the widths of the bars and spaces. |
A patent from Intermec describes a method for using the Code 39 start character to establish a unit measurement: |
- The first measurement is the lateral distance from the quiet zone to the center of the wide space. |
- The second measurement is from the center of the wide space to the center of the first wide bar. |
- The third measurement is the center-to-center spacing of the wide bars. |
The first and third measurements are both distances between adjacent wide elements and have similar widths. The second measurement is between opposite wide elements and contains two narrow elements, making it larger by a single narrow element width. Therefore, the difference in count between these measurements provides a single narrow element unit size. |
The stop character offers similar measurements. Adjacent wide element counts can also be used to judge acceleration of the scanning beam, allowing the decoder to remove distortion caused by varying scan speed. |

|
Chapter 10: The Lost Element Matrix |
Once the unit measurement is established, the decoder can construct a 'lost element matrix.' This matrix is used to determine how many narrow elements have been lost (i.e., are not resolved due to poor focus or print quality). |
The lost element matrix is assembled starting with the adjacent wide element measurement (which contains a single narrow element) and the opposite wide element measurement (which contains two narrow elements). The rest of the matrix is assembled by adding (or subtracting) the unit value. |
To determine the number of lost elements, the measured count is compared to the matrix table. The closest value with the appropriate element parity (odd/even) is the correct number of lost elements. This allows decoding of barcodes where the narrow elements are not resolved, dramatically improving depth of field performance. |
The realization that element count parity must be preserved adds considerable tolerance to this procedure. The count values can be off by as much as a whole unit in either direction before an error can be made. This makes the decode adequately robust. |

|
Chapter 11: Decoding I2/5 Using Start/Stop Patterns |
For the Interleaved 2 of 5 (I2/5) symbology, the stop count can be used to locate wide element pairs that do not enclose unresolved narrow element pairs. Since the transition from the stop wide bar to the quiet zone contains exactly one element pair, distance counts less than the stop count do not contain any unresolved narrow element pairs. |
An adjustable parameter determines the range about the stop count that can be expected to distinguish counts materially less than the stop count. Plus and minus ten percent is a good starting point for the stop decode tolerance. Counts less than the stop minus ten percent are considered to be free of unresolved element pairs. |
If a wide space and bar are next to each other, no narrow elements are present, whereas adjacent like wide elements are separated by an unresolved single narrow element. Using the stop count tolerance, single element pairs can be located if the count between wide elements equals the stop count. |
If an adjacent wide element count internal to the profile is greater than the stop count, it can be compared to a matrix similar to the Code 39 matrix. The unit measurement can be estimated as the stop distance divided by 3.25 and then reconfirmed by the difference of adjacent and opposite elements. The stop count represents 3.5 modules in a symbol with N=3 and 3 modules in a symbol with N=2; the value 3.25 works well with a variety of closure profiles. |

|
Chapter 12: Start/Stop Pattern Validation |
A key part of the decoding process is validating the start and stop patterns. The decoder must ensure that a potential quiet zone is a true quiet zone, not a false one. |
The validation process involves searching along the selected scan line at high resolution for a start/stop character. The search direction is determined by the type of state transition detected. If a state transition from bright to dark was detected, the symbol may follow the potential quiet zone, so the decoder searches in the same direction. If the transition was from dark to bright, the symbol may precede the potential quiet zone, so the decoder searches in the opposite direction. |
The decoder compares the identified character to a reference table containing start/stop characters for all supported symbologies. If a match is found, the symbol is confirmed. If not, the potential quiet zone is rejected as false. |
Chapter 13: Verifying Start/Stop Identification |
To ensure robust decoding, the decoder verifies the start/stop identification by searching along lines parallel to the selected scan line. This confirms that the identified pattern is not a spurious match due to noise. |
The verification process involves generating a sequence of symbol element widths from the signal energy values along the scan line. Each element in the sequence has a width and is either a bar or a space. If the same start/stop character is found along parallel lines, the identification is confirmed. |
This approach is particularly important in image-based decoding, where noise and distortion can cause false matches. By verifying along multiple lines, the decoder ensures that only true barcode symbols are decoded. |

|
Chapter 14: Start/Stop Patterns in Historical Decoders |
The importance of start/stop patterns has been recognized since the early days of barcode technology. A patent from 1977 describes a code discriminator for the Universal Product Code (UPC) that uses the guard pattern (the start and stop patterns) to establish a standard bit interval. |
In this early implementation, the guard pattern is read to count the total width of the black and white basic modules. The standard bit interval is then given by this total divided by two. This averaging minimizes the unfavorable influence of printing accuracy. |
The discrimination of the first character is performed by sampling the code in start-stop synchronization using the standard bit interval. For subsequent characters, a new standard bit interval is determined by the total length of the previous character divided by the number of modules in one character. |
This approach, which is over 40 years old, embodies the same principles used in modern decoders. The start/stop patterns provide the anchor points that enable the decoder to establish the timing reference needed for decoding. |
Chapter 15: Multiple Symbol Decoding |
In systems that need to decode multiple barcodes in a single image, the start/stop patterns enable the decoder to ignore previously decoded symbols. This is important for efficiency and accuracy. |
After a symbol is decoded, the system retains information about the region of the pixel image containing that symbol. During subsequent processing, the system ignores that region. This means that potential quiet zones associated with already decoded symbols are not considered. |
This 'ignore' mechanism ensures that the decoder does not waste time re-processing symbols that have already been decoded. It also prevents confusion when symbols are close together. |

|
Chapter 16: The Start/Stop Pattern in Code 39 Decoding |
A practical implementation of Code 39 decoding illustrates the use of start/stop patterns in detail. The decoder first locates the start pattern by searching for the asterisk character pattern. |
Once the start pattern is found, the decoder extracts the narrow width from it. This narrow width is the reference for the entire decode. The decoder then skips the start pattern (nine runs) and begins decoding the data characters. |
After each data character, the decoder validates the inter-character gap. The gap should be a narrow space; if it is too wide, the decode fails. This validation ensures that the decoder is correctly parsing the character boundaries. |
The decoder continues processing characters until it finds the stop pattern (again the asterisk). It then validates the quiet zone after the stop pattern. If the quiet zone is at least 10 times the narrow width, the decode is accepted. Otherwise, it is rejected. |
Chapter 17: The Role of Quiet Zones |
The quiet zones are an integral part of the barcode structure. They are not decorative---they are essential for reliable decoding. |
The quiet zone is the blank area that must precede and follow the barcode. In Code 39, the quiet zone must be at least 10 times the width of the narrowest element (X) or 0.10 inches, whichever is greater. |
The quiet zone serves two purposes. First, it tells the decoder where the barcode begins and ends. Without a quiet zone, the decoder might start reading in the middle of a character. Second, it provides a reference for the signal amplitude. The reflectance of the quiet zone sets the baseline for distinguishing bars from spaces. |
The quiet zone is so important that the decoder validates it after finding the start and stop patterns. In the Code 39 decoder, the quiet zone after the stop pattern must be at least 10 times the narrow width. If it is smaller, the decode is rejected. |

|
Chapter 18: Stop Pattern Tolerances |
The stop pattern tolerance is an important parameter in decoding. It defines the range of widths that the decoder will accept as a valid stop pattern. |
For I2/5 decoding, the stop count is used as a reference. The stop decode tolerance is typically plus or minus ten percent. Counts that are less than the stop count minus ten percent are considered to be free of unresolved element pairs. |
This tolerance allows the decoder to handle variations in print quality and scanning speed. The stop pattern may not be perfectly measured, but the tolerance ensures that it is still recognized. |
The stop pattern tolerance also helps with decode robustness. If the measured count is close to the stop count, it is considered a match. This reduces the chance of rejecting a valid barcode due to minor measurement errors. |
Chapter 19: Verifying Start/Stop Character Identification |
The start/stop character identification is verified by comparing the identified pattern to a reference table. This table contains the start/stop characters for all supported symbologies. |
The reference table includes the unique sequence of element widths for each start/stop character. For example, the Code 128 start character has 6 elements (3 bars and 3 spaces), but it can be uniquely identified by characterizing only the first 5 elements. |
The verification process involves generating a first sequence of element widths from the signal. If this sequence matches one of the reference patterns, the start/stop character is identified. This approach allows the decoder to support multiple symbologies without confusion. |

|
Chapter 20: The Practical Implementation of Start/Stop Decoding |
The practical implementation of start/stop decoding involves several steps. First, the decoder locates potential quiet zones by scanning the signal for transitions. Then, it attempts to identify a start/stop character. |
If the start/stop character is identified, the decoder proceeds to locate the four corners of the symbol. It then decodes the data characters and validates the check digit (if present). Finally, it identifies the stop character and validates the quiet zone. |
This process is implemented in software, using run-length encoded data or pixel intensity values. The decoder must be robust enough to handle variations in print quality, scanning speed, and image resolution. |
Modern decoders support multiple symbologies, including UPC, EAN, Interleaved 2 of 5, Codabar, Code 39, Code 128, Code 93, Code 49, and Code 16K. The start/stop patterns for each symbology are stored in a reference table. |
Chapter 21: Start/Stop Patterns and Symbology Identification |
Start/stop patterns are unique to each symbology, making them the primary means of identifying which symbology is being read. |
In Code 39, the start and stop characters are always the asterisk. In Codabar, the start/stop characters are A, B, C, D (or their equivalents). In Code 128, the start characters are different patterns that also encode a code set selection. |
The decoder uses the start/stop pattern to identify the symbology and then applies the appropriate decoding rules. This allows a single decoder to handle multiple barcode types without user intervention. |
Some symbologies, such as EAN, do not have visible start or stop characters. In these cases, the decoder must use other features, such as the guard patterns, to locate the symbol. |

|
Chapter 22: The Star Character in Code 39 |
The star character in Code 39 is both the start and stop character. Its pattern is a specific sequence of five bars and four spaces, with three of the nine elements being wide. |
The star character serves as a reference for the narrow width. When the decoder finds the star pattern, it measures the widths of its elements and uses the narrowest width as the unit measurement for the rest of the symbol. |
The star character also appears in the human-readable text. Depending on the scanner, the asterisks may be included or excluded from the displayed data. By default, many systems include them. |
The star character is the only character in Code 39 that is used as both start and stop. This unique role makes it especially important in the decoding process. |
Chapter 23: Corrupted Start/Stop Patterns |
When a barcode is damaged, the start/stop patterns may be corrupted. The decoder must be able to handle this scenario and still decode the symbol. |
If the start pattern is corrupted, the decoder may not be able to locate the symbol. However, if the stop pattern is still intact, the decoder can use it to find the symbol and then work backward to locate the start pattern. |
If both the start and stop patterns are corrupted, the decoder may need to use other features, such as the data pattern or the edge locations, to locate the symbol. This is more difficult and may require multiple scans. |
The corner defect correction method described in the Symbol Technologies patent provides a robust way to handle damaged corners, including those at the start and stop patterns. |

|
Chapter 24: Start/Stop Patterns in Video Barcode Decoders |
Video barcode decoders, which use camera images rather than scanning beams, rely heavily on start/stop patterns for locating and orienting symbols. The process is more complex than in laser scanners because the image must be processed in two dimensions. |
The video decoder scans the image at low resolution for potential quiet zones. When a quiet zone is found, it searches along the scan line at high resolution for a start/stop character. The search direction depends on the type of transition detected. |
Once a start/stop character is identified, the decoder verifies it by searching along parallel lines. It then locates the four corners of the symbol and decodes the data. |
This process is repeated for different scan lines until the entire image has been processed. The decoder ignores regions of the image that contain previously decoded symbols. |

|
Chapter 25: Summary --- Start/Stop Patterns in Perspective |
Start and stop patterns are the essential anchor points of the barcode world. They enable the decoder to locate, orient, and parse a barcode symbol, even when the symbol is damaged or out of focus. |
We have examined how different companies and technologies have approached the challenges of start/stop pattern decoding: |
Symbol Technologies developed methods for locating start/stop patterns in 2D images, determining symbol orientation, and correcting for corner defects. The decoder uses multiple start/stop patterns to fit a line through the symbol, handling cases where some patterns are damaged. |
Intermec developed a method for using the Code 39 start/stop patterns to establish a unit measurement and construct a lost element matrix. This allows decoding of symbols where narrow elements are not resolved, dramatically improving depth of field performance. |
Metrologic developed methods for validating quiet zones and identifying start/stop characters against a reference table of symbologies. The decoder verifies identification by searching along parallel lines. |
Early UPC decoders used the guard pattern to establish a standard bit interval and sample characters in start-stop synchronization. This approach is still used in modern decoders. |
Modern software implementations demonstrate the practical application of these principles, with decoders that search for start patterns, extract narrow widths, validate gaps, and check quiet zones. |

|
The key lessons from our exploration are: |
Start/stop patterns are the anchor points of decoding. They tell the decoder where the data begins and ends, which direction the barcode is oriented, and which symbology is being used. |
The quiet zone is essential. It provides the baseline for distinguishing bars from spaces and tells the decoder where the symbol begins. The decoder validates the quiet zone before and after the start/stop patterns. |
Start/stop patterns provide a reference for width measurement. The narrow width of the start/stop pattern establishes the unit measurement for the entire symbol. This allows the decoder to compensate for variations in scanning speed and print quality. |
Multiple start/stop patterns enable orientation determination. In 2D symbols, the decoder uses multiple start/stop patterns to determine the symbol's orientation and locate its corners. |
Start/stop patterns enable symbology identification. Each symbology has unique start/stop patterns, allowing a single decoder to support multiple barcode types. |
In the end, start/stop patterns are a testament to the ingenuity of barcode designers. They are simple yet powerful, providing the anchor points that make robust decoding possible even in the presence of noise, damage, and distortion. The art of start/stop pattern decoding lies in the careful balance of sensitivity and robustness, ensuring that the decoder can find the anchor points even when they are buried in the noise of the real world. |