A pharmaceutical packaging line fails in five predictable places: the label is missing or skewed, the lot or expiry code prints badly, the serialization code will not decode, the vial is underfilled, or the seal is creased. Put one inspection point at each failure mode, size the camera from the smallest feature it must catch, and match the light to the surface. This guide walks a 300 vials/min vial line station by station, with the pixel math, the exposure math and a worked 0.5 mm defect example behind every choice.
The five inspection points and what each must see
| Station | Catches | Smallest feature | Light type |
|---|---|---|---|
| 1 Label presence, skew, print | wrong, missing or skewed label | 0.5 mm print defect | diffused white |
| 2 Lot and expiry code | unreadable or wrong date | 0.3 mm stroke in 2 mm text | diffused, glare-controlled |
| 3 Serialization code | untraceable unit | 0.25 mm DataMatrix module | the reader's own light |
| 4 Fill level | underfill | meniscus edge | backlight, red or infrared |
| 5 Seal and tamper band | crease, bridge, missing foil | 1 mm crease | low-angle dark field |
One camera per failure mode keeps recipes small and rejection logic unambiguous. A multi-check station that tracks each unit can share hardware across checks, but it splits them across exposures - it never mixes lighting types in one image. The three shop categories this design draws from are smart cameras, fixed code readers and bar lights.
Size every camera from its smallest feature
Two numbers drive every camera choice here: 3 pixels across a feature to detect it, 5 to 8 pixels across it to measure it.
Worked example: the specification says catch a 0.5 mm chip or print blemish anywhere in the window.
- p = 0.5 mm / 3 px = 0.167 mm/px
- FOV = 2448 px × 0.167 mm/px ≈ 409 mm, for a typical 5 MP sensor 2448 px wide
One 5 MP camera therefore covers a 409 mm window - a full carton face or a two-lane tray - and still meets the rule. Turn the same camera to a single 30 mm vial window and p = 30 mm / 2448 px = 0.0123 mm/px, so the smallest detectable feature is 3 × 0.0123 = 0.037 mm, more than thirteen times finer than the spec.
The blister-foil version of this arithmetic, with working distance folded in, is worked through in this field-of-view and working-distance calculation for pharmaceutical blister inspection. For the detect-versus-measure trade on chips and cracks specifically, see pixels per defect: sizing a camera for crack detection.
Station 1: label presence, skew and print
The checks: label present, placed within ±1 mm, print complete. Placement is a measurement, so 5 px across 1 mm sets p = 0.2 mm/px, and a 2448-px sensor covers 2448 × 0.2 ≈ 490 mm at that pixel size. Pixels are never the constraint on this station - glare is. Glossy foil labels mirror the brightest source in view, and one saturated blob erases the print underneath it; the fixes live in removing glare from saturated pixels.
Two builds cover every line.
The compact route puts light, lens and camera in one housing:
- Interface
- GigE
- Resolution
- Up to 3 MP
The LS-SMC-0063 integrates a 1.6 MP sensor, a 16 mm lens, polarized white light and GigE, running 60 fps. A 300 vials/min line asks for 5 inspections/s, so the frame rate carries a 12× margin, and the polarization does the glare work an external diffuser would.
The wide route trades integration for field coverage:
- Interface
- Fast Ethernet
- Resolution
- 5 MP
- Sensor format
- 1/1.45"
- Shutter
- Global
The MV-SC3050XC-16M-ATN-H is a 5 MP colour vision sensor with a global shutter and an M12 mount over Fast Ethernet. Put it over a full carton face with a diffused white bar from the light finder sized to the window. Colour separates the print from the foil background, and the global shutter keeps a moving carton's edges straight. Match the light to the label surface with food packaging inspection lighting: choose by surface and defect.
Station 2: lot and expiry codes
Decide first whether you are reading the date or just verifying it is legible: the split between OCR and OCV is laid out in OCR vs OCV: character inspection for date and lot codes, and the inkjet case in OCR for expiration date verification.
Pixel math: 2 mm characters with 0.3 mm strokes need 3 px per stroke, so p ≤ 0.1 mm/px. Optics: a 40 mm date window at 120 mm working distance on a 1/1.8" sensor (7.1 mm wide) gives m = 7.1 mm / 40 mm = 0.178.
f = 120 mm × 0.178 / 1.178 ≈ 18 mm - call it 16 or 25 mm from stock focal lengths, whichever keeps the window inside the frame with mounting slack. A 12 mm lens at the same 120 mm working distance gives m = 12 / 108 = 0.111 and FOV = 7.1 / 0.111 ≈ 64 mm.
A compact reader covers that geometry from a short stand-off:
- Interface
- Fast Ethernet
- Resolution
- Up to 3 MP
- Shutter
- Global
- Lens mount
- M12
Use the MV-ID3013PM-12M-WBN where the line is tight on space: 1.3 MP, a 12 mm lens, an M12 mount and Fast Ethernet. Mount it so the 40 mm date zone sits in the middle of the field, and on a curved vial shoulder drop to a low angle so the highlight slides off the print. Inkjet on foil behaves like the label station - diffuse it.
Station 3: serialization DataMatrix
A GS1 DataMatrix on a pharma carton typically carries 0.25 mm modules. At 4 px per module, p ≤ 0.25 mm / 4 px = 0.0625 mm/px, and a 2560-px sensor covers 2560 × 0.0625 = 160 mm at that pixel size - room for a full carton face with the code in the middle.
A reader with the resolution and the rate to spare:
- Interface
- Fast Ethernet
- Resolution
- 5 MP
- Sensor format
- 1/1.7"
- Shutter
- Global
The LS-CRD-0028 decodes up to 60 codes/s at 30 fps through an 8 mm lens on a 2560 × 2048 sensor. Against a 5 codes/s line that is a 12× margin, which absorbs double-blank feeds and re-triggers, and it decodes well inside the 200 ms station budget computed below.
Close the loop with verification: compare each decoded payload against the batch list, as built in barcode match verification: build a pass/fail check station, and grade read quality per barcode reader verification for label inspection. A decode rate without a grade score hides marginal codes that will fail on the next shift.
Station 4: fill level behind the glass
Clear glass takes a backlight and a silhouette: the panel behind the vials is bright, the liquid column is a dark band, and the meniscus is its edge. Amber or opaque packaging needs near-infrared through the wall - NIR lighting for fill level inspection through packaging maps that case.
Pixel math: a ±2 mm level tolerance is a measurement, so 10 px across 2 mm sets p = 0.2 mm/px, and a 60 mm viewing window needs 60 / 0.2 = 300 px vertically. Any camera clears that bar, so speed sets the design instead. At 0.3 m/s belt speed, blur must stay under half a pixel (0.1 mm), which means exposure ≤ 0.1 / 300 = 0.33 ms. Strobe the backlight at 0.2 ms and the blur is 300 mm/s × 0.2 ms = 0.06 mm, or 0.3 px at 0.2 mm/px.
The backlight for a multi-lane silhouette station:
- Size
- 400 mm +
- Type
- Diffused
- Voltage
- 24 V
The LS-BAR-1168 is a 423 × 40 mm diffused red bar panel running on 24 V. A 423 mm panel backs eight 50 mm lanes side by side, and a mono camera reads the red silhouette cleanly.
Hall light leaking past the backlight shifts the silhouette threshold; a bandpass filter matched to the red LED blocks it, as set out in bandpass filter with red LED light to block ambient light. The edge-measurement itself - backlight plus histogram - follows the standard backlight and histogram methods for edge inspection.
Station 5: seal and tamper band
Seals are a lighting problem, not a resolution problem. A 1 mm crease at 3 px needs p = 0.33 mm/px, which every camera in this guide clears. What reveals the crease is dark field: a bar light grazing the cap or induction seal at a shallow angle, under about 30° above the surface, keeps flat foil black and makes creased foil scatter bright. A good seal reads uniformly dark, a crease or bridge lights up, and a missing foil changes the whole reflection pattern - so calibrate thresholds on samples of all three states, not on good parts alone.
The grazing light:
- Size
- 200-400 mm
- Type
- Standard
- Voltage
- 24 V
The LS-BAR-0400 is a 312 × 30 mm high-luminance bar on 24 V. Its long, thin format suits grazing along a cap line at a low stand-off.
Two angles catch more than one defect type: alternate a grazing exposure with a frontal diffuse exposure on the same station, the pattern shown in stacked ring lights: switching angles to catch more defect types.
Timing, trigger and light control
At 300 units/min each station owns 200 ms: 60 s / 300 = 200 ms. A photo-eye fires the sequence, and each light strobes in its own window so no two checks share an image. Short strobes also beat the hall lights: mains flicker ripples at 100 Hz on a 50 Hz supply, and a 0.2 ms pulse is fifty times shorter than the 10 ms half-cycle. Pulsing beyond continuous current ratings is what the driver is for - the reasons are in why your vision light needs an LED lighting controller.
Pitfalls that cost weeks
- One camera, three checks. Label, code and seal lighting conflict; split stations or split exposures.
- Rolling shutter on a moving belt. Specify global shutter for anything on a belt; rolling sensors skew vertical edges at 0.2-0.5 m/s and skew breaks OCR and decoding.
- Curved-shoulder dates. At head-on light the highlight parks on the print; drop the angle or add a polarizer.
- Recipe drift at changeover. Store per-SKU templates and golden images, and re-validate with one known-good and one known-bad sample after every change.
- Buying pixels before lighting. A 12 MP camera under a bare point source sees less than a 2 MP camera behind the right diffuser.
If the station mix is still open, the walkthrough for selecting a machine vision system for parts inspection sorts the camera-first decisions from the light-first ones.
Parts list and checks before you order
| Station | Camera or reader | Light |
|---|---|---|
| Label / print | MV-SC3050XC-16M-ATN-H | diffused white bar, window width |
| Label, compact line | LS-SMC-0063 | integrated |
| Lot / expiry | MV-ID3013PM-12M-WBN | diffused; low angle on shoulders |
| Serialization | LS-CRD-0028 | integrated |
| Fill level | mono camera, global shutter | LS-BAR-1168, strobed backlight |
| Seal / tamper | mono camera, global shutter | LS-BAR-0400, grazing |
Before ordering:
- Write down the smallest feature per station in mm; divide by 3 to detect, by 5 to measure.
- Belt speed × exposure stays under half a pixel, in mm.
- Reader rate is at least 3× the line's units per second.
- Set thresholds from bad parts, not from good ones.
- Confirm lens mount (M12 or C-mount), cable runs and 24 V panel wiring before the panel is cut.
To move from numbers to hardware, build the station in the lighting configurator, filter cameras in the camera finder, or ask for a layout review through the contact page. More station designs sit under the applications topic.
Questions
How many pixels does reading a 2 mm expiration date need?
Aim for about 20 pixels of character height, which means 0.1 mm/px or better for 2 mm characters. A 1280-pixel-wide sensor then covers 128 mm; a 2448-pixel sensor covers about 245 mm. If the date sits on a curved vial shoulder, add a low-angle light, because pixels are rarely the limiting factor on curved glass - the highlight parked across the print is.
Can one camera verify the label and read the DataMatrix at the same time?
Yes, when the code drives the pixel size. A 0.25 mm DataMatrix module at 4 px per module needs 0.0625 mm/px, and a 2448-px sensor at that pixel size covers 153 mm - enough for the label and the code on one carton face. Keep both checks in separate exposures so the lighting stays independent, and check corner sharpness at that coverage before committing the station.
What light shows the fill level inside amber glass vials?
Bar lights with 850 nm or 940 nm output pass dark amber glass that blocks visible light; pair them with a mono camera and a diffused panel behind the vials. Clear glass does not need infrared at all - white or red backlight is brighter and simpler. Both wavelength options are standard in bar-light ranges, so no custom panel is involved.
Global or rolling shutter on a packaging line?
Global shutter whenever the product moves during exposure - belt speeds of 0.2-0.5 m/s are typical on vial lines. Rolling shutter smears vertical edges into a skewed image at those speeds, and skew breaks both OCR and code decoding. If a rolling-shutter reader is already installed, stop the part under the camera or gate the trigger to a dwell window.
Does the camera need colour for pharmaceutical packaging inspection?
Mono sensors are more sensitive and are the default for fill level, seals and code reading. Colour earns its place only where hue carries information - separating a red warning band from black batch text, for example, or checking a coloured closure. The label station is the one place colour usually pays; everything downstream runs mono.





