Skip to content
Technical guide12 min read

Encoder triggering for line scan cameras

Line scan geometry depends on encoder triggering: size line rate, PPR and dividers, choose the right outputs and control slip at the wheel.

Why line scan needs an encoder

A line scan camera builds the second image dimension from motion, so the scale along the direction of travel is not set by the optics. It is set by how far the object moves between two line captures. Free-running at a fixed line rate, each row represents a fixed time, not a fixed distance. If the transport slows by 5%, the image stretches by about 5%, and during acceleration the scale changes continuously along the frame. Circles become ellipses, and any dimension measured along travel is wrong by the speed error.

An encoder replaces the time base with a position base. It produces pulses proportional to actual travel, and each pulse or divided group of pulses fires one line. Scale then holds through starts, stops and speed drift, within the limits of the mechanical coupling. A stationary web produces no lines at all, rather than thousands of identical ones.

A fixed line rate is defensible in only a few cases: bench bring-up, a drive whose measured speed variation is below your tolerance, or qualitative inspection that tolerates some aspect-ratio error. Measure the variation before accepting it. A 1% speed variation is a 1% scale error, which is 1 mm on a 100 mm part, or 10 pixels at 0.1 mm per pixel.

Line rate: the calculation and a worked example

The core formula is short: line rate (lines per second) = transport speed / pixel size at the object along travel. For square pixels, that is the same as the across-travel pixel size, which is the field of view divided by the number of sensor pixels.

Worked example: a web 410 mm wide is imaged with a 4k sensor (4,096 pixels), giving about 0.1 mm per pixel. Maximum transport speed is 2 m/s (120 m/min). Line rate = 2,000 mm/s / 0.1 mm = 20,000 lines/s, or 20 kHz. The line period is 50 µs, and exposure plus any sensor overhead must fit inside it. The data rate at 8 bits is 4,096 x 20,000, about 82 MB/s, which fits a single GigE link, while 12-bit packed at about 123 MB/s does not.

Size for the worst case: the fastest the line can ever run, including catch-up speeds. Then add margin, typically choosing a camera rated 20 to 25% above the computed rate. Triggers above the camera's maximum are usually ignored or flagged as overtriggers, so lines are lost and the image compresses locally rather than failing outright. Also check the low end, because some cameras specify a minimum line rate.

Exposure sets motion smear independently of line rate. At 2 m/s, a 40 µs exposure integrates over 80 µm of travel, or 0.8 of a pixel, which softens fine detail along travel compared with across it. If that matters, shorten the exposure and recover the signal with more light, a wider aperture or gain. This is why line scan is so demanding on illumination: the exposure is short and all the light must land in a narrow line, which usually calls for high-output bar lights.

Set exposure as a fixed time short enough for top speed, not as a function of line period. With fixed exposure and a DC-driven light, brightness stays constant when the line slows. If exposure follows the line period, brightness tracks speed and every acceleration moves your thresholds. Avoid PWM-dimmed LED drivers: a PWM frequency anywhere near the line rate beats against it and produces bright and dark stripes across the image. Use constant-current drive, or strobe once per line from the trigger, keeping in mind that per-line strobing changes the LED duty cycle with speed.

  • Line rate = speed / pixel size along travel.
  • Line period = 1 / line rate; exposure plus overhead must fit inside it.
  • Data rate = pixels per line x line rate x bytes per pixel.
  • Motion smear = speed x exposure; compare it with the pixel size.
  • Rotating parts: surface speed = pi x diameter x revolutions per second, then apply the same formula.

Incremental vs absolute encoders

An incremental encoder emits a stream of pulses as it turns, plus an optional index pulse once per revolution. It does not know where it is after power-up; a downstream counter has to keep track. That is exactly what a line trigger wants: each increment of travel produces an immediate edge, with latency limited only by the electronics.

An absolute encoder reports a unique position word for each shaft angle, and over many turns in multi-turn types, and retains it through power loss. The position usually arrives over a serial or fieldbus interface such as SSI, BiSS or an industrial Ethernet protocol. Those cycle times suit motion control but not firing a line every few tens of microseconds with low jitter. Some absolute encoders also provide an incremental output, which can drive the line trigger while the absolute channel goes to the PLC.

Choose by what the signal has to do. Line triggering, frame start and tracking a defect to a reject station by counting pulses all work with incremental. Absolute earns its place when the machine must know its position at power-up without homing, as on some positioned gantry scans. On rotating parts, an incremental encoder's index pulse usually provides all the angular reference you need.

The pulse source does not have to be a bolt-on rotary encoder. Servo drives can often output emulated incremental signals from their motor feedback, and precision stages can use a linear scale, which avoids leadscrew and coupling errors. Where a surface must not be touched, non-contact laser surface velocimeters can provide a pulse output derived from the surface itself. The camera side stays the same: a clean pulse train proportional to travel.

PPR selection and quadrature decoding

A quadrature encoder has two channels, A and B, offset by 90 electrical degrees, plus an optional index Z. The phase order gives direction. Counting the rising edges of A gives 1x (one count per cycle), both edges of A gives 2x, and all edges of both channels gives 4x, so a 2,500 PPR encoder yields up to 10,000 counts per revolution. Read datasheets carefully: PPR counts cycles per channel, while CPR sometimes means the decoded value.

Direction matters more than it first appears. A web at standstill still vibrates, and an encoder sitting on an edge can toggle back and forth. A single-channel input sees each toggle as new travel and fires lines, which shows up as repeated rows after every stop. A quadrature decoder with backward-motion handling counts down during reverse motion and fires no lines until position passes its previous maximum. Use that feature, if your frame grabber or camera offers it, on anything that can stop, reverse or oscillate.

Size PPR in three steps. First, compute the required lines per revolution: wheel circumference / line pitch. Second, as a rule of thumb, choose a PPR whose decoded counts are two to five times finer, leaving room for an integer divider. Third, check the top-speed pulse frequency against the rating of the encoder and of the receiving input.

Continuing the example, a measuring wheel with a 200 mm circumference and a 0.1 mm line pitch needs 2,000 lines per revolution. A 2,500 PPR encoder at 4x gives 10,000 counts per revolution, or 0.02 mm per count, and dividing by 5 gives exactly 0.1 mm per line. At 2 m/s the wheel turns at 10 rev/s (600 rpm), so each channel runs at 25 kHz, the 4x count rate is 100 kHz, and the line trigger comes out at 20 kHz.

Why not run 500 PPR at 4x with no divider, since that also gives 2,000 counts per revolution? Real encoders have phase and duty-cycle errors, so 4x edges are not evenly spaced. For illustration, take a phase error of 30 electrical degrees, or one-twelfth of a cycle. At 500 PPR one cycle is 0.4 mm of travel, so the error is about 0.033 mm, a third of the line pitch. At 2,500 PPR one cycle is 0.08 mm, so the same phase error is under 0.007 mm, less than 7% of the pitch.

Higher PPR is not automatically better, because the ceiling is the input. Line-driver encoders are commonly rated from around 100 to 300 kHz or more, but an opto-isolated camera input may be specified only in the tens to low hundreds of kHz, and slow optocouplers distort narrow pulses. Frame grabber differential inputs are typically faster. Check the maximum at top speed with margin.

HTL, TTL and RS-422 outputs and wiring

The output stage must match the receiver, and this is the most common ordering mistake. Encoder datasheets use the labels loosely, so read the voltage, the number of signal wires and whether complementary channels are present. The common output types are summarised in the list at the end of this section.

Check the receiver as carefully as the encoder. Many frame grabbers accept RS-422 directly. Cameras range from differential inputs with built-in quadrature decoding to simple opto-isolated inputs that take a single pulse only. A 24 V HTL signal can damage a 5 V input, and a 5 V differential signal may not reliably switch an opto-input designed for 24 V logic. Converter and isolator modules exist for these mismatches; confirm that they pass your frequency.

Use shielded twisted-pair cable with each complementary signal on its own pair, and terminate differential lines at the receiver where required, typically around 120 ohms, unless the input terminates internally. Keep the cable away from motor and drive wiring, and bond the shield according to the machine's grounding scheme. With 5 V-powered encoders, watch the voltage drop on long runs: the encoder must see its minimum supply at the far end, so use larger power conductors or a wide-range 10 to 30 V supply version.

If both the vision system and a PLC need the signal, use a proper splitter or repeater rather than paralleling inputs onto one line, which loads the driver and degrades the edges. Noise on a line trigger is directly visible: an extra edge is an extra line, seen as a small local stretch, and it may appear only when a particular motor starts.

  • RS-422 (differential line driver): 5 V differential signals on complementary pairs (A/A-, B/B-, Z/Z-). The receiver rejects common-mode noise, which makes it the default for long runs, high frequencies and noisy plants. Typical runs reach tens of metres to around 100 m, depending on frequency and cable.
  • TTL: on many datasheets this means the same 5 V differential driver as RS-422; on others it means single-ended 5 V. Ask which. Single-ended 5 V has little noise margin and should stay short, typically a few metres.
  • HTL (push-pull): swings close to the supply, typically 10 to 30 V, and suits PLC-style 24 V inputs. The large swing gives good noise margin, and complementary versions exist. Cable capacitance on long runs limits the maximum frequency and heats the driver at high pulse rates.
  • Open collector: needs a pull-up and has slow rising edges. Keep it for low-frequency legacy inputs, not fast line triggering.
  • Sin/cos 1 Vpp: analogue signals intended for interpolation in servo drives; normally needs an interpolator before a vision input.

Mechanical mounting and slip

Electronics rarely limit image geometry; mechanics do. The encoder measures what its shaft does, which may not be what the product does. Best locations, in rough order: a measuring wheel riding on the product or on the belt carrying it, close to the imaging line; an undriven idler roller with good wrap; a driven roller or motor shaft only if slip is known to be negligible. A motor-shaft encoder cannot see belt creep, gearbox backlash or web stretch, and an encoder on a belt tracks the belt, not parts sliding on it. On thick material wrapped around a roller, the effective radius is larger than the roller's, so add about half the thickness or calibrate from a known length.

Mount a measuring wheel on a spring-loaded arm with enough force to hold traction, without marking the product or overloading the encoder bearings, and keep its axis square to the travel direction. Measure the wheel rather than trusting its nominal size. A 63.66 mm diameter wheel has a 200 mm circumference, and wearing 0.5 mm off the radius changes that by about 1.6%, which is a 1.6% scale error along travel. Never couple a solid-shaft encoder rigidly to a roller: use a low-backlash bellows or disc coupling, and fit hollow-shaft types with a flexible stator tether so the body can float.

Verify slip by measurement. Run a strip of known length, such as 1,000 mm between two marks, at low speed, at top speed and through acceleration, and count the lines between the marks. At 0.1 mm per line you expect 10,000 lines; 9,950 lines is a 0.5% error, or 5 mm per metre. A constant error at every speed points to a wrong circumference or ratio, which you can calibrate out. An error that varies with speed or acceleration points to slip, which must be fixed mechanically.

  • Pattern repeating once per wheel revolution: eccentric wheel or coupling problem.
  • Scale changes only during acceleration: wheel or roller slip.
  • Repeated rows after stops: dither without backward-motion handling.
  • Slow scale drift over months: tyre wear or build-up on the wheel.

Divider settings and commissioning

Between the encoder input and the sensor sits a rate converter in the frame grabber or camera: quadrature decoding, then a divider, sometimes a multiplier. An integer divider is cleanest, because every line starts on the same count. A fractional ratio is correct on average but adds spacing jitter of up to one count. PLL-based multipliers smooth pulses and can raise a low-PPR signal, but they lag during acceleration, so avoid them unless speed is steady.

Choose wheel, PPR and pixel size as a set. A 1,024 PPR encoder at 4x on a 200 mm wheel gives 0.0488 mm per count, so a 0.1 mm line pitch needs 2.048 counts, which is not an integer. Dividing by 2 gives 0.0977 mm per line, 2.4% finer than the 0.1 mm across-web pixel. Either change PPR for a whole ratio, use a fractional ratio, or trim the magnification so the across-web pixel also becomes 0.0977 mm, which is exactly 400 mm across 4,096 pixels. The line rate at 2 m/s then rises to 20.48 kHz.

Rotating parts need a whole number of lines per revolution so that each frame closes at the same angle. A 50 mm diameter part has a 157.08 mm circumference, so 0.05 mm pixels need about 3,142 lines per revolution. A spindle encoder at 3,000 PPR and 4x gives 12,000 counts; dividing by 4 gives 3,000 lines per revolution, about 0.052 mm per line, and at 2 rev/s a 6 kHz line rate. Use the index pulse or a part sensor to start the frame. Some sensors are stricter than plain line sensors: TDI cameras blur along travel if line rate and speed do not match, and trilinear colour cameras show colour fringes.

Set frame height in lines, not time. When the transport stops, a partly filled frame never finishes on its own, so handle acquisition timeouts in software. On continuous webs, overlap consecutive frames if defects can straddle a boundary. Use encoder counts for downstream rejection too: a position-based offset from camera to reject station stays correct at any speed, and a time-based delay does not.

Encoder, camera, lighting and transport have to work as one system, which is why line scan stations are worth validating end to end. AIS Vision integrates them, and Rosepetal can handle surface defects that resist rule-based tools once the images are stable.

  • Compressed sections at top speed: triggers beyond the camera's maximum line rate.
  • Record PPR, decoder mode, divider, wheel diameter and pixel size in the machine documentation, because changing any of them invalidates the calibration.

Frequently asked questions

Related categories

  • Encoders
  • Line scan cameras
  • Bar / linear lights
  • Frame grabbers

Related guides

Recommended hardware

Line scan cameras

All line scan cameras →

Bar / linear lights

All bar / linear lights →
  • Basler Standard Light Bar-10x100-x (White / Red / Blue / IR) machine vision lighting
    BaslerBasler Standard Light Bar-10x100-xStandard Light Bar-10x100-x
    • Bar light (standard / narrow 10 mm)
    • Available as Red (625 nm), White (5000 K), Blue (465 nm), Infrared (850 nm)
    • Luminous area 10 x 100 mm
    • Continuous and strobe (internal LED controller, 2 operating modes; SLP Strobe Controller compatible)
    • Rosepetal compatible
    • Recommended by AIS Vision
    On request
    View
  • Omron / Sentech FLV-BR21222 machine vision lighting
    Omron / SentechOmron / Sentech FLV-BR21222 Bar LightFLV-BR21222
    • Bar (linear) light
    • White (also Red ~635 nm / Blue ~465 nm variants)
    • Lighting area 199 x 18 mm
    • Continuous or trigger (strobe) lighting via controller, digital intensity control
    • Rosepetal compatible
    • Recommended by AIS Vision
    On request
    View
  • Lumher PD-5000K machine vision lighting
    LumherLumher PD White 5000KPD-5000K
    • Bar / linear (Linear series)
    • White 5000K
    • Continuous (1x) / Strobe (4x) (no strobe values listed for PD 13, PD 14, PD 15)
    • Semidiffuse 60° / Ultradiffuse 110°
    • Rosepetal compatible
    • Recommended by AIS Vision
    On request
    View

Request a technical quote

If you have a specific application, we help you select the right hardware and validate it.