AutomateDirectUSAMotion LibraryIndustrial monitors & PCs

How-to

Conveyor speed from a counter module frequency measurement

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

Short answer

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.

On this page
  1. Can I just read the pulse inputs in the PLC scan?
  2. What does one pulse mean on your conveyor?
  3. How do you set the TM Count 2x24V channel to frequency measurement?
  4. How do you know the channel is actually measuring?
  5. How do you turn the measured hertz into belt speed?
  6. How long should the measurement time be at your slowest speed?
  7. Do you still need a hardware interrupt to catch the pulses?
  8. Questions asked

The speed value you are looking for is the counter channel's own frequency measurement, not a heap of pulses collected in scan logic or in an interrupt routine. Set the TM Count 2x24V channel to its measuring function, read the frequency value together with its valid flag from the technology object's input interface, and multiply by the belt travel one pulse represents. The worked case below uses a 60-tooth wheel on the idler shaft and lands on 1.0 m/s, or 60 m/min. The sections follow the decisions in the order you meet them: pulse meaning, channel configuration, status checks, conversion, measurement time, and where the value lives.

Can I just read the pulse inputs in the PLC scan? #

No, because a scan-based read samples a stored input image once per cycle and silently misses every transition that arrives between two reads, while the channel's measuring mode accepts every edge in hardware and hands you the frequency directly.

A counting input is hardware that qualifies and stores edges as they arrive, between scans and outside the CPU cycle entirely. An ordinary Boolean read in the program sees a sampled image, so the faster the belt runs and the slower the scan, the bigger the silent pulse loss. That is what the counting inputs exist for, and the same channel offers a measuring function for the speed question: select measuring instead of counting and the module reports how quickly pulses arrive, in hertz, as an input value your program reads every cycle.

An accumulated count answers a different question — how far the belt has travelled — and if you need that too, counting encoder pulses on a PLC input without losing position covers keeping that count intact. For the speed tag, the measuring function is the whole answer; the count plays no part in it.

What does one pulse mean on your conveyor? #

Every accepted pulse stands for a fixed length of belt travel, and you need that length in millimetres per pulse before any frequency value means anything: pulses per shaft revolution times belt travel per shaft revolution.

Work the scaling from the mechanics before touching configuration. Example inputs: a 60-tooth wheel runs on the idler shaft, and one full turn of that shaft moves the belt 120 mm, so one pulse represents 120 mm ÷ 60 pulses = 2 mm of belt travel.

Then check what the sensor actually follows. A pulse source on the motor shaft needs the drive ratio folded into that travel figure. A measuring wheel needs its effective circumference and firm, slip-free contact, because a slipping wheel reports the wheel's motion, not the belt's. A photoeye that fires when a box passes measures product rate, which equals belt speed only when spacing is fixed; for conveyor speed the pulse source must be mechanically tied to the belt or a belt-driven shaft. If you are reading shaft speed from a pulley-mounted switch, measuring RPM with a proximity switch on a pulley covers the sensing side.

Fit, clean or adjust tooth wheels and measuring wheels only with the conveyor drive locked out.

How do you set the TM Count 2x24V channel to frequency measurement? #

Insert the module from the hardware catalog as a technology module, set its operating mode to run under the counting-and-measuring technology object, then select the measuring function for the channel that carries the pulse signal.

On an S7-1500 with the TM Count 2x24V, the documented procedure runs like this:

  1. Insert the module from the hardware catalog under Technology modules and wire the pulse source to the counting input of one channel, with the reference connection the module's connection diagram shows.
  2. Set the operating mode to operation with the Counting and measuring technology object (the High_Speed_Counter object in the project) rather than plain input and output operation.
  3. In that technology object, select the measuring function on the channel and enter its measurement time, the integration interval sized in a section below.
  4. Match signal levels: a 24 V proximity switch feeds the channel as it is, while a 5 V encoder or line-driver output needs level matching first, as worked through for connecting a 5 V linear scale to a 9-24 V counter module.
  5. Set the edge or encoder evaluation to the convention your travel-per-pulse figure assumes: one counted edge per pulse for a single-channel switch, or two-edge and four-edge evaluation of a quadrature encoder, which multiplies the effective pulses per revolution by two or four.
  6. Compile, load, and run the status checks in the next section before reading any speed value.

The configuration's manual operation page holds commissioning controls that drive the channel by hand; use them once to prove the wiring, then leave them off so the application owns the channel.

How do you know the channel is actually measuring? #

Read the channel status twice: with the conveyor stopped you want a healthy module with no gate or configuration fault, and with it running you want an active measurement whose valid flag is set and whose frequency climbs with belt speed.

A gate is the condition that permits the channel to acquire. Depending on the configuration, the gate input can block or enable counting, and a software gate left closed behaves the same way; a gated-off channel looks enabled but idle and returns no measurement whatever the belt does. Establish which gate condition your configuration expects before blaming the signal.

Then read status and value together:

  • Conveyor stopped: healthy module status, frequency at or near zero, no wiring or configuration fault flagged.
  • Conveyor moving: measurement active, valid flag set, frequency rising with speed.
  • Value frozen while the belt moves, or the valid flag dropped: an invalid or retained value is not a speed sample; resolve the gate, level or wiring before scaling anything.

A frequency that never leaves zero with a 24 V proximity switch on the input is more often a level or reference-wiring problem than a configuration one; meter the terminal to confirm the pulses the module is being asked to accept.

How do you turn the measured hertz into belt speed? #

Multiply the measured frequency by the travel one pulse represents: v = f × d, so the worked case of 500 Hz at 2 mm per pulse gives 500 × 2 mm = 1000 mm/s, which is 1.0 m/s or 60 m/min.

Worked example, with example inputs and a calculated result, not a measurement:

  • Pulse source: 60-tooth wheel on the idler shaft; one shaft revolution moves the belt 120 mm.
  • Travel per pulse: 120 mm per revolution ÷ 60 pulses per revolution = 2 mm per pulse.
  • Measured frequency: f = 500 Hz.
  • Speed: v = f × d = 500 pulses/s × 2 mm/pulse = 1000 mm/s = 1.0 m/s.
  • In plant units: 1.0 m/s × 60 s/min = 60 m/min.

If the technology object is configured to hand over an already-scaled speed instead of raw hertz, check that its scaling equals the travel per pulse you derived and stop there; applying the mechanical conversion a second time doubles the display.

How long should the measurement time be at your slowest speed? #

Size the measurement time so roughly ten pulses arrive per interval at your slowest belt speed; for the worked example that means a slowest speed of 0.05 m/s is 25 Hz, and a 0.5 s measurement time collects about 12 pulses.

Over a measurement time t, one pulse's worth of uncertainty is travel per pulse divided by t, and that quantum is the smallest step the displayed speed can take. For the worked example, with d = 2 mm:

  • Slowest belt speed in this example, 0.05 m/s, corresponds to 0.05 m/s ÷ 0.002 m/pulse = 25 Hz.
  • At t = 0.5 s the channel collects 25 Hz × 0.5 s = 12.5 pulses per interval, and one pulse moves the reading by 0.002 m ÷ 0.5 s = 0.004 m/s: about 8% of the slowest speed, but only 0.4% at full speed.
  • Rule of thumb: keep at least ten pulses per interval, so t at least 10 × d ÷ v_slowest = 10 × 0.002 m ÷ 0.05 m/s = 0.4 s; the 0.5 s setting above meets it.

The price of a longer interval is response: a stalled belt shows up one measurement time late. Some channels measure the period between edges instead of counting pulses over the interval, which sharpens resolution at low speed; check which method your module's measuring function uses and size the interval to your display tolerance.

Do you still need a hardware interrupt to catch the pulses? #

No: for conveyor speed the measured frequency is cyclic input data from the technology object's interface, so there is no pulse-catching routine to write in OB40, and a hardware interrupt earns its place only when the program must react to a specific module event.

OB40 is the tool for module events the program must react to inside the scan — a measured value crossing a setpoint, a diagnostics event, a count match — and a speed display is not that job. The frequency value and its status sit in the technology object's input data and are read every cycle like any other process input; an interrupt routine would only copy data the module already holds, adding interrupt load for nothing.

A common related mix-up: %I0.0 and %I0.1 are process-image input addresses, not terminals, and they carry whatever the hardware configuration assigns there, so check the project's actual address assignment instead of assuming the first two bits. The counting channel is reached through the technology object's interface, not by scanning ordinary input bits. Your speed tag is that measurement value read together with its valid flag, every cycle, with a dropped valid flag treated as no speed sample.

Questions asked

Why does the displayed speed jitter between two values when the belt runs steadily?

The reading is assembled from whole pulses per measurement interval, so at low belt speed a single pulse swings the result by a large percentage; in the worked example the interval resolves about 0.004 m/s, which is small against a running speed but coarse near zero. Lengthen the measurement time, average several consecutive readings in the logic, or fit a wheel with more teeth to raise the pulse rate.

How do I show the speed on an HMI in metres per minute?

Convert once, in the PLC: multiply the metres-per-second value by 60 before writing the tag the screen reads, so the display already shows metres per minute and no conversion lives on the screen side. Freeze the display or show a stopped indication when the valid flag drops, because near standstill the interval-based reading gets noisy and a live but meaningless number invites wrong decisions.

What pulse frequency is too high for the counter channel?

Take the maximum input frequency from the datasheet of the exact module, not from an article. Compare it with your top belt speed divided by travel per pulse: on the example scaling, a 2 m/s belt asks for 1000 Hz. Modern high-speed counter inputs accept that comfortably, but an older module still sitting in its default counting mode deserves the check before you trust it at top speed.

Can one channel give me belt speed and product count at the same time?

One configured channel runs one measuring function, so speed and product count from the same pulse train need a second path. Give the product photoeye its own ordinary digital input; its pulse rate is far slower than the tooth-wheel signal and a scanned input generally keeps up with a few boxes per second. If the module has a second counting channel, that works too.

Keep reading

  • How-to

    Sizing a Spindle Encoder Input for Servo Feed Control

    A 2000 PPR quadrature encoder on a 250 RPM spindle produces 33,333 counts/s, which fits a 50 kHz counter but overruns a 10 kHz variant; the most resolution that counter family allows is 3000 PPR. Scale feed per revolution to motor RPM through screw lead and gear ratio, then keep command pulses per revolution low enough that rapid speed stays under the 100 kHz pulse-output ceiling.

    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

  • How-to

    Measuring RPM With a Proximity Switch on a Pulley

    One bolt pass per revolution at 6,000 RPM is a 100 Hz signal any standard inductive proximity switch can produce and a scanned PLC input cannot reliably count, so route it to a high-speed input and verify the ON pulse clears the input's documented minimum — 100 µs on the DL05's X0–X2 inputs — with a scope at full speed.

    Sensors, encoders and machine vision on the machine