DEV Community

Tommy Yu
Tommy Yu

Posted on

The cycle time budget: why a 1 kHz sensor does not give you a 1 kHz machine

A sensor that updates at 1 kHz is not a control loop that reacts in 1 ms. Between the measurement and the decision there are at least two more clocks, and in a typical machine they are both slower than the sensor. The number that matters is not the update rate — it is the age of the reading at the moment the machine acts on it.

Here is how to compute that, and where the budget usually gets spent.

The three delays

1. Sensor period. At 1 kHz the module produces a reading every 1 ms. At 100 Hz, every 10 ms. This is the number on the datasheet.

2. Bus or link cycle. The reading is transferred over Ethernet, RS-485, or a fieldbus. A typical EtherCAT or PROFINET cycle is 1–4 ms; a serial link at 115200 baud carrying a 10-byte frame is under 1 ms, but if the PLC polls on its own schedule, add the polling interval.

3. PLC scan. Typical 5–20 ms. This dominates. A 20 ms scan means your control logic only looks at the world twenty times a second, no matter how fast the sensor is.

Reading age ≈ sensor period + link + scan. At 1 kHz sensor, 2 ms link, 10 ms scan, that is 13 ms — and the sensor contributed 1 of them.

What that costs on the machine

Machine speed 10 ms of age 20 ms 30 ms
0.5 m/s (slow conveyor) 5 mm 10 mm 15 mm
1 m/s (diverter) 10 mm 20 mm 30 mm
2 m/s (fast sortation) 20 mm 40 mm 60 mm
5 m/s (vehicle) 50 mm 100 mm 150 mm

If your mechanical tolerance is 20 mm and 1 m/s gives you 30 mm of lag, buying a 10 kHz sensor will not fix it — you will move 10 out of 30 ms. The fix is a faster scan, a faster bus, or accepting the lag and compensating for it.

The three ways to compensate

Median filter over N samples. Removes wild readings (a reflective patch, a gap) at the cost of latency: a 5-sample median at 100 Hz adds 20 ms. That is often a bad trade — you solved noise and created lag.

Feed-forward on known motion. If the target moves on a known axis at a known speed, predict where it will be when the decision lands, and act on the prediction. This is what the good sortation systems do, and it needs a speed input, not a better sensor.

Close the loop at the drive. Move the position loop to the servo drive, where the cycle is 100 µs–1 ms, and let the PLC supervise rather than control. Expensive to design, cheapest in the long run at high speed.

The trap: choosing the sensor on rate alone

Two modules, both "1 kHz": one delivers a reading every millisecond with ±10 ms of jitter, one every millisecond with ±0.2 ms. On a diverter, the first produces spacing errors that look like mechanical faults; the second does not.

Jitter is the number to ask for, and almost nobody publishes it. If a supplier cannot state it, assume 1–2 periods.

How to measure your own lag, in an hour

Put the machine in a slow, repeatable motion. Log the sensor timestamp and the PLC's timestamp for the same event, on the same trace. The difference is your real age — usually larger than the arithmetic above, because the numbers you were quoted were best-case.

Do it once. It is the only number in this article you cannot get from a datasheet, and it is the one your control tuning depends on.

What to specify

Requirement Ask for Why
Update rate Hz at your ordered duty cycle Not the maximum the module can do cold
Jitter ms, stated The number that shows up as control noise
Interface signalling and baud, at your cable length Serial framing time is part of the budget
Scan your PLC's actual scan time Usually the largest term
Acceptance lag measured on the machine The arithmetic is a prediction; the trace is evidence

If you tell me the machine speed, the tolerance and your PLC scan, I will tell you whether a faster sensor helps at all — and in most cases where the scan is over 10 ms, it does not.

Licensed CC BY 4.0. Interface and rate figures referenced are published with their conditions at specs.erdilrf.com/data; the timing arithmetic is general.

Top comments (0)