A clear-looking Pharmacode can still produce no result when the decoder expects a different symbology, rejects the measured geometry, or searches in the wrong region. This troubleshooting sequence is for inspection developers who already have an image but cannot obtain a dependable read. Start with software support and a known reference, then measure the image before changing the camera or lighting.
1. Establish exactly where the read fails
Keep one original, full-resolution image that consistently fails. Record the selected symbology, search region, image format, preprocessing settings, and expected value. Change one setting at a time so each test has an interpretable outcome.
Separate these failure states:
- The image cannot be passed to the decoder.
- The decoder accepts the image but finds no candidate.
- A candidate is found but fails geometry or configuration checks.
- A value is decoded but rejected by application validation.
- A plausible value appears only when the reading direction changes.
These are different faults. An application displaying an empty field may conceal any of them, so inspect the documented status information rather than the displayed text alone.
If acquisition succeeds but the decoder rejects the image object, follow the image-buffer handling checks. Pixel format, row stride, and buffer lifetime must be correct before barcode settings become meaningful.
2. Confirm explicit support for the correct Pharmacode variant
First, check the installed decoder's documentation for explicit support for single-track Pharmacode. General support for linear barcodes does not establish support for this symbology. A different pharmaceutical marking format or a two-track implementation is not interchangeable with a single row of narrow and wide bars.
Use the manufacturer's documented example or reference image, obtained through its official documentation or distribution channel. Test it with the smallest documented configuration needed for that symbology.
Check the following before tuning image thresholds:
- The installed software version supports the required variant.
- The required licensed functionality is available through the documented licensing process.
- The symbology is explicitly enabled in the active decoder instance.
- Search settings and allowed ranges do not exclude the reference code.
- The application actually applies those settings before decoding.
If the documented reference fails, investigate configuration, licensing, or image compatibility first. Buying another camera will not add missing decoder support.
If the reference succeeds but the production image fails, preserve that working configuration. Use it as the baseline for the remaining image tests.
3. Measure bars and spaces instead of judging appearance
Single-track Pharmacode represents information through narrow and wide bars. Spaces separate those bars; they are not a second set of data-bearing width classes. A generic linear-code assumption about alternating bar and space information can therefore lead your investigation in the wrong direction.
Inspect a grayscale intensity profile across the bars, approximately perpendicular to their long edges. Take profiles near the top, middle, and bottom of the printed region. A single favorable scanline can miss tapered printing, a scratch, or an obstruction elsewhere.
| Observation | What it suggests | Next test |
|---|---|---|
| Two distinct bar-width groups | The narrow/wide distinction may be preserved | Compare measured dimensions with the marking specification |
| Bar widths change across image height | Perspective, print distortion, or an oblique profile | Rectify the view or measure perpendicular to the bars |
| Small gaps disappear | Blur, saturation, or threshold expansion | Inspect the original grayscale image and reduce the suspected cause |
| Extra dark runs appear outside the code | Nearby text or graphics enter the search region | Adjust the region while retaining clear margins |
| Some bars are split into fragments | Print damage, texture, or aggressive processing | Compare several profiles before applying morphology |
Measure clear background before the first bar and after the last bar. Use the marking specification and decoder documentation for required margins, dimensions, and tolerances. Do not substitute the quiet-zone requirements of another barcode type.
Also check the complete printed region. A crop that preserves the central bars but removes an outer bar can look convincing while representing a different sequence.
For rotation, thresholding, and blur corrections, use the linear-barcode preprocessing guide. Apply those techniques only after establishing which structures the Pharmacode reader needs preserved.
4. Calculate sampling at the narrowest bar
The relevant sampling quantity is pixels across the narrowest bar, measured perpendicular to its edges. Total image resolution alone does not answer that question.
For an approximately front-facing planar code, estimate sampling with:
Consider an illustrative inspection with a field width of 120 mm and 2400 horizontal pixels. Suppose the measured narrow bars are 0.5 mm wide, the wide bars are 1.5 mm, and the separating spaces are 1.0 mm. These are example dimensions, not acceptance limits for a marking specification.
The arithmetic is:
- Object-space sampling: 120 mm / 2400 pixels = 0.05 mm per pixel.
- Narrow bar: 0.5 mm / 0.05 mm per pixel = 10 pixels.
- Wide bar: 1.5 mm / 0.05 mm per pixel = 30 pixels.
- Space: 1.0 mm / 0.05 mm per pixel = 20 pixels.
If you choose an initial engineering target of 8 pixels across the narrow bar, the required horizontal sampling is 120 × 8 / 0.5 = 1920 pixels. That target is a starting point for testing, not a universal decoder minimum.
Now consider downsampling the original image by a factor of 4. The narrow bar falls from 10 pixels to 2.5 pixels. Edge position, interpolation, and threshold choice then have a much larger influence on its measured width.
Test the original image before reducing resolution. If sampling is insufficient, consider a tighter field of view before increasing camera resolution. The area scan camera category and camera finder help compare acquisition options once you know the required field and sampling.
5. Correct acquisition faults before adding processing
An empty decode result is not, by itself, evidence that the camera needs replacement. First compare a stationary capture with an image taken during normal movement. If only the moving image fails, investigate exposure, synchronization, and shutter behavior.
A useful motion-blur estimate is:
Using the previous example's 0.05 mm per pixel sampling, motion at 500 mm/s during a 0.2 ms exposure produces 500 × 0.0002 = 0.1 mm of displacement. That corresponds to 0.1 / 0.05 = 2 pixels of blur. This estimate covers translation during exposure, not all rolling-shutter distortion or vibration effects.
The LS-CMR-0166 is a USB3 rolling-shutter area scan camera. Evaluate it against scene motion, supported acquisition settings, and software compatibility rather than treating it as a guaranteed decoding remedy.
- Sensor format
- 1/1.7"
- Interface
- USB3
- Resolution
- 12 MP
- Shutter
- Rolling
For illumination, inspect the original grayscale values. Glare can erase dark features locally, while inadequate illumination can force exposure times that soften moving edges. Improving the display contrast does not restore missing image information.
A trial with bar lights can help establish a useful illumination angle. Compare positions using the same exposure and gain, then check the darkest and brightest parts of the code rather than only its center.
The LS-BAR-1276 is a diffused white bar light. Confirm coverage, mounting clearance, and the supported electrical arrangement before selecting it for the station.
- Size
- 200-400 mm
- Type
- Diffused
- Voltage
- 24 V
Use the lighting finder after the trial identifies a suitable geometry. If reflections dominate, the cross-polarization guide explains an additional optical test; do not assume polarization is necessary for every printed surface.
6. Control reading direction and test with known values
Reading direction deserves a separate test because an incorrect direction can produce a different plausible number, not merely an empty result. Single-track Pharmacode does not provide the start/stop patterns and checksum used by many other linear symbologies to help establish interpretation.
For a conventional single-track interpretation, assign a narrow bar a weight of 1 and a wide bar a weight of 2. Process the bars in the selected order using:
For the sequence narrow, narrow, wide:
- First bar: 2 × 0 + 1 = 1.
- Second bar: 2 × 1 + 1 = 3.
- Third bar: 2 × 3 + 2 = 8.
Reversing that sequence gives wide, narrow, narrow:
- First bar: 2 × 0 + 2 = 2.
- Second bar: 2 × 2 + 1 = 5.
- Third bar: 2 × 5 + 1 = 11.
Both calculations are internally plausible. The image alone does not establish which value the application intends.
Use an independently verified sample whose forward and reverse values differ. Establish its physical orientation, then map that orientation to the decoder's documented direction convention. Check image mirroring and rotation between acquisition, display, and decoding.
The reading-direction configuration guide addresses direction selection in more detail. For Pharmacode, bind that setting to the actual presentation of the package or label.
7. Separate decoding from code-specific acceptance
Once a value appears, do not immediately classify the inspection as successful. A decoded value, correct product identity, and acceptable print quality are separate outcomes.
Validate the result against the production job or another authoritative reference. Record the selected direction and whether the complete code region was visible. If orientation is unknown or the image is incomplete, return a defined ambiguous or unread status rather than silently accepting a convenient value.
Keep distinct application outcomes for:
- No image or invalid image input.
- No readable Pharmacode.
- A readable but unexpected value.
- Uncertain orientation or incomplete code visibility.
- A readable, expected value with the required inspection checks satisfied.
A useful challenge set includes the expected code, a different valid code, an obscured bar, a clipped outer bar, and a reversed presentation. Include actual production variations in position, focus, and illumination.
The decode-confidence guide explains why a successful decode alone is not an acceptance policy. For this symbology, controlled direction and external identity validation are especially relevant.
8. Use a controlled isolation sequence
Run the following tests in order and retain each image with its outcome. This separates software faults from acquisition faults without changing several variables together.
| Test | If it passes | If it fails |
|---|---|---|
| Documented reference image | Basic support and configuration are working | Recheck variant, licensing, configuration, and image input |
| Original production image without optional processing | Processing is not required for this sample | Examine geometry, region, sampling, and contrast |
| Stationary capture under controlled light | Motion-related acquisition deserves attention | Continue checking optics, printing, and decoder settings |
| Known sample in the documented direction | Direction mapping has a useful reference | Check mirroring, rotation, expected value, and direction convention |
| Challenge images with deliberate faults | Acceptance logic can distinguish failure cases | Correct validation before commissioning |
Avoid widening every tolerance until something reads. That can change a repeatable rejection into an intermittent incorrect acceptance.
9. Checks before changing hardware or commissioning
Use this final checklist to decide whether the next action belongs in software, acquisition, or validation:
- Confirm explicit support for the required Pharmacode variant and the active software configuration.
- Keep a documented reference image and an independently verified printed sample.
- Measure narrow bars, wide bars, spaces, and clear margins in original pixels.
- Check full-resolution input before resizing, sharpening, or morphology.
- Compare stationary and moving captures with recorded exposure settings.
- Verify reading direction using an asymmetric sequence and known orientation.
- Reject unexpected values and ambiguous presentations through explicit application logic.
- Retain challenge images and rerun them after configuration or software changes.
If new acquisition hardware is justified, start the camera configuration process with the measured field of view, narrow-bar width, motion, and interface requirements. For help narrowing the remaining fault, send the original image, expected value, and configuration details through application support.
Questions
Why does a clear Pharmacode image produce no decode?
A sharp display does not prove that the installed decoder supports the required Pharmacode variant or that its active settings permit the code. Confirm support with a documented reference image, then inspect the production image's measured bar widths, margins, search region, and original pixel format.
Can reading a Pharmacode backward produce a valid number?
For single-track Pharmacode, reversing the bar sequence can produce another plausible value. Use a sample with independently known content and orientation to establish the decoder's direction convention. Account for any mirroring or rotation in the image pipeline rather than selecting whichever value seems acceptable.
How many pixels should cover the narrowest Pharmacode bar?
There is no universal minimum that guarantees a read across decoders, printing conditions, and motion. Calculate sampling at the narrowest bar and test the original image. A target such as 8 pixels per narrow bar can support initial planning, but acceptance must come from representative image trials and the decoder's documentation.
Should the camera or light be replaced when Pharmacode will not read?
Not as the first response. Compare the decoder's documented reference image, an unprocessed production image, and a stationary capture. Replace or reconfigure acquisition hardware only when measurements identify inadequate sampling, motion distortion, illumination, or another acquisition limitation that software settings cannot correct.
Is a successfully decoded Pharmacode enough to accept a package?
No. A numeric result must still match the intended production identity and a verified reading direction. The application should distinguish unexpected values, incomplete visibility, and uncertain orientation from an accepted read. Print-quality requirements also need their own inspection criteria; successful decoding does not establish them.

