AutomateDirectUSAMotion LibraryIndustrial monitors & PCs

Explainer

Why the conveyor index count must survive an operator stop

Sensors, encoders and machine vision on the machine Published 9 min read By AutomateDirectUSA engineering team

Short answer

Keep the accumulated sprocket-pulse count in a retained counter and reset it only when the placement interval completes and the next index is authorized. An operator stop then removes the run command without touching the count, so the conveyor resumes exactly the remaining distance from the next placement boundary.

On this page
  1. How far does one sprocket pulse move the belt?
  2. How many pulses make one placement index?
  3. Why does stopping mid-index lose the conveyor position?
  4. How do you keep the index count through a stop?
  5. Does the sprocket sensor need a high-speed counter?
  6. When should the index count reset?
  7. What else moves the placement position besides the count?
  8. How do you test that the count survives a stop?
  9. Questions asked

When an operator stops this conveyor partway through an index, the sprocket count has to stay exactly where it is. Keep the accumulated pulses in a retained counter, reset it only when the placement interval at the end of the index completes, and a mid-index stop becomes a pause instead of a lost position. The geometry is simple — one tooth of the drive sprocket carries the belt a fixed distance, and a fixed tooth count defines one placement index — and the rest of the program exists to protect that count. Below is the travel arithmetic, the counting and reset logic that holds the count through a stop, what the sensor input has to do, and the commissioning check that proves it on the machine.

How far does one sprocket pulse move the belt? #

One tooth of the 125 mm diameter, 15-tooth sprocket moves the belt π × 125 mm ÷ 15 = 26.18 mm, so the 26.2 mm per pulse measured on the track is the right value to program with.

That figure is a calculated example for the stated sprocket, not a measurement: one revolution advances the chain by the pitch circumference, and the tooth count divides that travel into equal pulses. The measured track value sits a fraction above the pure geometry, and measured wins — if the two ever disagree, re-measure rather than trust the formula, because the logic only needs one thing from the sensor: the same distance for every pulse. A tooth-triggered proximity switch delivers exactly that, with chain wear the one slow drift, and the commissioning check at the end is what catches it.

How many pulses make one placement index? #

Twenty-one pulses at 26.2 mm each give 21 × 26.2 mm = 550.2 mm of belt travel, which lands within 0.2 mm of the 550 mm index the placement station asks for.

The speed data closes the same loop. At 50 Hz the conveyor runs at 9.5 m/min, which is 9500 mm ÷ 60 s = 158.3 mm/s, and 158.3 ÷ 26.2 = 6.0 pulses per second — the tooth rate the sensor must deliver. Divide the other way and one full index takes 550.2 ÷ 158.3 ≈ 3.5 s of run time before the placement interval. Both are calculated examples for the stated conveyor data, not measurements, and together they set the two numbers the design lives on: the pulse period the input must catch, and the cycle time the placement timer sits inside.

Why does stopping mid-index lose the conveyor position? #

If the stop clears the counter, or the restart logic re-zeros it, the controller forgets how much of the index already passed and treats the restart point as the start of a new one, so the next placement lands one partial index late.

The count is the machine's only memory of belt position — nothing else in the system knows where the index stands. Stop the belt with half the index gone and the program, believing it is at zero, waits a full index from the wrong mark before it slows for placement; the product gets placed short by exactly the distance already traveled. In practice the count dies in one of four places, cheapest to check first:

  • the stop routine itself contains a counter reset;
  • a first-scan or mode-change initialization rung zeroes counters on restart;
  • the counter sits in a plain, non-retained variable, so anything that drops PLC power takes it along;
  • the variable is retained, but a power-up routine deliberately clears it.

None of these is a counting fault. The pulses were captured correctly and then thrown away, so the fix is never in the sensor or the input — it is in where the reset lives, which the next two sections pin down.

How do you keep the index count through a stop? #

Declare the counter as a retain variable — the IEC 61131-3 variable class that keeps its value through power failure — and write the stop so it drops the run command without writing to the count.

An ordinary operator stop leaves the PLC powered, so the retained count holds trivially; the retain declaration is what also carries it through a power failure, and the behavior behind how encoder counts survive a PLC power failure is the same mechanism this counter relies on. Two more rules complete the protection:

  • Keep counting through the deceleration ramp. When the run command drops, the belt does not stop on the spot; the teeth that pass while the drive ramps down are real travel, so the count stays enabled until the belt reaches standstill. Freezing the count at the instant of the stop throws the ramp travel away and shifts every index after it.
  • Let nothing else write zero. Cross-reference the counter in the program: the only rung permitted to clear it is the one that closes the placement cycle. Startup logic, mode changes and stop handling read the count — none of them resets it.

One safety note where it belongs: an emergency stop is a safety function under ISO 13850 and lives outside this logic — it removes motion, the retained count still tells the program where the belt is afterwards, and restarting motion stays a deliberate operator action after the reset.

In illustrative names — the settings do what their names say, and where they live depends on your controller — the logic is:

VAR RETAIN
    index_count : INT := 0;            // illustrative name; survives power loss
END_VAR
VAR CONSTANT
    index_target : INT := 21;          // pulses per placement index
END_VAR
VAR
    tooth_sensor      : BOOL;          // proximity switch on the sprocket
    tooth_last        : BOOL := FALSE;
    tooth_edge        : BOOL;
    drive_enabled     : BOOL;          // stays TRUE through the decel ramp
    placement_request : BOOL := FALSE;
    placement_done    : BOOL;          // from the placement timer
    index_authorized  : BOOL;          // product clear, station ready
END_VAR

// every scan
tooth_edge := tooth_sensor AND NOT tooth_last;
tooth_last := tooth_sensor;

IF tooth_edge AND drive_enabled THEN
    index_count := index_count + 1;
END_IF

IF index_count >= index_target THEN
    placement_request := TRUE;        // stop or slow, per the final requirement
END_IF

IF placement_request AND placement_done AND index_authorized THEN
    index_count := 0;                 // the only reset in the program
    placement_request := FALSE;
END_IF

// operator stop: drive_enabled drops only at standstill;
// nothing here or elsewhere writes to index_count

The proof of this logic is the stop-and-restart test in the last section.

Does the sprocket sensor need a high-speed counter? #

No — at this tooth rate the pulse period is about 166 ms, and an ordinary discrete input catches every pulse as long as the on-time at the terminal comfortably exceeds the input's documented response time plus one scan cycle.

A rule of thumb: keep the on-time at least ten times the total input delay, scan included. At this frequency that is easy — a pulse tens of milliseconds wide against a few milliseconds of input delay leaves an order of magnitude of margin or better. The critical detail is not speed but edge handling: count rising edges only, because a 166 ms pulse stays high for dozens of scans and a level-triggered add would count each tooth dozens of times. The capture discipline is the same one described for counting encoder pulses on a PLC without losing position, just at a far lazier rate. Measure the actual on-time once with a scope at the input terminal, or take it from the sensor datasheet, before signing the design off — and redo that check if the sprocket or belt speed ever changes.

When should the index count reset? #

In exactly one place: when the placement interval has completed and the next index is authorized, the counter clears once and the sequence restarts — never on stop, start, power-up or a mode change.

Whether placement means a full stop or a slow speed, the count sequence is identical: count to the target, request the placement state, hold it for a timed interval, then clear and resume. The requirement on this machine drifted between stopping and slowing; decide the output action at the end, because the count logic does not care which one it drives. Slowing is the kinder choice for the drive train — the 0.55 kW motor is spared repeated ramps to standstill and back — and the process stays continuous through the oven. Two details keep the reset clean:

  • Time the dwell, do not count it. During placement the belt is slow or stopped, so pulses arrive late or not at all; a timer keeps the release condition independent of belt speed.
  • Gate the release on the station, not the timer alone. Any placement or feeding action tied to the conveyor's speed state inherits the zero-speed dependency that shows up when a feeder stops creating pallets at zero conveyor speed; release the index only when the product is clear and the station signals ready.

What else moves the placement position besides the count? #

Even a flawless count can set the product down a few millimeters off, because the belt still travels during the deceleration ramp, the chain stretches slowly with wear, and the sensor measures drive rotation rather than the product itself.

Ramp travel is the big one and the most fixable: with a fixed deceleration time and a repeatable load it is the same every cycle, so it becomes a constant offset trimmed out once — measure it with the loaded belt, because an empty-belt measurement will not match. Chain stretch moves the distance per pulse in the third significant figure over months of running; the periodic re-measure in the commissioning check is what catches it. Chordal action, the small speed ripple as links roll onto the sprocket, rides on any chain drive but averages out over a full index, so it affects smoothness, not accumulated distance.

The structural limit is that a sprocket count is open-loop with respect to the product. Commit accordingly: if the placement tolerance is a few millimeters across the index, the count with a trimmed ramp offset is sufficient. If the product must land in a tighter window despite slip or creep on the belt, add a photoelectric sensor on the product leading edge and treat the count as coarse transport, closing the loop the way tracking conveyor parts with an encoder and a FIFO buffer closes it.

How do you test that the count survives a stop? #

Run four checks: one count per confirmed tooth over a full index, a mid-index stop with the count unchanged after restart, the same stop across a power cycle, and a counter that clears only when the placement cycle closes.

  1. Travel and tooth check. Paint one sprocket tooth, run one full index, and confirm the counter increments exactly once per painted tooth passing the sensor. Measure the belt travel over that index against a frame mark: it should land on the 550 mm target within measurement care. If it does not, re-measure the track distance and correct the programmed value.
  2. Stop-retention check. Start an index and press the ordinary stop with the count near halfway. The counter must hold through the stop and still hold after the restart, and the next placement must land on the same belt mark an uninterrupted cycle would produce.
  3. Power-retention check. Repeat the stop, then cycle PLC power. The count must come back; if it returns zero, the variable is not in the retain class or a power-up routine is clearing it — the counter cross-reference finds both.
  4. Single-reset check. Cross-reference every write to the counter. Exactly one rung may clear it, the one gated by placement completion and station authorization, and the counter must roll to zero only there, cycle after cycle.

Pass those four and the operator stop is what it should be — a pause button for the index, nothing more.

Questions asked

How long does one placement index take at run speed?

The 550.2 mm index divided by the 158.3 mm/s run speed gives about 3.5 s of travel per index, with the placement dwell added on top. At placement speed the final pulses arrive proportionally later, so size the dwell timer from the slow speed, not the run speed.

Does a power failure need anything beyond the stop logic?

Yes. The counter must be declared in the retain class, and the controller's documented retention behavior should be confirmed on both a warm restart and a cold power-up, because some platforms keep retained values through one and not the other. The stop logic itself needs nothing extra, since the PLC stays powered during an ordinary stop.

Does the counter notice reverse belt movement?

No. A single proximity sensor reports one pulse per tooth regardless of direction, so reverse motion still adds counts and stretches the index. If the process can back the belt up, for a rejected placement or a jam recovery, feed a direction signal from the drive or use a quadrature device so the logic can subtract, and treat any uncounted reverse as a trigger to re-verify position.

What if the belt is moved by hand with the drive disabled?

The gated logic ignores those pulses, so the count no longer matches the belt and the next placement shifts by the hand-moved distance. After any manual movement, run one verification index against a belt mark, or provide a slow jog mode with the drive enabled so deliberate movement keeps counting.

Keep reading

  • Selection guide

    Absolute encoder input card response time vs count rate

    Keep the 3-9 ms DC input card. Gray code changes one bit per count, so at a 10 ms count rate each input holds its level for two counts, 20 ms, against a 9 ms worst-case delay, and no transition is lost. The lag to budget is card delay plus PLC scan, about one to three encoder counts, which cam-switch replacement tolerates; the 0.8 ms card buys less than one count, so it is not worth a PLC family change.

    Sensors, encoders and machine vision on the machine

  • How-to

    Conveyor speed from a counter module frequency measurement

    Set the counter channel to its frequency measuring mode and read speed as cyclic process data: no OB40 interrupt routine and no scanning of input bits. Belt speed is the measured frequency times travel per pulse, so 500 Hz with 2 mm per pulse is 1.0 m/s (60 m/min). Verify the gate and valid status before trusting the value, and size the measurement time against your slowest speed.

    Sensors, encoders and machine vision on the machine

  • How-to

    Counting Encoder Pulses on a PLC Without Losing Position

    Count encoder pulses with a hardware high-speed counter input wired for quadrature, never with a count instruction in the scan. At 214 rpm and 75 pulses per revolution the encoder delivers 267.5 pulses per second, one every 3.7 ms, while a 10 ms scan cannot guarantee seeing even one in three. Zero the counter at a reference switch and treat every target as counts from that switch.

    Sensors, encoders and machine vision on the machine