Digital counters

An electronic counter is a sequential digital device, which is used for counting the number of pulses that are coming at the input line in a certain time period. There are many different types of counters. The simplest type of digital counters track and count time and work similarly as a well-known stopwatch. This means that they can be reset and can count up to the certain value of digits.

Counters are mainly used for measuring RPM and angle of rotating machines. Dewesoft super-counters work on a 102.4 MHz internal time base, always, independent of the current sample rate. In comparison to standard counter, which only output whole numbers like 1,1,2,2,3,4, … one sample later, Dewesoft X is able to extract the accurate values like 1.37, 1.87, 2.37, … fully time- and amplitude-synchronized! This is done by measuring the exact time of the rising edge of the signal with an additional counter. Each counter has three digital input which are fully synchronized with analogue data.

There is also a special counter pinout on Sirius slice, called STGM-DB.

We can connect the digital inputs to several Dewesoft DAQ devices. Take a look at the picture below for more information.

An electronic counter is a sequential digital device, which is used for counting the number of pulses that are coming at the input line in a certain time period.

There are many different types of counters, which are designed regarding the particular needs of the customers. The simplest type of digital counters track and count time and work similarly as a well-known stopwatch. This means that they can be reset and can count up to the certain value of digits.

Dewesoft X Counter module is used to perform counting and frequency measurements.

Typical applications are:

event counting (basic, gated, up/down, basic encoder)

sensor (encoder, tacho, CDM, 60-2,...)

waveform timing (period, pulse-width, duty cycle)

A special mode, called super-counter, allows exact frequency measurement and direct support of the most commonly used sensors. All other counters offer only a specific subset of operation.

Maximum frequency bandwidth for the counters is 10 MHz!

Basically, the input to the counter should be a clean digital signal, where most of the cards support 5 V levels as the default (some cards offer higher input signals or even variable trigger levels). If the user has lower or higher signals, some conditioning in front of the counters should be used.

Next we need to set the input filter for the counters. The input filter is needed to prevent glitches and spikes in digital encoder pulse signal. It can be set from 100ns to 5us, the optimal setting is derived from following equation:

where:

RPMmax are maximum revolutions per minute [RPM]

PulsePerRevolution is the number of pulses per revolution of the sensor

Factor 10 in the equation means that we take 1/10 of the pulse width at max RPM.

Example: Let's say that our machine is running at 3000 RPM and we have the encoder with 512 pulses per revolution. If we insert these number in the equation above, we get the next result:

We need to set the filter to react a bit faster than what we expect the events, we need to set it a bit slower than expected frequency of the glitches. With a manual switch and a 102.4 MHz base clock, some glitches can be expected.

The red curve shows the digital signal from the switch and the blue curve shows the counter value.

The counter value is increased by each transition from low to high.

We can see at some points that the values are counted up when there is a glitch (no real pulse). This is because a counter can see every glitch (even below 20 nanoseconds) in the signal. Therefore, we need to use a filter to filter out these glitches.

For example, we use the filter of 500 nanoseconds. Filter checks if each pulse is high at least 500 nanosecond. If it is, the counter value is increased.

Gated event counting is a mode where the counter counts only when the gate signal is high.

The counter signal is connected to the same input as with Simple event counting, but we need to connect an additional second signal - the gate. We should connect the second switch to CNT_IN1.

Then we perform the setup of the counter channel. We should choose Gated event counting mode and set the Signal input (CNT_IN0) and the Signal gate (CNT_IN1).

Counter will count the transitions from low to high only when the signal gate is high. Since the Signal gate is inverted (normally it is high), it is necessary to also invert the gate signal so it will count only when a button is pressed.

In the example below, we can see how this counter works.

The green signal (from counter) counts up when the red signal (gate signal) makes a transition from low to high and when the gate signal (red) is high.

Up/down counting is a counter operation which counts up when the gate is high and counts down when a gate is low. The encoder operation is similar to this one, in fact, we can use this mode to make X1 mode encoder measurements, but some more electronics are needed.

The connection is the same as in the previous example - gated event counting. We should choose Up/Down counting as Counting mode in the Channel setup and select the Signal input (CNT_IN0)and the Signal up/down signal (CNT_IN1).

On the measurement, we can see that when the gate (red signal) is down, the counter counts in the negative direction (blue signal). When the value of the gate is high, the counter counts in the positive direction.

An additional error occurs due to mechanical tolerances of the used encoder. Depending on the encoder mode setting used (X1, X2, X4), they have an influence on the measurement.

X1 mode

For X1 mode, only the rising edge is important. If the sensor marks are not precisely repeating at constant delta angles (have a constant “jitter”), this also can be compensated with the reference curve option.

Good:

Bad:

X2 mode

For X2 mode both the rising and falling edge of the first encoder track are used, which doubles the resolution. But if the duty cycle is not exactly 50%, another error is introduced.

Good:

Bad:

X4 mode

Both falling and rising edges of both encoder tracks are used in X4 mode to get 4 times the precision. The phase shift between the two tracks must be exactly 90° and the duty cycle 50%.

Good:

Bad:

Therefore, the higher the mode used (e.g. X4 compared to X1), the more noise will be in the measurement due to the discussed mechanical tolerances because all effects appear together. In a manner of speaking an encoder with a high resolution (e.g. 3600 pulses), is difficult to manufacture precisely, and therefore will have more noise in X4 mode than one with lower resolution (e.g. 360 pulses) in X4 mode.

Of course, if using two encoders (as in torsional vibration), the errors are doubled.

We also need to set the number of Encoder pulses for internal calculations (360 in this case).

The picture below shows the operation. The blue curve is the zero signal, and the blue and orange curves are encoder output. When a pulse is detected on the zero pulse input, the counter value resets to 0. The red curve shows the counter value.

The picture below is of a zoomed region of the recorder. It shows that the encoder resets the value of the zero pulse and continues to count up on the rising edges of the A signal.

The encoder fatigue life gets shortened by non-centric mounting due to vibrations.

Usually the Z reset pulse appears when A and B signal are high; in the case shown below we see that the Z pulse stays high for more than one period, so it is faulty and the encoder must be replaced. Usually you would recognize this by spikes in the frequency signal. To detect, please sample the raw A, B, Z signals with the highest sampling rate (e.g. 200 kHz), while slowly turning the machine.

Period and pulse-width measurements are similar in function. The period measurement measures the time between two consecutive low to high transitions, while the pulse-width measurement measures the time that the signal is high. The duty cycle is a procedure where the ratio between the high (or low) pulse of the signal and the period is measured.

REQUIRED HARDWARE

DEWE-43, SIRIUS ACC+, MULTI

REQUIRED SOFTWARE

ANY VERSION

SETUP SAMPLE RATE

AT LEAST 1 kHz

We will use the same configuration with two buttons for this measurement. The hardware connection is simple - we only connect one switch to the CNT_IN0.

Then we go to Channel setup → Counter and in the "channel setup" for that counter.

First we select the Basic application as Waveform timing and Timing mode as Period, pulse width, duty cycle.

We set the Signal input to CNT_IN0 and invert the signal, by checking the inv checkbox, so it is normally low; we can also set the signal Input filter to prevent glitches.

The new value is calculated only when a signal changes the value from low to high. Therefore, the value can't be calculated most of the time. We can select to output zero value when no new value is available, so we will have only spikes at the points of new data and the rest of data the value will be zero.

The example below shows how the measurement is performed. The two white cursors in the recorder show the time difference of the two pulses (it is shown on the left on the recorder setup screen). It reads 201.8 microseconds. The counter value is, of course, much more exact, as it shows 202.7 microseconds. Since the counters are running with an 80 MHz clock, we have a microsecond resolution. Out of the period, the counter also calculates a frequency, which is simple 1/period. We can set the units of period values and frequency in the channel list on the setup screen.

The duty cycle measurement is a procedure where the ratio between the high (or low) pulse of the signal and the period is measured.

As was previously stated in the encoder tutorial, the decision to use X1, X2 or X4 mode depends on the quality of the encoder and the encoder electronics.

The same encoder, as was used for the Encoder tutorial, will be used to measure its quality.

For this measurement, we need to set the Period, pulse width, duty cycle mode as Timing mode. If this mode is not available, then the counter does not support it.

Then we can directly select the Period, pulse width, duty cycle and also the frequency output channels. The counters are set automatically for this operation.

Now let's look at the duty cycle measurements. The upper graph in the picture below shows the period and pulse-width of the signals. In the lower graph, we can see the duty cycle for the few rotations of the encoder. We can observe nicely that there are some points where the encoder has a slightly larger error than in the rest of the data. The value there is approximately 51.978 %, so this means that the encoder mode X2 will have around a 2% of error.

Frequency/super-counter mode has many advantages over traditional counter measurements.

The problem with traditional counters is that the value of the counter is latched only at a sample rate interval. Therefore, we only have discrete values on each sample. Since the counters can measure exactly where the position of the pulse is between two samples, we can calculate two things out of this: the exact interpolated position of the counter at the sample point, as well as the exact frequency of the pulses.

So how does this mode works? The hardware configuration is as follows: we connect a signal (this could be from an encoder, as in an example below) to CNT0.

Now let's set up the channels. Counter channel needs to be an event counter.

The counter is set to Event counting and Basic encoder counting, and then the only thing left is to check the Advanced counter mode. Then the counter pair is set automatically and we have an exact count and an exact frequency as the calculated output channels. The Raw_Count and Raw_EdgeSep are only for advanced purposes - they are raw values coming from the counters.

We have the Source0, also shown as a digital line and in the second graph, the blue curve is the normal counter (raw counter values), which increases the value of each sample. Meanwhile, the red one is the super-counter, where the values are interpolated between the counts, and even more importantly, also between the samples.

EXAMPLE: Set the signal frequency from half of the sampling rate up to 50% higher that the sample rate. We will see normal counter staying the same for the sample, then jumping, then staying the same again or jumping for two values. The result will be really poor. But if we use super-counter, the values will be perfectly aligned to the input as shown in the example below. Also, the frequency measurement will be perfect in this case.

The data file below shows the run-up and run-down of the test machine, where the super-counter and the frequency are showing perfect measurement results. This is actually the recommended way of measuring all advanced DSA features like order tracking, torsional vibration and rotational vibration.

The super counter mode is also used in a special counter mode, called "Sensor" mode (selected from the Basic application drop down menu). This mode allows the direct use of the digital speed/position sensors as defined in the Counter sensor editor. You can choose rotary encoders, linear encoders, CDM sensors (angle sensors with zero reference), gear tooth with missing or double teeth and tacho probes.

The only thing needed is to select an appropriate sensor from the Sensor type drop down menu. If the sensor is not yet defined, there is a three ellipsis button on the right side which opens the counter sensor editor. This is where sensors can be defined. The sensors will always run in the supercounter mode, showing the exact frequency and angle.

The benefit of using sensors is that scaling will be done automatically, so we don't have to worry about that anymore. There are still several options to choose from. For encoder, we can select the Encoder mode (X1, X2 or X4) and either use the Encoder zero or not.

If zero is used, then there is a message telling us how many pulses between two zero points are seen, just to inform the user about possible setup or connection errors (as like shown in next picture).

The CDM, tacho and gear tooth have no special settings, so they will depend only on how the sensors are set up in the sensor definition.

The DS-TACHO4 sensor is a threshold sensor. This is important especially for the proximity detection mode, the most commonly used for rotating: working distance could change with the albedo and/or the form and distance of the target, also, contrast appears as an important parameter: teeth-no teeth, black and white marks. The recommended distance for encoding application is a few millimetres: put the probe closed to the target to avoid an incorrect reading resulting from rocking and wagging of the turning part (Descartes optical law); on the other hand, the reflective tape allows for much more than 100 mm. It is highly recommended that you use the adhesives encoders for optimal results.

A few phenomena may affect the detection function, such as a drop of liquid on top of the probe, excessive dust covering the top, more generally, a non-transparent environment for our light source such as: diesel engine sump film ( i.e. carbon is not transparent for the near I.R.). Patented concept implemented in the sensors strongly simplifies mounting and set-ups. Prior to measurement, it is recommended that a detection test is performed, even at low speed, to ensure detection feasibility and determine detection distance required for the sensor.

If impossible to perform a test due to technical reason or mounting specifics, a theoretical method would be to fix the probe at a distance equivalent to the width of the black and width strips to detect- in any event, without exceeding 4 mm.

Fixing and support of the probe will influence the acquisition of the reading. Please be careful regarding vibration. We recommend that you design your supports including appropriate vibration orders studies. The further the probe will be away from the target, the more the TTL amplitude signal will decrease.

Mounting the probe

Ensure that you have all items required at your disposal, i.e. the sensor, the probe, and the two hand-pieces for optical fixation

Put the two hand-pieces down if they are on the optical head of the sensor

Insert the two optical fibres with their respective rivets

Screw the first hand-piece on and tighten moderately; a little gap between the rivet head and the optical head is normal

Remove the two fibres in order to allow for mounting of the second hand-piece

Make sure that the two fibres and their rivets are assembled correctly

Hold both probe and sensor simultaneously when inserting the rubber sleeve to avoid damaging the two optical fibres on the level of the rivets.

Adjusting the probes

The operational mode of the sensor can be seen at the end of the optical fibre by a light beam (not dangerous), which is emitted when the sensor is in “1” mode and not emitted when the sensor is in “0” mode. The sensor keeps its wavelength in near Infra -Red to ensure power and immunity of the detection function. This also gives an indication of the condition of the optical fibre.

The sensor should be placed about 2 to 5mm above the tape. A sensitivity potentiometer is available to adjust the trigger level for reliable pulse output.

First turn the potentiometer in mid position. Bring the probe closer to the target until the indicator at the head lights up, targeting the white mark. Shift the probe, and repeat this operation in order to detect the triggering limits on the black marks of the target. Set up the probe in an average position (length), review this operation to confirm the accurate detection: the set up is finished.

Automatic gap detection

When applying the black/white tape to the rotating shaft there will be an irregular rasterization at the transition point. This can be used as the zero pulse to indicate a defined start position. On the other hand, this would result in an rpm drop or spike in our rpm measurement.

A software procedure automatically measures the pulses per revolution and also detects the exact gap length to enable robust and high-quality measurement.

The zero pulse must be at least 3 pulses long!

Sensor set-up

Power supply must be perfectly rectified, filtered, and constantly deliver more than 120mA /12V.This is not an “open collector” output sensor, but PNP output. 152 G7 can support reverse tension, this tension modifys signal’s Amplitude. 152 G7 TTL Voltage output is 5 Vcc , 152 G7 Voltage output is nominal voltage input -1.5Vcc. If the sensor is connected to the acquisition system the use of dedicated measurement connectors and matching cables is recommended. Please refrain from extending the cable. Otherwise, the sensor’s operation may be affected. To confirm that the sensor is live, check if a faint red LED glows on the small light channel in front of the sensor optical head; You can also use a digital camera to see the I.R. Light. The brightness of this small red light is independent of the position of the potentiometer.

Sensor plug-in

V rating: 12/24 Vcc

V Minima: 10 Vcc

V Maxima: 30 Vcc

I: 120 mA/12Vcc

Specifications

Lemo connector

Connector type: L1B7f

Physical diagram

Sample rate

We have to detect the frequency drop, so that gap is seen, and software can calculate start and stop of the angle(0 to 360deg.) So in case the sampling rate is lower than input frequency of TACHO probe the gap could be missed.

Lets assume we have about 64 pulses/rev the machine is running with 1000 RPM. 1000rpm/60= 16rps = 16Hz.

Per one second, we would get: 16Hz * 64pulses/rev= 1024Hz input frequency.

In the example below the sampling rate was set to 1kHz, so we could see that the gap was not recognized at every revolution. In this case the sampling rate must be at least 2 times higher. 1024Hz *2 is about 2kHz, because speed of the machine could go up we also have to consider that. We should set it at least to 10kHz.

Sampling rate > Maximum input frequency * 10

For measuring RPMs and angle of rotating machines, we need angle sensors. RPM and angle measurement is important in balancing, order tracking and rotational and torsional vibration.

We need to choose a rpm sensor that is convenient for our measurement. Not all of the sensors can be installed in our rotating system and sometimes it takes a lot of effort to install then. Also, we have to choose the sensor that has good resolution for our purpose (e.g.: sensor with one pulse per revolution is not appropriate for measuring precise angle).

Tape sensor is an optical sensor for measuring speed and angle. It uses black and white tape that is attached to the rotating part of a machine.

The sensor is made of optic fibers and should be placed about 5 mm (or less) above the tape. We have to use a sensitivity potentiometer to adjust the trigger level to such a level which gives us steady pulses. The reflection is then converted with an electronic circuit into a TTL signal. The sensor in connected directly to an LEMO counter input.

Tape sensor can be used in many applications: RPM measurement, angle measurement, order tracking, rotor balancing, rotational and torsional vibration.

Tape sensor setup

First we glue the tape (with black and white stripes) onto our rotating part. If both ends of the tape would come perfectly together we would have no zero pulses per revolution, which are an indication of the start position. If we don't have the information about start position, the angle would be different at every start of a measurement.

In the picture above we can see the transition point of a tape - we use that as the ZERO pulse. This is an indication of a new revolution so the angle will start all the time at this position - angle information related to shaft will be the same.

In the picture below we can see the drop in frequency where we have the zero pulses. The drop is seen nicely so we could use that to detect the ZERO pulse. Angle will always start at that position. For the software to clearly see this drop or peak, the length of the gap must be more than 3 pulses. So the software will have no problem detecting ZERO pulse because the frequency will drop for 70%.

We have to adjust the trigger levels to get reliable pulses from the optical sensor. Trigger level has to be set after the sensor is mounted because it depends on a distance to the tape.

Sample rate must be high enough to detect the frequency drop and that the gap is seen so the software can calculate a start and stop of the angle.

Example: We have 64 pulses per revolution and machine is running at 1000 rpm - 1000rpm/60 = 16 Hz.

Input frequency is: 16 Hz * 64 pulses/revolution = 1024 Hz. If the sample rate would be set to 1 kHz, the gap would not be recognized at every revolution.

Sampling rate must be at least ten times higher than the maximum input frequency.

Defining sensor type

When we do a RPM measurement we have to select Sensor mode in Counter setup in Dewesoft X.

When Sensor mode is selected, we select our sensor from the Counter sensor database, where different types of sensors and their setting are already stored.

If we are using a sensor that is not yet in Counter sensor database we have to define it.

We go to Settings -> Counter sensor editor or just click on to enter Counter sensor editor:

In Counter sensor editor, we add a Tape sensor as sensor type. I renamed it Tape_sensor. When we click Save&Exit the sensor is added to Counter sensor database and is ready to be used.

We created a tape sensor that can now be selected from the dropdown menu in counter channel setup:

For a precise measurement, we have to know how many pulses per revolution we get from tape sensor and how many pulses in the gap wide. We shouldn't count that manually, there is a function called Detect gap - it will automatically measure the pulses per revolution and detect the gap length.

For the gap length calculation the rpm should be as stable as possible. So try to operate the machine in a stable area, so that rotational vibration (rpm deviation) is as small as possible.

The algorithm will average the speed of the machine a few samples before and after the gap, so the average speed around the gap is extracted, and from that we can calculate the missing pulses.

Please be aware that we are in setup, so Dewesoft X is running with the setup sampling rate, and if that is not high enough, like described in 3.4 gap and teeth detection will not work.

Measurement results

Output channels of a tape sensors are angle and frequency channels. Angle runs from 0° to 360°, frequency channel can be seen in RPMs of in Hz.

On recorder we can see angle in range from 0° to 360° (when tape is rotating angle values increases, when ZERO pulse is passed, the angle value returns to 0) and frequency channel in rpm. The rpm channel (green curve) is not a straight line because our rotor was not balanced. So we can use the tape sensor for balancing rotary parts.

The overall error of the measurement has to be split up into errors from the sensor and the counter measurement uncertainty. Usually, the sensor errors make the major amount.

Counter accuracy

Counter architecture

To understand how the angle resolution is determined, it is at first important to understand the internal architecture of the Dewesoft Counters. A combination of main and sub counter is used internally for getting higher precision at the frequency measurement. The main counter is running on event counting (or encoder mode). The sub counter is used for time measurement, it measures exactly the time of the input event with a resolution of 9,77 nsec (= 1/102,4 MHz) relative to the sample clock. At every rising edge on the Counter Source, the counter value of the sub counter is stored in a register. At every Sample Clock, the values of both counters are read out.

With these, both measurement results not only the frequency can be calculated in a precise way. Also, the event counter result can be shown in fractions because the exact time when the event occurs at the input is known. The event counting result is recalculated with interpolation to the sample point like shown in the diagram below.

Here the improvement of the measurement result is shown. While a standard counter input shows the value up to one sample delayed, the counter input of the Dewesoft instrument calculates the exact counter result at the sample point.

Angle resolution

The counter result is read out with the sample rate, therefore the same update rate applies for the calculated angle.

Furthermore, the angle resolution depends on the rotation speed (RPM).

Below there are two angle-based 2D graphs showing the Sensor angle on the x-axis at the same RPM. The option “draw sample points” was enabled. On the left side, the sample rate was set to 500 Hz, on the right to 2500 Hz:

Since rotational and torsional calculations are all based on the sample rate, the angle resolution is the same.

Any digital frequency measurement is based on period time measurement. The time between two edges of the input signal is “sampled” with the counter timebase of 102.4Mhz. With this simple measurement method the accuracy of the measured frequency is given by ratio between the input signal frequency and the counter timebase frequency:

We can see, the error increases with the input frequency. For example at 10MHz the accuracy goes down to 10%!

Like explained above, the advanced counter structure of Dewesoft are using two counters internal counters and the output rate is synchronous with the acquisition rate. With this technology, we can limit the maximum error to the used acquisition rate.

The illustration below shows the accuracy at different input signals between 2 kS/sec to 1000 kS/sec taking also the typical counter time base accuracy of 5 ppm in an account.

How does it work?

Connect the DS-TACHO1 with the LEMO 7pin to a DEWE-43 or a SIRIUS Counter input, and on the DSUB 9pin side to your analog tacho probe signal (e.g. magnetic pick up sensor with screw, 1 pulse per revolution).

Start the rotating machine, then use a screwdriver to manually adjust the trigger level on the DS-TACHO1, see picture below.

When the trigger is detected correctly, the blue LED will flash. Vary the RPM on the machine to check if the trigger level is ok for the whole RPM range.

The lowest detectable frequency for the counter input on the DEWE-43 / SIRIUS is 5 Hz, therefore if you have 1 pulse / revolution, the lowest RPM is 300. If you need to measure lower RPM, you could increase the number of pulses per revolution (e.g. for inductive probe mount a screw every 90° on the rotating disk and then divide a result by 4).

In this example, you see the input signal of a magnetic tacho probe (coil), when a screw on the disk is passing by. The higher the RPM, the higher the induced voltage is, so here you have to set the trigger level low (shown in the picture ± 10 mV).

The upper (red) line is the trigger level, the lower (orange) line is the retrigger level. The signal has to fall below the lower line to be armed for the next trigger again. This even makes it possible to correctly detect a bad signal as shown above!

This website uses cookies to ensure you get the best experience on our website.
Learn more