An incremental encoder is a linear or rotary electromechanical device that has two output signals, A and B, which issue pulses when the device is moved.Together, the A and B signals indicate both the occurrence of and direction of movement. Many incremental encoders have an additional output signal, typically designated index or Z, which indicates the encoder is located at a particular reference position. Also, some encoders provide a status output (typically designated alarm) that indicates internal fault conditions such as a bearing failure or sensor malfunction.
An incremental encoder does not indicate absolute position; it only reports changes in positionand, for each reported position change, the direction of movement. Consequently, to determine absolute position at any particular moment, it is necessary to send the encoder signals to an incremental encoder interface , which in turn will "track" and report the encoder's absolute position.
Incremental encoders report position changes without being prompted to do so, and they convey this information at data rates which are orders of magnitude faster than those of most types of absolute encoders. The resulting, very low latency of an incremental encoder allows it to be used to monitor the position of a high speed mechanism in near real-time. Because of this, incremental encoders are commonly used in applications that require precise measurement and control of position and velocity.
An incremental encoder employs a quadrature encoder to generate its A and B output signals. The pulses emitted from the A and B outputs are quadrature-encoded, meaning that when the incremental encoder is moving at a constant velocity, the duty cycle of each pulse is 50% (i.e., the waveform is a square wave) and there is a 90 degree phase difference between A and B.
At any particular time, the phase difference between the A and B signals will be positive or negative depending on the encoder's direction of movement. In the case of a rotary encoder, the phase difference is +90° for clockwise rotation and −90° for counter-clockwise rotation, or vice versa, depending on the device design.
The frequency of the pulses on the A or B output is directly proportional to the encoder's velocity (rate of position change); higher frequencies indicate rapid movement, whereas lower frequencies indicate slower speeds.Static, unchanging signals are output on A and B when the encoder is motionless. In the case of a rotary encoder, the frequency indicates the speed of the encoder's shaft rotation, and in linear encoders the frequency indicates the speed of linear traversal.
The resolution of an incremental encoder is a measure of the precision of the position information it produces. Encoder resolution is typically specified in terms of the number of A (or B) pulses per unit displacement or, equivalently, the number of A (or B) square wave cycles per unit displacement. In the case of rotary encoders, resolution is specified as the number of pulses per revolution (PPR) or cycles per revolution (CPR),whereas linear encoder resolution is typically specified as the number of pulses issued for a particular linear traversal distance (e.g., 1000 pulses per mm).
This is in contrast to the measurement resolution of the encoder, which is the smallest position change that the encoder can detect. Every signal edge on A or B indicates a detected position change. Since each square-wave cycle on A (or B) encompasses four signal edges (rising A, rising B, falling A and falling B), the encoder's measurement resolution equals one-fourth of the position change represented by a full A or B output cycle. For example, a 1000 pulse-per-mm linear encoder has a per-cycle measurement resolution of 1 mm / 1000 cycles = 1 μm, so this encoder's resolution is 1 μm / 4 = 250 nm.
Incremental encoders employ various types of electronic circuits to drive (transmit) their output signals, and manufacturers often have the ability to build a particular encoder model with any of several driver types. Commonly available driver types include open collector, mechanical, push-pull and differential RS-422.
Open collector drivers operate over a wide range of signal voltages and often can sink significant output current, making them useful for directly driving current loops, opto-isolators and fiber optic transmitters.
An open-collector output must be connected to a positive DC voltage through a pull-up resistor. Some encoders provide an internal resistor for this purpose; others do not and thus require an external pull-up resistor. In the latter case, the resistor typically is located near the encoder interface to improve noise immunity.
The encoder's high-level logic signal voltage is determined by the voltage applied to the pull-up resistor, whereas the low-level output current is determined by both the signal voltage and load resistance (including pull-up resistor). The load resistance and circuit capacitance act together to form a low-pass filter, which stretches (increases) the signal's rise time and thus limits its maximum frequency. For this reason, open collector drivers typically are not used when the encoder will output high frequencies.
Mechanical (or contact)incremental encoders use sliding electrical contacts to directly generate the A and B output signals. Typically, the contacts are electrically connected to signal ground so that the outputs will be "driven" low when the contacts are closed, effectively making them mechanical equivalents of open collector drivers and therefore subject to the same signal conditioning requirements (i.e. external pull-up resistor).
The maximum output frequency is limited by the same factors that affect open-collector outputs, and further limited by contact bounce – which must be filtered by the encoder interface – and by the operating speed of the mechanical contacts, thus making these devices impractical for high frequency operation. Furthermore, the contacts experience mechanical wear under normal operation, which limits the life of these devices. On the other hand, mechanical encoders are relatively inexpensive because they have no internal, active electronics. Taken together, these attributes make mechanical encoders a good fit for low duty, low frequency applications. For example, PCB- and panel-mounted rotary mechanical incremental encoders are commonly used as hand-operated controls in electronic equipment.
Push-pull outputs (e.g., TTL) typically are used for direct interface to logic circuitry. These are well-suited to applications in which the encoder and interface are located near each other (e.g., interconnected via printed circuit conductors or short, shielded cable runs) and powered from a common power supply, thus avoiding exposure to electric fields, ground loops and transmission line effects that might corrupt the signals and thereby disrupt position tracking, or worse, damage the encoder interface.
Differential RS-422 signaling is typically preferred when the encoder will output high frequencies or be located far away from the encoder interface,or when the encoder signals may be subjected to electric fields or common-mode voltages, or when the interface must detect connectivity problems between encoder and interface. Examples of this include CMMs and CNC machinery, industrial robotics, factory automation, and motion platforms used in aircraft and spacecraft simulators.
When RS-422 outputs are employed, the encoder provides a differential conductor pair for every logic output; for example, "A" and "/A" are commonly-used designations for the active-high and active-low differential pair comprising the encoder's A logic output. Consequently, the encoder interface must provide RS-422 line receivers to convert the incoming RS-422 pairs to single-ended logic.
Unlike absolute encoders, an incremental encoder does not keep track of, nor do its outputs indicate the current encoder position; it only reports incremental changes in position.Consequently, to determine the encoder's position at any particular moment, it is necessary to provide external electronics which will "track" the position. This external circuitry, which is known as an incremental encoder interface, tracks position by counting incremental position changes.
As it receives each report of incremental position change (indicated by a transition of the A or B signal), an encoder interface will take into account the phase relationship between A and B and, depending on the sign of the phase angle, count up or down. The cumulative "counts" value indicates the distance traveled since tracking began. This mechanism ensures accurate position tracking in bidirectional applications and, in unidirectional applications, prevents false counts that would otherwise result from vibration or mechanical dithering near an AB code transition.
Often the encoder counts must be expressed in units such as meters, miles or revolutions. In such cases, the counts must be multiplied by an appropriate constant to convert it to the desired units. For example, in the case of a linear incremental encoder that produces 8000 counts per millimeter of travel, the counts would be multiplied by 1/8000 to convert it to millimeters. Typically this multiplication is performed by a computer which is connected to, and can read counts from, the incremental encoder interface.
In order for an encoder interface to track and report absolute position, the encoder counts must be correlated to a reference position in the mechanical system to which the encoder is attached. This is commonly done by homing the system, which consists of moving the mechanical system (and encoder) until it aligns with a reference position, and then jamming the associated absolute position counts into the encoder interface's counter. Another common method is jam a reference value into the counter upon receiving a pulse from the encoder's "index" output, if available.
Some incremental encoder applications lack reference position detectors and therefore must implement homing by other means. For example a computer, when using a mouse or trackball pointing device, typically will home the device by assuming a central, initial screen position, and jamming the corresponding counts into the X and Y position counters.
Incremental encoders are commonly used to measure the speed of mechanical systems. This may be done for monitoring purposes or to provide feedback for motion control, or both.Widespread applications of this include speed control of radar antenna rotation and material conveyors, and motion control in robotics, CMM and CNC machines.
Incremental encoder interfaces are primarily concerned with tracking mechanical displacement and usually do not directly measure speed. Consequently, speed must be indirectly measured, either by timing the A or B pulse width (or cycle time) or by counting pulses. from the interface at time and then, at some later time reads the counts again to obtain . The average speed during the interval to is then calculated:In the latter case, the pulses are typically counted by the interface and speed is calculated by a computer which has read access to the interface. To do this, the computer reads the position counts
The resulting speed value is expressed as counts per unit time (e.g., counts per second). In practice, however, it is often necessary to express the speed in standardized units such as meters per second, revolutions per minute (RPM), or miles per hour (MPH). In such cases, the software will take into account the relationship between counts and desired distance units, as well as the ratio of the sampling period to desired time units. For example, in the case of a rotary incremental encoder that produces 4096 counts per revolution, which is being read once per second, the software would compute RPM as follows:
When measuring speed this way, the measurement resolution is proportional to both the encoder resolution and the sampling period (the elapsed time between the two samples); measurement resolution will become higher as the sampling period increases.
An incremental encoder interface is an electronic circuit that receives signals from an incremental encoder, processes the signals to produce absolute position and other information, and makes the resulting information available to external circuitry.
Incremental encoder interfaces are implemented in a variety of ways, including as ASICs, as IP blocks within FPGAs, as dedicated peripheral interfaces in microcontrollers and, when high count rates are not required, as bit banged (software monitored) GPIOs.
Regardless of the implementation, the interface must sample the encoder's A and B output signals frequently enough to detect every AB state change before the next state change occurs. Upon detecting a state change, it will increment or decrement the position counts based on whether A leads or trails B. This is typically done by storing a copy of the previous AB state and, upon state change, using the current and previous AB states to determine movement direction.
Incremental encoder interfaces use various types of electronic circuits to receive encoder-generated signals. These line receivers serve as buffers to protect downstream interface circuitry and, in many cases, also provide signal conditioning functions.
Incremental encoder interfaces typically employ Schmitt trigger inputs to receive signals from encoders that have single-ended (e.g., push-pull, open collector) outputs. This type of line receiver inherently rejects low-level noise (by means of its input hysteresis) and protects downstream circuitry from invalid (and possibly destructive) logic signal levels.
RS-422 line receivers are commonly used to receive signals from encoders that have differential outputs. This type of receiver rejects common-mode noise and converts the incoming differential signals to the single-ended form required by downstream logic circuits.
In mission-critical systems, an encoder interface may be required to detect loss of input signals due to encoder power loss, signal driver failure, cable fault or cable disconnect. This is usually accomplished by using enhanced RS-422 line receivers which detect the absence of valid input signals and report this condition via a "signal lost" status output. In normal operation, glitches (brief pulses) may appear on the status outputs during input state transitions; typically, the encoder interface will filter the status signals to prevent these glitches from being erroneously interpreted as lost signals. Depending on the interface, subsequent processing may include generating an interrupt request upon detecting signal loss, and sending notification to the application for error logging or failure analysis.
An incremental encoder interface largely consists of sequential logic which is paced by a clock signal. However, the incoming encoder signals are asynchronous with respect to the interface clock because their timing is determined solely by encoder movement. Consequently, the output signals from the A and B (also Z and alarm, if used) line receivers must be synchronized to the interface clock, both to avoid errors due to metastability and to coerce the signals into the clock domain of the quadrature decoder.
Typically this synchronization is performed by independent, single-signal synchronizers such as the two flip-flop synchronizer seen here. At very high clock frequencies, or when a very low error rate is needed, the synchronizers may include additional flip-flops in order to achieve an acceptably low MTBF.
In many cases an encoder interface must filter the synchronized encoder signals before further processing them. This may be required in order to reject low-level noise and brief, large-amplitude noise spikes commonly found in motor applicationsand, in the case of mechanical-type encoders, to debounce A and B to avoid count errors due to mechanical contact bounce.
Hardware-based interfaces often provide programmable filters for the encoder signals, which provide a wide range of filter settings and thus allow them to debounce contacts or suppress transients resulting from noise or slowly slewing signals, as needed. In bit-bang interfaces, A and B typically are connected to GPIOs that are sampled (via polling or edge interrupts) and debounced by software.
Incremental encoder interfaces commonly use a quadrature decoder to convert the A and B signals into the direction and count enable (clock enable) signals needed for controlling a synchronous, bidirectional (up- and down-counting) binary counter.
Typically, a quadrature decoder is implemented as a finite-state machine (FSM) which simultaneously samples the A and B signals and thus produces amalgamate "AB" samples. As each new AB sample is acquired, the FSM will store the previous AB sample for later analysis. The FSM evaluates the differences between the new and previous AB states and generates direction and count enable signals as appropriate for the detected AB state sequence.
|Moved one increment in "forward" direction|
(A leads B)
|Moved one increment in "reverse" direction|
(B leads A)
|No detected movement||00||00||0||X|
|Moved an indeterminate number of increments||00||11||1|
In any two consecutive AB samples, the logic level of A or B may change or both levels may remain unchanged, but in normal operation A and B will never both change. In this regard, each AB sample is effectively a two-bit Gray code.
When only A or B changes state, it is assumed that the encoder has moved one increment of its measurement resolution and, accordingly, the quadrature decoder will assert its count enable output to allow the counts to change. Depending on the encoder's direction of travel (forward or reverse), the decoder will assert or negate its direction output to cause the counts to increment or decrement (or vice versa).
When neither A nor B changes, it is assumed that the encoder has not moved and so the quadrature decoder negates its count enable output, thereby causing the counts to remain unchanged.
If both the A and B logic states change in consecutive AB samples, the quadrature decoder has no way of determining how many increments, or in what direction the encoder has moved. This can happen if the encoder speed is too fast for the decoder to process (i.e., the rate of AB state changes exceeds the quadrature decoder's sampling rate; see Nyquist rate) or if the A or B signal is noisy.
In many encoder applications this is a catastrophic event because the counter no longer provides an accurate indication of encoder position. Consequently, quadrature decoders often will output an additional error signal which is asserted when the A and B states change simultaneously. Due to the severity and time-sensitive nature of this condition, the error signal is often connected to an interrupt request.
A quadrature decoder does not necessarily allow the counts to change for every incremental position change. When a decoder detects an incremental position change (due to a transition of A or B, but not both), it may allow the counts to change or it may inhibit counting, depending on the AB state transition and the decoder's clock multiplier.
The clock multiplier of a quadrature decoder is so named because it results in a count rate which is a multiple of the A or B pulse frequency. Depending on the decoder's design, the clock multiplier may be hardwired into the design or it may be run-time configurable via input signals.
The clock multiplier value may be one, two or four (typically designated "x1", "x2" and "x4", or "1x", "2x" and "4x").In the case of a x4 multiplier, the counts will change for every AB state change, thereby resulting in a count rate equal to four times the A or B frequency. The x2 and x1 multipliers allow the counts to change on some, but not all AB state changes, as shown in the quadrature decoder state table above (note: this table shows one of several possible implementations for x2 and x1 multipliers; other implementations may enable counting at different AB transitions).
From an application's perspective, the fundamental purpose of an incremental encoder interface is to report position information on demand. Depending on the application, this may be as simple as allowing the computer to read the position counter at any time under program control. In more complex systems, the position counter may be sampled and processed by intermediate state machines, which in turn make the samples available to the computer.
An encoder interface typically employs a sample register to facilitate position reporting. In the simple case where the computer demands position information under program control, the interface will sample the position counter (i.e., copy the current position counts to the sample register) and then the computer will read the counts from the sample register. This mechanism results in atomic operation and thus ensures the integrity of the sample data, which might otherwise be at risk (e.g., if the sample's word size exceeds the computer's word size).
In some cases the computer may not be able to programatically (via programmed I/O) acquire position information with adequate timing precision. For example, the computer may be unable to demand samples on a timely periodic schedule (e.g., for speed measurement) due to software timing variability. Also, in some applications it is necessary to demand samples upon the occurrence of external events, and the computer may be unable to do so in a timely manner. At higher encoder speeds and resolutions, position measurement errors can occur even when interrupts are used to demand samples, because the encoder may move between the time the IRQ is signaled and the sample demand is issued by the interrupt handler.
To overcome this limitation, it is common for an incremental encoder interface to implement hardware-triggered sampling, which enables it to sample the position counter at precisely-controlled times as dictated by a trigger input signal.This is important when the position must be sampled at particular times or in response to physical events, and essential in applications such as multi-axis motion control and CMM, in which the position counters of multiple encoder interfaces (one per axis) must be simultaneously sampled.
In many applications the computer must know precisely when each sample was acquired and, if the interface has multiple trigger inputs, which signal triggered the sample acquisition. To satisfy these requirements, the interface typically will include a timestamp and trigger information in every sample.
Sampling triggers are often asynchronous with respect to software execution. Consequently, when the position counter is sampled in response to a trigger signal, the computer must be notified (typically via interrupt) that a sample is available. This allows the software to be event-driven (vs. polled), which facilitates responsive system behavior and eliminates polling overhead.
Consecutive sampling triggers may occur faster than the computer can process the resulting samples. When this happens, the information in the sample register will be overwritten before it can be read by the computer, resulting in data loss. To avoid this problem, some incremental encoder interfaces provide a FIFO buffer for samples.As each sample is acquired, it is stored in the FIFO. When the computer demands a sample, it is allowed to read the oldest sample in the FIFO.
In digital logic and computing, a counter is a device which stores the number of times a particular event or process has occurred, often in relationship to a clock. The most common type is a sequential digital logic circuit with an input line called the clock and multiple output lines. The values on the output lines represent a number in the binary or BCD number system. Each pulse applied to the clock input increments or decrements the number in the counter.
In digital computers, an interrupt is an input signal to the processor indicating an event that needs immediate attention. An interrupt signal alerts the processor and serves as a request for the processor to interrupt the currently executing code, so that the event can be processed in a timely manner. If the request is accepted, the processor responds by suspending its current activities, saving its state, and executing a function called an interrupt handler to deal with the event. This interruption is temporary, and, unless the interrupt indicates a fatal error, the processor resumes normal activities after the interrupt handler finishes.
In electronics, an analog-to-digital converter is a system that converts an analog signal, such as a sound picked up by a microphone or light entering a digital camera, into a digital signal. An ADC may also provide an isolated measurement such as an electronic device that converts an input analog voltage or current to a digital number representing the magnitude of the voltage or current. Typically the digital output is a two's complement binary number that is proportional to the input, but there are other possibilities.
A signal generator is an electronic device that generates repeating or non-repeating electronic signals in either the analog or the digital domain. These generated signals are used as a stimulus for electronic measurements, typically used in designing, testing, troubleshooting, and repairing electronic or electroacoustic devices, though it often has artistic uses as well.
The reflected binary code (RBC), also known just as reflected binary (RB) or Gray code after Frank Gray, is an ordering of the binary numeral system such that two successive values differ in only one bit . The reflected binary code was originally designed to prevent spurious output from electromechanical switches. Today, Gray codes are widely used to facilitate error correction in digital communications such as digital terrestrial television and some cable TV systems.
Pulse width modulation (PWM), or pulse-duration modulation (PDM), is a method of reducing the average power delivered by an electrical signal, by effectively chopping it up into discrete parts. The average value of voltage fed to the load is controlled by turning the switch between supply and load on and off at a fast rate. The longer the switch is on compared to the off periods, the higher the total power supplied to the load. Along with MPPT maximum power point tracking, it is one of the primary methods of reducing the output of solar panels to that which can be utilized by a battery. PWM is particularly suited for running inertial loads such as motors, which are not as easily affected by this discrete switching, because they have inertia to react slow. The PWM switching frequency has to be high enough not to affect the load, which is to say that the resultant waveform perceived by the load must be as smooth as possible.
In electronics, a digital-to-analog converter is a system that converts a digital signal into an analog signal. An analog-to-digital converter (ADC) performs the reverse function.
A tachometer is an instrument measuring the rotation speed of a shaft or disk, as in a motor or other machine. The device usually displays the revolutions per minute (RPM) on a calibrated analogue dial, but digital displays are increasingly common.
PSK31 or "Phase Shift Keying, 31 Baud", also BPSK31 and QPSK31, is a popular computer-sound card-generated radioteletype mode, used primarily by amateur radio operators to conduct real-time keyboard-to-keyboard chat, most often using frequencies in the high frequency amateur radio bands (near-shortwave). PSK31 is distinguished from other digital modes in that it is specifically tuned to have a data rate close to typing speed, and has an extremely narrow bandwidth, allowing many conversations in the same bandwidth as a single voice channel. This narrow bandwidth makes better use the RF energy in a very narrow space thus allowing relatively low-power equipment to communicate globally using the same skywave propagation used by shortwave radio stations.
The Serial Peripheral Interface (SPI) is a synchronous serial communication interface specification used for short-distance communication, primarily in embedded systems. The interface was developed by Motorola in the mid-1980s and has become a de facto standard. Typical applications include Secure Digital cards and liquid crystal displays.
A phase detector or phase comparator is a frequency mixer, analog multiplier or logic circuit that generates a voltage signal which represents the difference in phase between two signal inputs. It is an essential element of the phase-locked loop (PLL).
In electronic instrumentation and signal processing, a time to digital converter is a device for recognizing events and providing a digital representation of the time they occurred. For example, a TDC might output the time of arrival for each incoming pulse. Some applications wish to measure the time interval between two events rather than some notion of an absolute time.
A rotary encoder, also called a shaft encoder, is an electro-mechanical device that converts the angular position or motion of a shaft or axle to analog or digital output signals.
Delta-sigma modulation is a method for encoding analog signals into digital signals as found in an analog-to-digital converter (ADC). It is also used to convert high bit-count, low-frequency digital signals into lower bit-count, higher-frequency digital signals as part of the process to convert digital signals into analog as part of a digital-to-analog converter (DAC).
In a mixed-signal system, a reconstruction filter, sometimes called an anti-imaging filter, is used to construct a smooth analog signal from a digital input, as in the case of a digital to analog converter (DAC) or other sampled data output device.
A linear encoder is a sensor, transducer or readhead paired with a scale that encodes position. The sensor reads the scale in order to convert the encoded position into an analog or digital signal, which can then be decoded into position by a digital readout (DRO) or motion controller.
A ring counter is a type of counter composed of flip-flops connected into a shift register, with the output of the last flip-flop fed to the input of the first, making a "circular" or "ring" structure.
A frequency synthesizer is an electronic circuit that generates a range of frequencies from a single reference frequency. Frequency synthesizers are used in many modern devices such as radio receivers, televisions, mobile telephones, radiotelephones, walkie-talkies, CB radios, cable television converter boxes satellite receivers, and GPS systems. A frequency synthesizer may use the techniques of frequency multiplication, frequency division, direct digital synthesis, frequency mixing, and phase-locked loops to generate its frequencies. The stability and accuracy of the frequency synthesizer's output are related to the stability and accuracy of its reference frequency input. Consequently, synthesizers use stable and accurate reference frequencies, such as those provided by crystal oscillators.
A digital signal is a signal that is being used to represent data as a sequence of discrete values; at any given time it can only take on one of a finite number of values. This contrasts with an analog signal, which represents continuous values; at any given time it represents a real number within a continuous range of values.
While almost every weighing scale uses the same basic principle, industrial weighing scales are designed to do a lot more. They handle heavier loads, often in different conditions, both environmental and physical.