Barcode reading distance calculator
Enter the module (X) size, the code width and the camera's sensor and lens values. See the field of view, the pixels per module and the nearest and farthest distance at which the code both fits and can be read at your working distance; or find the smallest X and sensor resolution for a distance you want.
Code
Reader
Camera and lens
The calculation runs in your browser; the values you enter are not sent anywhere.
- Readable distance range
- 63.3 – 402.3 mm
- Field of view (horizontal)
- 150 mm
- Pixels per module
- 4.08
- Share of the field of view taken by the code
- 17%
- Magnification
- 0.0563
- Pixel size
- 3.45 µm
At this distance the code fits in the field of view and pixels per module are sufficient.
Sensitivity: reading distance by module size
| X ratio | X (mm) | Reading range (mm) | Pixels per module (at this distance) |
|---|---|---|---|
| × 0.5 | 0.125 | 39.7 – 209.1 | 2.04 |
| × 0.75 | 0.188 | 51.5 – 305.7 | 3.06 |
| × 1 | 0.25 | 63.3 – 402.3 | 4.08 |
| × 1.25 | 0.313 | 75.2 – 498.8 | 5.1 |
| × 1.5 | 0.375 | 87 – 595.4 | 6.12 |
| × 2 | 0.5 | 110.7 – 788.5 | 8.16 |
Assumptions and simplifications
- Thin lens model: magnification f / (d − f), distance measured from the lens centre. The thick construction, focus setting and internal distances of a real industrial lens shift the result somewhat.
- The lens's minimum object distance (MOD) and depth of field are not in the calculation: the nearest distance found may be smaller than what the lens can focus.
- The code is assumed perpendicular to the camera and flat; skew, distortion, blur (motion, focus), contrast and lighting are not modelled.
- The required pixels per module is a user input; it varies with the decoding algorithm, the code type and the print quality.
m = f / (d − f) · field of view = s·(d − f) / f · pixels per module = X·m·W / s · dmin = f + N·X·f / s · dmax = f + X·f·W / (s·g)
The result is an estimate based on a thin lens model; the real reading distance depends on the lens, lighting, print quality and reader software. Run a field trial with the real code when setting up the line.
Let's look at reader position, code size and line speed together and put together a setup that raises the read rate.
Request a conversation01
How to use it
A
Enter the module size, the code width, the required pixels per module and the camera's sensor and lens values.
B
Enter your working distance: read the field of view, the pixels per module and the readable distance range.
C
Switch to reverse mode to find the smallest X and sensor resolution for the distance you want; the sensitivity table shows how X changes the range.
02
Why pixels per module decide
An image reader decodes a code reliably when there are enough pixels per module. Manufacturer documents commonly ask for a few pixels per module; how many are required depends on the reader, the code and the print quality. This tool takes the value from you and calculates the rest by geometry.
As distance grows, magnification falls, the width of a module in the image shrinks and pixels per module drop. As distance falls, the field of view narrows and the code no longer fits. The range between the two limits is the readable distance.
03
Which X, which sensor?
Reverse mode answers two questions at the desired distance: how small can X be for enough pixels per module, and how large can it be for the code to fit in the field of view? If the range is empty you must either shrink the code or choose a sensor with more pixels.
The sensor width needed is calculated for the X you give; as the code itself is N modules wide, the lower bound is pixels per module × N. Doubling the horizontal pixel count of the sensor roughly doubles the reading distance for the same X.
04
What else should be tried in the field?
The calculation is a starting point. The lens's minimum object distance, depth of field, belt speed (motion blur), skew of the code, glare and print contrast narrow the real range.
Test on the line with the code you will use and with the worst print quality; choosing a distance near the middle of the range increases tolerance.
FAQ
- What is the module (X) size?
- The width of the narrowest bar (1D) or of a single cell (2D, for example DataMatrix) of the code. The total width of the code is about number of modules × X.
- How many pixels per module do I need?
- It depends on the reader, the code and the print quality; check the manufacturer's documentation. The 3 in the tool is only an example value. A higher value generally makes reading more reliable but narrows the distance range.
- Should I include the quiet zone in the code width?
- The whole code and its quiet zone must fit in the field of view. The quiet zone must be in the image too, so we suggest entering the module count together with the quiet zone.
- Where do I find the focal length and sensor width?
- On the camera and lens datasheets. The sensor width is often the pixel size × horizontal pixel count; for example 3.45 µm and 2448 pixels give about 8.45 mm.
- Why can the lens not focus at the nearest distance the tool found?
- The model does not know the lens's minimum object distance. Check the datasheet for the distance below which the lens cannot focus; at close range an extension tube or a different lens may be needed.
Let's solve the reader setup on your line together
From reader position, code size and lighting to belt speed and read rate, we handle the imaging side of the serialisation line end to end.