img

Cognex Mobile Barcode Scanner SDK
MaxiCode

What is MaxiCode?

MaxiCode was developed by United Parcel Service (UPS) as Dense Code in the early 1990s to sort packages on high-speed conveyor belts. The two-dimensional (2D) symbology has a fixed size of one inch and consists of an array of 888 light and dark hexagonal modules arranged around a bulls-eye finder pattern (Figure 1, below). After its release into the public domain, MaxiCode was standardized according to ISO/IEC 16023. The ISO standard slightly modified the original MaxiCode design, creating some minimal spacing between adjacent modules and extending the data encoding to enable applications beyond sorting and tracking packages.

The black-and-white modules in a MaxiCode symbol are arranged in a diagonal matrix comprised of 33 rows, which alternately contain 30 and 29 modules. One MaxiCode symbol has a maximum data capacity of 93 alphanumeric characters or 138 numeric characters.

MaxiCode uses six three-module groupings on the perimeter of the outermost finder circle, each a fixed pattern, for determining orientation. Four additional modules are used to indicate the symbol’s mode (there are seven modes, discussed later). The rightmost two modules in the first row are also always black. The remaining 864 modules are used for data representation and error correction. Data characters, or codewords, are represented using 6 bits each; thus the 864 modules translate to 144 codewords in a MaxiCode barcode.

 

Figure 1 shows a MaxiCode barcode with these orientation patterns and modules highlighted.

 

pages_maxicode-text-img.png

 

Like many other two-dimensional barcodes, MaxiCode uses a sophisticated error detection and correction technique known as Reed-Solomon error correction, commonly referred to as Error Correction Codewords, or ECC. ECC is much more advanced than traditional checksums, as it is capable of not only detecting multiple errors or omissions (data that was unable to be read at all) but it can be used to correct both. With ECC, as much as 1/8 of the barcode’s codewords can be damaged, yet all the data can be successfully decoded.

MaxiCode uses one of two error correction levels: Standard Error Correction (SEC) or Enhanced Error Correction (EEC). The primary message always uses EEC, while the secondary message’s error level is controlled by the symbol mode. As identified earlier, there are seven different modes that are used to identify the error correction level as well as the format of the data. The following table lists these modes:

 

Mode Description
0 Obsolete; superseded by modes 2 and 3
1 Obsolete; superseded by mode 4
2 Symbol uses a Structured Carrier Message with a numeric postal code and Standard Error Correction
3 Symbol uses a Structured Carrier Message with an alphanumeric postal code and Standard Error Correction
4 Symbol contains general data, Standard Error Correction
5 Symbol contains general data, Enhanced Error Correction
6 Reserved; used for programming a scanner/reader

 

The most common use of MaxiCode is in the package delivery industry, and being invented and designed by UPS for just this purpose, it should come as no surprise that it supports data formatting specific to the transport of packages.

This data format is known as a Structured Carrier Message (SCM). Mode 2 and mode 3 symbols both require the data to be formatted in this fashion and dictate the specific format and content of the primary and secondary message segments.

In both cases, the primary message contains a destination postal code (9 numeric digits for a mode 2 symbol, 6 alphanumeric characters for a mode 3 symbol), a three-digit country code, the class of service, and error correction codewords (always EEC).

The secondary message contains additional shipment information like shipper number, package weight, shipment ID, destination city, and so on as well as error correction codewords (always SEC).

When a mode-2 or mode-3 MaxiCode symbol is read, the primary and secondary messages are decoded, then formatted as a single alphanumeric string using an industry-standard format ANSI MH10.8M-1993 called Structured Carrier Message (SCM). When the SCM is generated, additional header and separator information not present in the actual data of the barcode is inserted by the decoding software to meet these formatting requirements.

This ANSI-standard message format consists of a message header, a data format header, a message body, and a message terminator. The following table provides more details on each of these sections:

 

Message Header The message header is the four-character sequence [)>RS where RS represents the ASCII “Record Separator” character (hex value 0x1E). These characters identify the message as conforming to an ANSI data format.
Data Format Header This is the five-character sequence 01GS96 where GS represents the ASCII “Group Separator” character (hex value 0x1D). These characters identify the message body as conforming to the ANSI Transportation Data Format.
Message Body This is a variable-length list of shipment data fields, each separated by the Group Separator character. The last field is terminated with a Record Separator character. More details on the message body content are provided in the Table below.
Message Terminator This is the EOT character, where EOT represents the ASCII “End of Text” character (hex value 0x04).

 

Below is a summary of the data fields in the message body:

 

Ship to postal code 9-digit numeric (mode 2 symbols) or 6-character alphanumeric (mode 3 symbols) postal code
Ship to country code ISO country code
Class of service Class of service for the package
Tracking number Package tracking number
SCAC Carrier’s Standard Carrier Alpha Code (for example, for UPS this is UPSN)
UPS account number Shipper’s account number
Day of pickup Julian day of pickup
Shipment ID Shipper’s package ID number
Package in shipment Package number in the shipment (package N of X total, formatted as N/X)
Package weight Package weight in pounds
Address validation Indicates if an address validation database was used for the destination address
Ship to address Destination address
Ship to city Destination city
Ship to state/province Destination state/province

 

In most cases, it is not possible to populate all the data fields because the resulting message would be too large to fit in a MaxiCode symbol. Carriers that use the MaxiCode barcode typically provide their own guidelines for determining maximum message length and which fields to populate.

Using the syntax from above to represent the Record Separator, Group Separator, and End of Text characters, the following string represents the Structured Carrier Message from the MaxiCode example in Figure 1 (shown on two lines for readability):

 

[)>RS01GS97303281483GS840GS001GS1Z12345675GSUPSNGS

123X56GS187GSGS1/1GS37GSYGSUPSNGS123FS567GSGSGARSEOT

 

Who uses MaxiCode?

United Parcel Service uses MaxiCode in shipping all U.S. domestic and international packages. Several other carriers have adopted its use as well.

The U.S. Department of Defense has also certified MaxiCode for use as a general data symbology, though few actual implementations have resulted.

 

How do we help developers using MaxiCode?

The Cognex Mobile Barcode Scanner SDK supports MaxiCode detection, enabling developers to gather relevant workflow and application data into their own barcode-scanning apps. You can download the SDK for free by registering on the Cognex Mobile Barcode Developer Network. In addition, the Barcode Scanner SDK supports a broad range of symbologies to meet your growing development needs.

Get Started