To download NI software, including the products shown below, visit ni.com/downloads.
Measuring speed using a tachometer in an industrial application is important for control algorithms and for use with condition monitoring applications where machine health issues can be directly correlated to speed. The CompactRIO platform offers the ability to acquire tachometer signals and convert them into rotational speed using the LabVIEW FPGA Module.
The example code attached to this document uses a cRIO-9068 with an NI 9232 C Series module to acquire a tachometer signal.
Description-Separate-2
Tachometers are widely used in industrial applications to measure the angular speed of rotating machinery. In most industrial settings, a quadrature encoder is not feasible to integrate into a large industrial application because of size constraints. A tachometer is a suitable alternative because it is relatively inexpensive and can be easily mounted, enabling the determination of rotational speed for either control algorithms or preventative maintenance monitoring. There are three types of commonly used tachometers.
Proximity probes are contact-free transducers that measure electric currents induced by a changing magnetic field as metal moves past the sensor. The magnitude of this magnetic field is directly correlated to the distance from the sensor, which allows for a time-varying voltage based on shaft location. If a keyway slot is added to the shaft, the output of the proximity probe is a pulse per keyway slot, enabling the calculation of speed. If a proximity probe is used with gears rather than a keyhole, the sensor outputs a pulse for each tooth of the gear.
An optical sensor is a contact-free probe that emits visible light and can detect the reflected light from a rotating shaft. Reflective tape is often attached to the shaft to return the light generated by the sensor and thus generate a pulse when it moves in front of the sensor.
The output of a Hall effect sensor varies based on the presence of a magnetic field. Hall effect sensors are commonly provided in a digital configuration where an on is output when an object is present and an off otherwise. When Hall effect sensors are combined with a shaft keyway or gear, they can generate a signal convenient for speed measurements.
See more information on sensors used for speed measurements.
Most tachometer sensors output an AC voltage whose frequency is directly proportional to the speed of the rotating machinery. Measuring the period between the rising edges of the waveform can allow for the calculation of rotational speed.
For example, consider a tachometer that outputs two pulses per revolution as shown in Figure 1.
Figure 1. The tachometer's waveform output is two pulses per revolution
By measuring the time between rising edges, the rotational speed can be calculated using the the following formula.
Equation 1. Calculating the Revolutions per Minute
Because many tachometers output a unique signal, custom signal conditioning hardware is often necessary to filter the waveform into a clean square wave for acquisition at high speeds. To eliminate the signal conditioning hardware, industrial tachometers can be connected directly to a CompactRIO system that can acquire and process the data at a hardware level using LabVIEW FPGA.
The NI 9230 and NI 9232 are C Series modules that can be used to measure tachometer signals. Both feature three simultaneously sampled channels, 24-bit delta-sigma analog-to-digital converters (ADCs) with ±30 V input range. The NI 9230 has a maximum sampling rate of 12.8 kS/s/ch while the NI 9232 can achieve a maximum sampling rate of 102.4 kS/s/ch. Tachometers can be connected directly to the C Series modules, which eliminates the need for external signal conditioning as it can be implemented in the LabVIEW FPGA code and, therefore, reduces the number of components and overall cost of the system.
To calculate the rotational speed from the tachometer signal, the application must be divided into two segments. A LabVIEW FPGA application must sample the tachometer signal to calculate the time period between successive rising edges while the LabVIEW Real-Time application must convert the period to a floating point revolutions per minute (rpm) value.
The example code that demonstrates this application uses a cRIO-9068 with an NI 9232 C Series module to acquire the tachometer signal.
LabVIEW FPGA must be used to perform the high-speed acquisition needed to acquire the tachometer signal. After the signal is acquired, it is processed point by point to detect its edge using a threshold. Choosing an appropriate threshold is dependent on the specifications of the tachometer sensor used. Figure 2 shows the acquisition of the tachometer signal and the processing.
Figure 2. The top-level FPGA code acquires the tachometer and processes it to calculate the period.
When the threshold is exceeded, a time value representing microseconds is stored in a shift register to allow for the calculation of the period of the signal. When another edge is detected, the time between the two consecutive pulses is calculated and the shift register is restarted as shown in Figure 3.
Figure 3. The period of the tachometer signal is calculated between two pulses.
A hysteresis is also incorporated to ensure the timer is not triggered by the threshold crossings of the signal because of noise. As shown in Figure 4, the algorithm may erroneously consider the noise as exceeding the threshold; instead, the algorithm needs the signal to cross a hysteresis level before it resumes looking for the threshold crossing.
Figure 4. If a hysteresis is not used, the algorithm my erroneously detect noise as a valid signal.
Initially, the code first checks if the tachometer signal has crossed the specified threshold in the appropriate direction as shown in Figure 5.
Figure 5. The code checks if the tachometer has exceeded the threshold in the specified direction.
When the tachometer signal has exceeded the threshold, an event is marked as occurred in order to store the time value and the code begins to check the hysteresis level. If the slope is specified as rising, the tachometer signal must fall below the specified hysteresis level (shown in Figure 6). If the slope is specified as falling, the tachometer signal must exceed the specified hysteresis level. When the hysteresis level has been met, the code resumes monitoring the threshold level to trigger an event.
Figure 6. The tachometer signal must fall below the hysteresis level before the threshold is checked again.
The Real-Time VI runs on the controller and reads the tachometer period from the FPGA. Calculations for converting the period to rpm are performed in Scale.vi.
Figure 7. The Real-time VI reads the tachometer period from the FPGA and calculates the rpm.
To calculate the rpm, the period from the FPGA must be converted to a frequency and Equation 1 applied. Because the FPGA code is configured to provide the period in terms of microseconds, the period is converted to seconds prior to the frequency being calculated. The frequency is then divided by the number of pulses per revolution to obtain the number of rotations per second. Multiplying this by 60 provides the rpm.
Figure 8. Use Equation 1 to convert the period into rpm.
How-Separate-2
Related-Separate-2
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.