Sorting and checking colored bottles

Oct. 1, 2007
Many machine-vision systems must perform more than simple visual checks of a product’s integrity.

Andrew Wilson, Editor, [email protected]

Many machine-vision systems must perform more than simple visual checks of a product’s integrity. Feedback controls need to be integrated within these systems to allow mechanical actuators to sort products. To do this, system designers must use off-the-shelf sensors and cameras, programmable systems such as PLCs, and pneumatic valves to control the flow of products within the system. These accessories must be tightly integrated to ensure that the system, once deployed, will function as expected.

At NIWeek in August 2007, National Instruments (NI; Austin, TX, USA; www.ni.com) displayed a system designed to both sort and check bottles. Rather than develop a simple system that merely performed typical operations such as optical character recognition on bottle labels, the company developed a fully integrated conveyor system to demonstrate how third-party hardware could be integrated with the company’s CompactRIO programmable automation controller, LabVIEW software, HMI displays, and newest smart camera.

The integrated closed-loop system was designed to sort brown bottles from blue bottles, to align the labels of the brown bottles, and to inspect only their labels for quality. The system comprised three vision stages, each of which performs a specific task (see Fig. 1). As brown and blue bottles move around the conveyor, they pass through two stations where two cameras acquire images of the bottle label and bottle neck. An NI CVS-1456 compact vision system (CVS) is triggered by signals from two Banner Engineering (Minneapolis, MN, USA; www.bannerengineering.com) proximity sensors located under the conveyor belt next to each of the cameras.

Figure 1. To sort brown from blue bottles, to align the labels of the brown bottles, and to inspect only their labels for quality, NI demonstrated a system comprising three vision stages. While the first two stages acquire images of the bottle label and bottle neck, a third stage uses a smart camera to align the labels of brown bottles.
Click here to enlarge image

“When a bottle passes over either sensor, the CVS triggers the camera and strobes the lights at the correct inspection station,” says Brad Buchanan, a staff software engineer at NI. “The CVS asynchronously acquires and inspects images from either camera. At the first station, an EC 1380 FireWire camera from Prosilica (Burnaby, BC, Canada; www.prosilica.com) acquires an image of the bottle label for quality inspection. At the second station, an A1390 FireWire camera from Basler (Ahrensburg, Germany; www.baslerweb.com) acquires an image of the bottle neck for sorting blue and brown bottles.”

The CVS analyzes the image acquired from the EC1380 for label quality. It first performs a pattern match to ensure the label inspection only occurs on the brown bottles. If the pattern-matching algorithm finds a match, it uses a Compare Golden Template algorithm to find defects and measure the area of the defects.

At the second station, the CVS analyzes images from the A1390 camera to sort the brown bottles from the blue ones. Because blue bottles have curved necks, while the brown bottles have straight necks, the CVS uses a rake filter on both sides of the bottle neck to find the edge points and calculates the deviation of the points from the line of best fit for all edges found. Since the straight neck of the brown bottles have a small amount of deviation, while the curved blue bottle necks have significant deviation, this deviation is used to sort brown from blue bottles.

“Once the CVS knows the type of bottle it has inspected, the result is added to a LabVIEW shared variable FIFO that is read by CompactRIO, an NI programmable automation controller,” Buchanan says. “When CompactRIO allows a bottle through a downstream diverter, it removes an element from the front of the shared variable FIFO. This shared variable is needed, since there is a delay between when the bottle is visually inspected by the CVS and when it is sorted by CompactRIO.”

Because of this delay between the inspection station and the diverter, CompactRIO needs to track the bottles that have been visually inspected but have not passed through the sorting station. “This enables CompactRIO to know the type of bottle when a bottle arrives at the diverter and allow the bottle to be correctly sorted and the FIFO updated,” says Buchanan.

Figure 2. To align the labels of brown bottles, the NI smart camera performs a simple label edge detection as the bottle rotates in front of the camera. A pulse train controlling the motor rotating the bottle is slowed in frequency, and, once the correct position is reached, the camera triggers CompactRIO to release the bottle from the inspection station.
Click here to enlarge image

After the diverter sorts brown and blue bottles, blue bottles are diverted to the inside track of the system and brown bottles to the outside, where their labels are aligned by the third inspection station. As the diverted brown bottles pass over a proximity sensor from Banner, the bottle is stopped and an arm extended using pneumatic valves from Festo (Hauppauge, NY, USA; www.festo.com). CompactRIO notifies the smart camera of the bottle by updating another shared variable. When the camera reads the updated shared variable, the its digital I/O controls a Danaher Motion (Wood Dale, IL, USA; www.danahermotion.com) stepper motor to rotate the bottle, and the smart camera’s integrated lighting controller begins strobing a red LED ring light from Siemens Energy & Automation (Nashua, NH, USA; www.nerlite.com).

To align the bottle, a simple edge-detection operation is used to look for the label. To do this, the NI smart camera runs a real-time operating system with inspections written in either LabVIEW or Vision Builder AI.

Depending on the results of the edge detection, the camera adjusts the speed of the motor that spins the bottle by changing the frequency of a pulse train on the optoisolated outputs of the camera. As the label comes closer to the correct position, the pulse train is slowed. “Once the label is in the correct position, the smart camera will set a shared variable to notify CompactRIO it has finished inspecting the bottle. CompactRIO then lets the bottle pass through the inspection station. In this manner, all the labels of the brown bottles are precisely aligned,” says Buchanan.

Voice Your Opinion

To join the conversation, and become an exclusive member of Vision Systems Design, create an account today!