K-BOXManual

K-BOX: digital measurement modes

Updated

Turn K-BOX's digital inputs into CAN measurements. Pick the mode that suits your signal and set its rate and edge. Each mode below shows how precise the result is.

Choose a measurement mode

Digital 1 to 3 measure signals. K-BOX processes each one and sends the result in its own CAN message, for example a pulse duration on CAN ID 0x310. Digital 4 has no measurement modes.

Measurement inputs on the K-BOX CAN connectors
Channel CAN connector pin
Digital 1 4
Digital 2 8
Digital 3 6

The inputs measure signals up to 100 kHz, with pulses of at least 100 ns and at least 10 µs between pulses. For voltage limits and thresholds, see K-BOX: connector pinouts.

  1. Open the Digital Channels tab. Select Load to read the current settings.
  2. Choose the mode. Select it from the Function list of the channel.
  3. Set where the result goes. Choose the CAN ID and the Rate at which K-BOX sends it.
  4. Choose the edge. For pulse duration, duty cycle, events and RPM, select Rising or Falling.
  5. Select Commit, then Export. K-BOX stores the settings and K-CAL writes a DBC file that decodes the new messages.
The Function list of a digital channel in K-CAL: Not Use, Output, Pulse duration, Frequency, High Frequency, Duty cycle/PWM, Event counter, Cycle duration and RPM, beside CAN ID 0x310 and Rate 100 ms
The Function list of a digital channel.

Watch: How to assign digital functions using K-CAL (0:53)

Digital input states

K-BOX also reports the plain logic level of its digital inputs. It sends a message on the Digital Inputs Status CAN ID at the rate you set, for example 0x300 every 100 ms. The first byte of the message holds the levels. The DBC file names the bits.

Pulse duration

Choose Pulse duration to measure how long a pulse lasts. Choose the edge on which the measurement starts. With Rising, K-BOX times the high part of the signal. With Falling, it times the low part.

K-BOX sends a message only when a measurement is complete, even if the rate interval has passed. It also stretches the message interval when needed so the CAN bus does not overload. With a 2000 Hz signal (0.5 ms period) on a 125 kbit/s bus that is not overloaded, the rate sets the interval as in the table.

Pulse duration: 2000 Hz signal, 125 kbit/s bus
Rate Message interval
50 ms Every 50 ms
1 ms Every 2 ms

Frequency

Choose Frequency to measure an averaged frequency. K-BOX counts the pulses during each rate interval and scales the count to one second:

Frequency (Hz) = 1 s × N pulses / Rate

If the frequency changes during the interval, the result is the average. A longer rate gives a finer result. At a rate of 1000 ms, the frequency resolves to 1 Hz.

Worked example

  • Rate: 100 ms.
  • The sensor runs at 10 kHz for 60 ms: K-BOX counts 600 pulses.
  • It then runs at 8 kHz for 40 ms: K-BOX counts 320 more.
  • Over the 100 ms interval K-BOX counts 920 pulses: 1 s × 920 / 100 ms = 9.2 kHz.
Counting pulses over one Rate window K-BOX · FREQUENCY AND RPM Counting pulses over one Rate window Frequency: one Rate window of 100 ms60 ms at 10 kHz: 600 pulses40 ms at 8 kHz: 320 pulsesPulseseach drawn = 200 ms60 ms100 ms920 pulses in the window: 1 s × 920 / 100 ms = 9.2 kHzRPM: one Rate window of 500 ms, one pulse per revolution300 ms at 2000 rpm: 10 pulses200 ms at 4800 rpm: 16 pulsesPulsesto scale0 ms300 ms500 ms26 pulses in the window: 60 s × 26 / 0.5 s = 3120 rpmThe frequency panel is not to scale: each drawn pulse stands for 20. Both results are the average over the Rate window. For a low frequency or a low speed, use cycle duration instead.

High frequency

Choose High Frequency for fast signals. It works like the frequency mode. K-BOX counts pulses over the rate interval, scales the count to one second and averages any change within the interval. The same 9.2 kHz example applies.

Cycle duration

Choose Cycle duration to measure the period T of one cycle. You can then calculate the frequency:

F = 1 / T

This is the instantaneous frequency of one cycle, not an average. K-BOX waits for the cycle to finish before it sends the duration, so a long cycle can make messages slower than the rate you set. If a cycle is shorter than the rate interval, K-BOX recalculates the duration before it sends it.

Cycle duration against the averaged modes K-BOX · CYCLE DURATION Cycle duration against the averaged modes RateOne long cycle TSignalNo message until the cycle endsCycle durationF = 1 / TRPM = 60 / TAveraged modesF = 1 s × N / RateOne message every RatetimeMessage sent on CANMessage held back by a long cycleRate intervalNot to scale. Cycle duration measures one period T and sends it only once the cycle has completed, so a cycle longer than the Rate delays the message. The averaged modes count the pulses in each Rate window and send one message every Rate.

Duty cycle and PWM

Choose Duty cycle/PWM to measure the duty cycle of a PWM signal. K-BOX measures the period T between two starting edges. It also measures the time P from a starting edge to the next edge, and reports P / T.

Choose the starting edge that the modulation does not move:

  • If the modulation is on the falling edge, choose Rising. A signal that is high for a quarter of each period then reads 0.25.
  • If the modulation is on the rising edge, choose Falling.

With the wrong edge the measured period moves with the modulation, and the same signal reads 0.75 instead of 0.25. K-BOX changes the message rate for this mode when needed so the CAN bus does not overload.

Choosing the start edge for duty cycle K-BOX · DUTY CYCLE Choosing the start edge for duty cycle Modulation on the falling edgePTStart edge: RisingCorrect: P / T = 0.25T stays fixedPTStart edge: FallingWrong: P / T = 0.75T moves with the modulationModulation on the rising edgePTStart edge: FallingCorrect: P / T = 0.25T stays fixedPTStart edge: RisingWrong: P / T = 0.75T moves with the modulationStart edge: T and P are measured from itEdge moved by the modulationK-BOX measures T between two start edges and P from a start edge to the next edge, and reports P / T. Choose the start edge that the modulation does not move. Not to scale.

Event counter

Choose Event counter to count edges. Choose Rising or Falling. The counter increases by one on every edge of that kind. The counter resets when K-BOX is power cycled or receives a new configuration.

RPM

Choose RPM to measure revolutions per minute. Choose the edge on which K-BOX counts. K-BOX counts the pulses during each rate interval and scales the count to one minute:

RPM = 60 s × N pulses / Rate

If the speed changes during the interval, the result is the average. The example below assumes one pulse per revolution.

Worked example

  • Rate: 500 ms.
  • The sensor turns at 2000 rpm for 300 ms: K-BOX counts 10 pulses (2000 × 0.3 s / 60 s).
  • It then turns at 4800 rpm for 200 ms: K-BOX counts 16 more (4800 × 0.2 s / 60 s).
  • Over the 500 ms interval K-BOX counts 26 pulses: 60 s × 26 / 0.5 s = 3120 rpm.

Each pulse is worth 60 s / Rate, so the result moves in steps of 120 rpm at a 500 ms rate and 60 rpm at a 1000 ms rate.

Instantaneous RPM

To measure a low speed precisely, set the channel to Cycle duration and calculate the instantaneous speed of one revolution from its period T in seconds:

RPM = 60 / T

As with any cycle duration, K-BOX sends the value only when the revolution is complete.

Next: K-BOX: conversion tables and formulas.

Products in this guide

K-BOX

Multi-sensor data acquisition

View K-BOX Ask an engineer

Still stuck?

Our engineers answer support questions on every Influx Technology product.