Technology Update: Machine vision can ensure reliable, repeatable bar code inspection
When applied for bar code reading (BCR), a vision system can ensure each product on a packaging line contains the proper bar code—which in turn contains the proper product identification and manufacturing location data. UPC symbols, for instance, include five digits of data about the product manufacturer and five digits about the specific product. Here’s how it works. October Control Engineering
As the standards for product and ingredient quality face ever more stringent agency regulations, bar code reading, verification, and grading are increasingly important in many inspection processes. Commonly used in pharmaceutical applications for traceability purposes, bar codes are now used for a similar purpose in food and beverage applications. They are also more frequently applied in industrial applications, enabling recalled product to be quickly identified and tracked back to its manufacturing origin, easing the recall process.
Machine vision is often used for bar code inspection in the above areas, as the proper combination of vision sensor hardware, software, and lighting can deliver efficient, effective analysis in these applications. When applied for bar code reading (BCR), a vision system can ensure each product on a packaging line contains the proper bar code—which in turn contains the proper product identification and manufacturing location data. UPC symbols, for instance, include five digits of data about the product manufacturer and five digits about the specific product. The ECC 200 Data Matrix, a two-dimensional bar code symbol type, can greatly increase the amount of data stored within a code: a single data matrix symbol can encode up to 2335 numbers of 1555 ASCII characters. In each of these cases, vision sensors capture an image of the bar code on the inspected product, and then analyze the captured image to “decode” the symbol—thus “reading” the code to verify its contents.
Vision sensors may additionally be applied to grade bar codes. Grading is used to ensure each product contains a clear, high-contrast, and complete code that can be successfully read throughout the manufacturing process. Bar codes also must be successfully read once the product reaches shipping, retailers, and finally consumers. Grading is performed on an A to F scale based upon a number of parameters, including “Symbol Contrast,” which involves how well the black and white portions of a bar code can be distinguished from one another. If the bar code does not exhibit sufficient contrast between these two elements, it may be illegible downstream. A successful vision inspection will not only grade a bar code but will reject a product if it fails the inspection, possibly indicating whether the device marking the bar codes is low on ink—thus preventing future rejected products.
Most vision sensors with BCR capabilities can identify a bar code placed at any orientation, so long as the entire code falls within the camera’s field-of-view. The overall size of the bar code symbol is often not a concern; some data matrix symbols can consist of cells as small as .001 in. on a side. Such small marks are readable by a vision sensor with the proper lens. However, the bar code must meet certain resolution requirements in order to be successfully read. For most applications, the narrowest bar in a linear code must be at least three pixels wide in order to be legible. The same is true of the cells within a data matrix.
Vision for bar code inspection
Just as contrast is a pivotal parameter in successful bar code grading, contrast between the bar code symbol and the material on which it is located is key to the success of a vision inspection. Often, ambient light within a factory environment does not illuminate a product’s bar code evenly enough for a vision sensor to always obtain a clear image of the code. Even if ambient lighting is plentiful, it is often inconsistent due to plant windows or skylights. Poor lighting affects the ability of the vision sensor to read a bar code in a consistent manner from product to product, leading to unreliable results. A dedicated vision lighting solution establishes the contrast required to attain accurate, repeatable results from a vision inspection.
Of the many varieties of vision lighting types and techniques that are available, ring lights are the most commonly used lighting for bar code inspection. Ring lights mount directly to the camera and surround the camera lens, aiming illumination toward the feature of interest—in this case, the bar code. This dedicated lighting technique ensures both sufficient and uniform lighting, allowing the vision sensor to consistently obtain an image with high accuracy. For long-lasting illumination, ring lights are available utilizing LEDs, which provide a usable life of 100,000 hours.
Lighting is one of several components that comprise vision sensor hardware, which also includes the camera, processor, and lens. For BCR applications, vision hardware should be selected based on the size of the bar code and how it is placed within the camera’s field of view. A bar code symbol can vary greatly in size, from a few inches to less than a millimeter wide. The lens chosen should provide a field of view that accommodates the bar code’s size, as well as the entire product region on which the bar code may be placed. For applications where bar codes are mechanically stamped or applied in precisely the same location each time, the field of view can generally be smaller, allowing the use of a standard resolution camera in many cases. If the bar code is hand-placed, the field of view must be expanded to include the entire product region on which it may appear. In these instances, a high-resolution camera should be used to ensure the narrowest bars or cells that comprise the code, when captured by the camera, are at least three pixels wide.
The key to how a vision sensor interprets a bar code is the sensor’s operation as, essentially, an electronic light meter. The vision sensor’s imager chip is comprised of photosites, light-sensitive elements that create an electronic signal proportional to the amount of light to which they are exposed. Each photosite on an imager chip is linked to a pixel, which portrays the obtained light value from dark to bright—ranging from 0 to 255—on an 8-bit grayscale. In these terms, when contrast is created, it yields a greater numeric difference between pixels in the dark and bright portions of the bar code, making these variations easier to detect.
Software for machine vision
The final element of a vision system, the vision software, includes all programming and image algorithms required to monitor, analyze, and control an inspection. This is the component that determines whether a bar code is present, if it contains the correct data, and if the physical bar code symbol is legible. The BCR tool allows the vision sensor to capture the full bar code as an image containing both light and dark patterns for analysis. The sensor is then able to compare these light and dark patterns to the bar code symbol standards stored in the software. If the light/dark line and space variations can be identified as a known bar code symbol type, the data can be decoded.
After this determination has been made, the vision sensor uses communication tools to send inspection data via serial or Ethernet communications to a PLC or PC. Sensors that offer configurable I/Os do more than share the collected inspection data—they apply it by sorting products according to the data that each bar code contains, as well as diverting any incorrect or illegible bar codes from the line.
While the results of a vision inspection are comprehensive, the selection, setup, and programming of the sensor can be complex. Taking a cue from the explosion in touch-screen-driven consumer electronic devices from recent years, some vision sensors now offer an all-in-one solution that provides the same comprehensive inspection capabilities within a self-contained design. This type of sensor features an integrated touch screen for onsite programming but also offers a USB port to upload and download inspection parameters and results to and from a PC. A simple-to-apply design speeds operator training and lessens the programming time required for setting up a bar code inspection, all while allowing users to monitor and control the inspection in real time on the plant floor, with no external PC or other components required. These innovations, paired with a wide range of hardware options and sophisticated BCR capabilities, ensure machine vision delivers a reliable, repeatable solution for bar code inspections.
- Also read from Control Engineering:
- Brent Evanger is an applications engineer at Banner Engineering.
|Search the online Automation Integrator Guide|
Case Study Database
Get more exposure for your case study by uploading it to the Control Engineering case study database, where end-users can identify relevant solutions and explore what the experts are doing to effectively implement a variety of technology and productivity related projects.
These case studies provide examples of how knowledgeable solution providers have used technology, processes and people to create effective and successful implementations in real-world situations. Case studies can be completed by filling out a simple online form where you can outline the project title, abstract, and full story in 1500 words or less; upload photos, videos and a logo.
Click here to visit the Case Study Database and upload your case study.