AutomateDirectUSAMotion LibraryIndustrial monitors & PCs

How-to

Connecting a 5V linear scale to a 9-24V counter module

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

Short answer

A 5 V linear scale cannot drive a 9-24 VDC optically isolated counter input: the input's series resistor is sized for the higher supply, so 5 V falls below guaranteed optocoupler turn-on. Raise the level with a purpose-built interface board, an isolated DIN-rail pulse conditioner, or the two-NPN, two-10 kΩ circuit from the Counter I/O manual. A resistor divider only steps voltage down, and an analog signal conditioner has no edge bandwidth.

On this page
  1. Get the module and the counting resource right
  2. Why the scale's pulses die at the input
  3. Choose the shifter: board, isolated conditioner, or solder it yourself
  4. Wiring and configuration steps
  5. Checking the count rate for a 5 µm scale at 200 mm/s
  6. Prove it at feed rate
  7. Questions asked

A 5 VDC linear scale will not drive the 9-24 VDC input of a counter module directly. That input is an optocoupler behind a series resistor sized for the higher supply, so the scale's TTL-level pulses fall below guaranteed turn-on. You need a level shifter between the two: a purpose-built interface board that raises TTL levels to the module's input levels, an isolated DIN-rail pulse conditioner, or the two-NPN, two-10 kΩ resistor circuit printed in the Counter I/O manual. A resistor divider cannot do the job, because it only steps voltage down, and an analog signal conditioner has no edge bandwidth. One more thing before you cut wire: on a D0-06 CPU the module is the H0-CTRIO2, not the H2-CTRIO2.

Get the module and the counting resource right #

Two ordering mistakes cost a day each. The first is the part number. The H0-CTRIO2 is the DL05/06 pulse combo module and drops into the D0-06's option slot; its catalog listing shows 4 high-speed input points, sinking or sourcing, single-ended encoder support, and a 250 kHz maximum switching frequency. The H2-CTRIO2 is built for the DL205 base: it will not mount, and the CPU will not see it. Read the box label before anyone strips wire.

The second is assuming you do not need the module. The CPU's built-in high-speed I/O is a single configurable block: once it generates the stepper pulse trains, its counter modes are unavailable, and no mode provides pulse output and quadrature counting at the same time, the resource squeeze behind why three stepper axes need dedicated high-speed outputs. The scale therefore lands on the counter module, whose four input points cover a quadrature pair and the marker with one to spare. Ordinary DC inputs are no substitute: they are scan-sampled behind a filter and lose edges at feed rate.

Why the scale's pulses die at the input #

Each counter input is an optocoupler LED with a series resistor sized so the rated field voltage pushes rated LED current. Feed it the scale's 5 V and the current collapses to a fraction of rated, below the guaranteed turn-on threshold. Two outcomes follow. Either nothing counts at all, or the input sits near threshold: it counts on the bench, then drops counts when the panel warms, the cable grows, or the axis runs fast, because near threshold an optocoupler's turn-on time stretches and edges arrive late and jittery.

Resistors alone cannot fix this. A divider goes down, and you need to go up. An analog conditioner is the wrong family too: it scales a DC level, as in an FC-33 4-20 mA to 0-5 V calibration, and has neither the bandwidth nor a switched output for encoder edges. The same threshold physics on a PLC's own inputs is covered in connecting a 5V servo encoder to 24V PLC inputs; here the fix lands on the counter module instead.

Choose the shifter: board, isolated conditioner, or solder it yourself #

Option What it is Pick it when
Purpose-built interface board Raises TTL signal levels to the counter module's input levels You want the cheapest ready-made path sized for this module
Isolated DIN-rail pulse conditioner Switched output with galvanic isolation Scale ground and field ground must stay separate, or the panel spec wants a listed part
Circuit from the manual Two NPN transistors and two 10 kΩ resistors on perf board The parts are in the drawer and the machine has to run tonight

For the discrete version, the "H0-CTRIO(2) TTL Quadrature Encoder Field Wiring" pages of the Counter I/O User Manual show the arrangement: one NPN per channel, base driven from the scale output through a 10 kΩ resistor, collector landed on the counter input terminal, with the input common tied per the manual's sinking or sourcing diagram. Get that common backwards and the input never sees current.

Three properties of that circuit matter. It inverts each channel; A and B invert together, so quadrature direction survives, but the marker pulse goes active-low and the homing logic must expect it. A saturated NPN adds storage time that stretches each pulse, the first limit you hit as count rate climbs. And it provides no isolation, so the scale supply's negative and the field supply's negative must be bonded at one point.

Wiring and configuration steps #

  1. Lock out the machine's energy sources and power down the base, then install the H0-CTRIO2 in an option slot.
  2. Bring an external 9-24 VDC supply to the input common, landed per the manual's sinking or sourcing diagram.
  3. Mount the shifter at the scale head. Keep the 5 V run short and send the higher level down the long cable; that is where the noise margin earns its keep.
  4. Use shielded cable with the shield bonded to panel ground at one end only, routed away from the stepper motor leads; chopper drives radiate right where your edges live.
  5. With the non-isolated circuit, bond the scale supply negative to the field supply negative at a single point.
  6. In the counter configuration software, define the input as a quadrature counter, set the decode multiplier and scaling, download, and watch the raw count.
  7. Write the ladder that reads the module's data only after the raw count tracks the axis, using the checks below.

Checking the count rate for a 5 µm scale at 200 mm/s #

Take a typical case and swap in your own scale's numbers: 5 µm resolution, 200 mm/s maximum feed, ×4 quadrature decode set in the counter configuration. The module limit is the H0-CTRIO2's 250 kHz maximum switching frequency from its catalog listing; the Counter I/O manual's input spec table gives a 0.5 µs minimum pulse width. Read the frequency rating as the decoded count budget, the conservative reading; if the table states it as a per-channel figure instead, your headroom only grows.

The rule in words: channel frequency equals axis speed divided by scale resolution, and the decoded rate is that times the decode multiplier. Keep the decoded rate under the budget at maximum feed, and the channel half-period above the minimum pulse width. The same arithmetic for a PLC's built-in counter is walked through in matching an incremental encoder to a PLC high-speed counter.

The arithmetic, with units:

  • Channel frequency: 200 mm/s ÷ 0.005 mm = 40 000 pulses/s = 40 kHz per channel.
  • Decoded rate: 40 kHz × 4 = 160 kHz.
  • Channel period: 1 ÷ 40 000 pulses/s = 25 µs, so a half-period of 12.5 µs, which is 25 times the 0.5 µs minimum.
  • Top speed at the budget: 250 kHz ÷ 4 = 62.5 kHz per channel, and 62.5 kHz × 0.005 mm = 312.5 mm/s.

Result, a calculated example for these inputs and not a measurement: 160 kHz decoded sits inside the budget with 90 kHz to spare. Decision: this axis runs freely at its 200 mm/s feed, and any future feed or resolution change must stay under the budget, which with this scale means below 312.5 mm/s. Beyond that, coarsen the resolution or change the counter, because counts vanish exactly when the machine moves fastest.

Prove it at feed rate #

  1. Jog a measured distance; the count delta must equal distance divided by resolution within one count.
  2. Run out to a hard stop and back; the count must return to the same value. Any offset is lost counts, not backlash.
  3. Repeat both tests at maximum feed. Losses that appear only at speed point at edge quality: transistor storage time, cable capacitance, or marginal drive at the terminals.
  4. Park the axis and run the steppers at full current. Count creep with nothing moving is noise; fix the shielding, the single-point bond, and the routing.
  5. Repeat with the panel closed and warm for an hour; a marginal opto bias is temperature dependent.

Recurring failures and their fixes:

  • Direction reversed: swap A and B at the shifter, or flip the direction in the counter configuration.
  • Count off by exactly 4× or 2×: decode multiplier set differently from the wiring.
  • Marker never detected: the transistor stage inverted it, so the homing logic must look for the low-going edge.
  • Clean counting at low speed only: a rate problem; redo the arithmetic above.

Questions asked

Can I count the scale into the PLC's ordinary DC inputs with ladder logic instead?

No. Those inputs are scan-sampled behind a filter, so at most one edge per scan survives. At a 40 kHz channel rate and a 5 ms scan, for example, about 200 edges arrive between scans and a sampled input captures one of them. The setup looks fine when you hand-turn the axis on the bench and loses counts the moment it runs. Quadrature edges need hardware counter inputs.

What does the module's 9-24 VDC input rating actually mean?

It is the field voltage you must deliver at the input terminals to push rated current through the optocoupler LED. The module does not power its inputs from the backplane, so you wire an external supply to the input common following the manual's sinking or sourcing diagram. Five volts from the scale falls short of that drive, which is why a shifter sits between the two.

What happens if my decoded count rate exceeds the module's rating?

Counts are lost progressively, worst at top feed, so position error accumulates exactly when the machine moves fastest. Above the 250 kHz budget, coarsen the scale resolution, cap the feed, or move to a faster counter. Do not rely on the axis never reaching maximum speed, because rapid moves and returns will take it there.

Should I disconnect the old standalone counter?

Leave it wired in parallel through commissioning. If the module's count drifts while the standalone counter keeps tracking, the fault is in the new path (shifter, wiring, or configuration), not the scale. Once the module holds count through the warm-panel test at full feed, the standalone counter can come out.

Keep reading

  • How-to

    Connecting a 5V Servo Encoder to 24V PLC Inputs

    No interface can raise the PLC input's own frequency limit, so a 20 kHz optocoupler board does not make a slower high-speed input faster. Compute f = RPM × pulses per revolution ÷ 60 first; if it exceeds the input's documented maximum, use a faster counter input. If it fits, translate the 0-5 V signal through an optocoupler whose LED current, output topology and switching times all check out.

    Sensors, encoders and machine vision on the machine

  • Explainer

    Incremental encoder vs counter input: speed and direction

    A counter input that only accumulates one encoder channel gives speed magnitude and loses direction, and a software-polled input misses edges as speed rises. Direction needs an input that decodes the quadrature channel phase in hardware, rated above the channel frequency at maximum speed. Signed rpm then comes from 60 times the signed count change, divided by decoded counts per revolution times the interval in seconds.

    Sensors, encoders and machine vision on the machine

  • 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