Cameras & sensorsTroubleshooting

Why trigger pulse width sets your camera exposure time

In pulse-width exposure modes the trigger pulse width is the exposure time: a 1 ms pulse is two stops darker than 4 ms. Symptom, maths, tests and the fix.

LumaSpec Vision10 min read Share on LinkedIn

On this page 10 sections
  1. 01Recognise the symptom
  2. 02How pulse-width exposure mode works
  3. 03Likely causes, in order of probability
  4. 04Prove it with two measurements
  5. 05The arithmetic: 1 ms versus 4 ms
  6. 06Choosing the pulse width from motion blur
  7. 07Choosing the pulse source
  8. 08Fix it once, keep it fixed
  9. 09When trigger-width exposure is the wrong tool
  10. 10Questions

Frames captured under an external trigger come out two stops darker than the ones you shot on the bench, and nothing in the optics has moved. In most such cases the exposure is not set anywhere in your program: the camera is in a trigger-width exposure mode, where the high time of the trigger pulse is the exposure time. Below is how that mode works, why brightness then changes between machines and runs, how to prove it with a scope and the image mean, and how to choose the pulse width from the motion blur you can tolerate. It applies to GigE, USB3 and CoaXPress area scan cameras, and to the photoelectric sensors and PLC outputs that pulse them.

Recognise the symptom

Three signs, usually together. Brightness is right in the vendor capture tool and wrong in your program, or the reverse. Two stations with identical cameras, lenses and lights give different mean gray levels on the same parts. Brightness changes when you run your code differently - flat out, or step by step under a debugger - while parts and light sit still. All three mean the exposure is following something outside the camera settings. In a trigger-width exposure mode that something is the pulse: the camera starts integrating on the trigger's rising edge and stops on the falling edge, so the image brightness reports the pulse width, not the exposure register.

How pulse-width exposure mode works

In the GenICam feature set the mode is ExposureMode = TriggerWidth, and almost every current GigE and USB3 area scan camera exposes it. Older IIDC cameras shipped the same behaviour as a trigger (shutter) mode 1, which is why legacy integration notes talk about shutter modes. Exposure starts when the trigger input goes high and ends when it goes low. Nothing else sets it: a 1 ms high time is a 1 ms exposure and a 4 ms high time a 4 ms exposure, whatever a register elsewhere claims.

While light, gain and iris stay fixed, photon count scales with time and so does image brightness:

t_exp = t_high (trigger-width mode) gray(t) ≈ gray_ref × t / t_ref (fixed light, gain and iris) stops = log2(t_a / t_b)

Likely causes, in order of probability

  1. Two pulse sources disagree. The bench pulse generator outputs 4 ms, the machine's PLC or sensor outputs 1 ms. This explains "correct on the bench, dark in production" with no other change.
  2. Two code paths set exposure differently. One path sets ExposureMode to Timed with a fixed exposure; another leaves TriggerWidth. Vendor tool and program are both "correct" and still disagree.
  3. The pulse is not the width you think. A PLC output toggled in scan logic, a software-made pulse, or a slow sensor edge delivers a different high time than designed. Only a scope settles it.
  4. The pulse is shorter than the camera accepts. Many cameras clamp a too-short pulse to their minimum exposure, so frames sit at a constant dim floor however much you shorten the pulse.

Prove it with two measurements

  1. Scope the pulse at the camera connector, not at the source, and measure the high time on 50 or more pulses; note the spread. Mind the reference: most trigger inputs are optocoupled and isolated, so clip to the input's own ground return, not the nearest chassis point.
  2. Run your production acquisition and read the per-frame exposure value the camera reports. In trigger-width mode it should match the scoped high time within tens of microseconds; a reading of 1 ms confirms a 1 ms pulse and clears the driver.
  3. No scope? Use the image as the meter: grab frames at the suspect width and at a known 4 ms, then compare mean gray levels. The ratio of means is the ratio of exposures.
  4. Force the question: set ExposureMode to Timed with a 2 ms exposure in your program. If brightness stops tracking the pulse, the mode was the cause. If it still tracks, the pulse itself moved.

The arithmetic: 1 ms versus 4 ms

Say the bench setup exposed well at 4 ms, with a mean gray of 160 on the 8-bit scale, safely below the 255 clipping point. Trigger-width predictions then follow from ratios alone:

Trigger high time Exposure Photons vs 4 ms Stops vs 4 ms Expected mean gray
8 ms 8 ms 2× +1 clips at 255
4 ms 4 ms 1× 0 160
1 ms 1 ms 1/4 -2 40
0.5 ms 0.5 ms 1/8 -3 20

The stops column is log2 of the photon ratio: log2(4/1) = 2, so 1 ms is two stops darker. The gray column is 160 × t / 4 ms, and at 8 ms the signal would reach 320, past full scale. If production frames measure a mean of 41, then 41/160 ≈ 0.26 and 4 ms × 0.26 ≈ 1.0 ms: the exposure really is about a millisecond, whatever the drawing says. Holding a mean near 160 at 1 ms takes 4× the light - two extra stops of LED drive or iris - or two stops of gain and its noise.

Choosing the pulse width from motion blur

Blur length is part speed times exposure, which sets a ceiling before brightness is even discussed:

t_max = blur_max / v

A belt at 300 mm/s with a 0.2 mm blur budget gives t_max = 0.2 / 300 = 0.00067 s ≈ 0.67 ms. Pick 0.5 ms and the blur is 300 mm/s × 0.0005 s = 0.15 mm, inside budget. Against 4 ms bench pulses that is log2(4/0.5) = 3 stops darker, so the scene needs 8× more light or an iris three stops wider (f/4 → f/1.4) to hold a mean of 160. If the strobe cannot deliver it, the honest options are a stronger light, a slower belt, or a longer pulse: at 2 ms the blur is 0.6 mm, acceptable only when the smallest feature you inspect spans several times that.

Choosing the pulse source

The pulse needs one owner whose width does not depend on software timing.

  • Sensor straight into the camera is the shortest chain for belt work: the sensor's output high time is the exposure. Set the switching distance so the pulse starts with the part framed, and note that width then follows part length and speed - a longer part integrates longer, which is often what you want.
  • A PLC output works if the pulse is made with timed logic and survives at least two scan times, or it will be missed and the exposure will jitter frame to frame. The PLC pulse width and scan-time rule explains the twice-scan minimum.
  • A timer card gives a width independent of software and of part speed, and it is the choice when exposure must hold constant from frame to frame.

Whatever the source, design the width at 100 µs or more: direct inputs accept a few microseconds and optocoupled inputs want tens, so at 100 µs the input stage stops being a variable.

A diffuse-reflective sensor with a settable switching distance covers most close-range belt jobs; the MV-PE5502 spans 10–350 mm with a NPN output:

Photoelectric sensorsHikrobot MV-PE5502 Diffuse-reflective sensor(10-350mm, Red LED, settable distance, NPN)MV-PE5502
Output
NPN
Light source
Red LED
Sensing range
100 mm - 1 m
Type
Diffuse-reflective
$49.00 · quotedView and quoteBuild a system with it

For through-beam edges on fast or thin parts, the trigger sensor finder lists diffuse, retro-reflective and through-beam types in one place.

If you are specifying hardware rather than debugging it, the camera side is a standard C-mount area scan camera; one GigE and one USB3 example:

Area scan camerasHikrobot MV-CU020-90GC 2.5 MP Area Scan Camera, GigE, GMAX4002, ColorMV-CU020-90GC
Sensor format
1/1.7"
Lens mount
C-mount
$309.00View part
Area scan camerasHikrobot MV-CT0MG0060/R/NN/NN 6 MP Area Scan Camera, 3rd Gen., GigE, Mono, BASEMV-CT0MG0060/R/NN/NN
Sensor format
1/1.8"
Lens mount
C-mount
$909.00View part

Fix it once, keep it fixed

  • Decide the mode in one place: set ExposureMode (Timed or TriggerWidth) explicitly at acquisition start from a single function, never by default. The GenICam exposure setting walkthrough shows the read-back pattern.
  • Log the mode and the per-frame exposure value, and alarm when either drifts; the per-frame exposure and gain check shows how to read them from the stream.
  • Give the pulse a single owner and disconnect the second source physically; a disabled software channel can still assert a line.
  • Set the acquisition and trigger modes along with it: a camera left in continuous acquisition ignores the line entirely (check acquisition mode first), and per-camera trigger defaults need setting at start-up (hardware trigger configuration).
  • If triggering stops after the first frame, the acquisition mode is usually waiting for a re-arm (the one-frame stop fix).
  • Commission with the brightness-ratio test and record a pass band on mean gray - for the 1 ms example above, 38–44.

When trigger-width exposure is the wrong tool

Switch the camera to Timed exposure, triggered on one edge, when the source cannot hold a width (relay outputs, software-made pulses), when width must not vary with part length, or when you need exposures shorter than the wiring can carry. The pulse then only has to clear the input minimum and the exposure becomes a camera register you can log and freeze. The trigger mode overview and the trigger call versus exposure timing explainer map the alternatives, and sequenced trigger timing covers pulses arriving faster than frames leave. Two further limits: exposure still consumes frame-rate budget at long widths (why frame rate drops with exposure), and moving parts pay blur (exposure time versus shutter speed).

The decision: use TriggerWidth when the sensor itself should time the light - strobe-synchronous shots, or exposure proportional to part length. Use Timed when exposure must be identical across frames, machines and shifts.

Set the mode on purpose, scope the pulse once, and brightness stops being a mystery. To lay out the chain end to end, start at the camera configurator or browse area scan cameras; more exposure and trigger reading sits under the cameras topic. If a station still disagrees after these checks, bring the scope shot and a bright/dark frame pair to the contact page and we will work through the timing with you.

Questions

Does trigger-width exposure work on a rolling shutter camera?

Yes. Exposure still equals the pulse width; the difference is spatial. A rolling shutter scans line by line during the pulse, so a moving part is skewed within the frame even at the correct exposure. The skew equals part speed times scan time: a part at 300 mm/s with a 10 ms scan shows 3 mm of skew. Keep the part stationary during the pulse, or move to a global shutter camera for continuous motion.

How short can a trigger pulse be for exposure control?

Direct trigger inputs on area scan cameras typically accept pulses of a few microseconds; optocoupled inputs want tens of microseconds for clean edges. Design the pulse at 100 µs or more and the input stops being a variable. If you need a shorter exposure than that, switch ExposureMode to Timed and use the pulse edge as the trigger: a 10 µs pulse then just fires a 500 µs camera-timed exposure.

Can I stretch a short sensor pulse instead of changing the camera mode?

Yes. A retriggerable one-shot (monostable) timer stretches the pulse with a resistor and capacitor, keeping exposure defined on the wire and independent of software. Allow a few percent of width drift with temperature; if your brightness pass band is tight, measure the stretched width at the machine's working temperature, not just on the bench at 20 °C.

Images are still dark with a correct pulse width - what else sets brightness?

Exposure, gain, lens aperture and LED current set brightness together. Check that the production profile did not reset gain to a low default, that the iris matches the bench lens, and that strobe current is set on the light controller rather than merely enabled. Switch off every auto exposure and auto gain function: they quietly rewrite fixed values and show up as run-to-run brightness drift.

Why did brightness change only when I ran the program step by step?

Software-generated pulses do not survive breakpoints: the code that toggles the trigger line waits while you inspect variables, so the pulse width changes with execution mode. A hardware timer or sensor output cannot know you are debugging, which makes the asymmetry itself the diagnostic. If brightness tracks how the code runs, the pulse is being made in software; move it to a timer card, sensor or PLC output with a fixed width.