Redundant and Flexible Pseudorandom Optical Rotary Encoder

1 Abstract —Optical encoders are mainly used in modern motion servo systems for high-resolution and reliable position and velocity feedback. Pseudorandom optical rotary encoders are single-track and use a serial pseudorandom binary code to measure absolute position. The realization and analysis of such a rotary encoder with advanced code scanning and error detection techniques, as well as an improved redundancy in operation, are presented. A presented serial code reading solution uses two phase-shifted code tracks and two optical encoder modules. So, the realized encoder, hybrid in nature, provides “output on demand” and more or less reliable position information using very efficient error checking. Compared to a standard absolute encoder, this encoder requires a smaller code disc, facilitates installation, has greater flexibility in operation, and is less sensitive to external influences.


I. INTRODUCTION
Optical rotary position encoders as widespread optoelectro-mechanical sensors enable the measurement of angular position in various industrial movable systems, such as robotic arms, elevators, telescopes, and others [1]- [5]. While conventional absolute encoders determine position from multiple parallel code tracks, a pseudorandom encoder uses only one code track [5]- [8]. A window, n bits wide, that slides along the pseudorandom binary sequence (PRBS) code track of n-bit resolution extracts a unique code word providing position information [9]. Serial reading of pseudorandom code is possible since n -1 bits of two adjacent code words are the same, which is an advantage over standard absolute encoders, where n code reading heads are required. There is no accumulation of errors that occur in the case of an incremental encoder use with pseudorandom absolute encoder. Different methods [10] for detecting code reading errors can be applied to pseudorandom absolute encoders to increase their reliability. Easier mounting on the motor shaft and determining the zero position are the advantages of pseudorandom encoders also [11]. The disadvantages of these encoders are the need for initial movement during each encoder start-up in order to Manuscript received 11 March, 2020; accepted 14 October, 2020. This work has been supported by the Ministry of Education, Science and Technological Development of the Republic of Serbia.
form the first valid code word, as well as the need for timeconsuming pseudorandom/natural code conversion.
The pseudorandom absolute position encoder code disc contains one synchronization and one pseudorandom code track. A synchronization track is needed to define the moment of the pseudorandom code reading, and also to determine the direction of rotation [12], [13]. Additionally, the synchronization track can be used for the angular velocity measurement [14] and for the encoder resolution increase. Code reading synchronization can also be achieved using internal synchronization method [12] or by additional coding of pseudorandom bits [13]. One or two code reading heads can be used for pseudorandom code scanning [6], [15], [16], as well as for parallel reading with photodetector array [17]. In the pseudorandom encoder, the read code word needs conversion to a natural code, which is done using different types of converters [7], [18], [19]. Parallel conversion methods are the fastest [7]. However, they demand large memory size. Serial conversion is simpler, but with the longest conversion time that depends on the encoder resolution [18]. Serial-parallel conversion is a compromise solution that combines the simplicity of serial conversion and the speed of parallel conversion of a limited number of defined code words [12].
The accuracy and reliability of positioning with a pseudorandom encoder are affected by many sources of errors [20], [21]: quantization error, mechanical errors (eccentricity, centering the code reading heads), disc manufacturing errors (ellipticity, inaccurately printed code slits), different environmental influences (temperature, vibration, dust contamination, humidity, shocks, etc.), etc. Therefore, the goal of the paper is to present an encoder that is more resistant to these influences and better suits highly reliable applications, e.g., in the automotive industry, space, aviation, and military equipment. Since the pseudorandom encoder contains a synchronization track, all developed methods for estimating and correcting errors in incremental encoders [22] can be applied to this encoder to increase its accuracy and reliability. In the past years, different methods to increase the accuracy of optical incremental and absolute encoders have been proposed, e.g., the accuracy of the absolute encoder is increased by using the empirical decomposition method [23]. The implementation of subdivision procedure using a machine vision technique to achieve robust measurement for a single-track absolute encoder is presented in [24]. The encoder reliability assessment is considered in reference [25], where a multiple-degradation model of the encoder is developed. An encoder capable of operating in industrial environment with shocks and vibrations was developed in [26].
Different variants of serial scanning of pseudorandom code are explained in the first section of the paper. Then, an improved two-head solution for pseudorandom code reading with two phase-shifted code tracks is presented. The additional head and code track in the proposed encoder have been used extensively to increase the reliability and flexibility of the encoder, which could not be feasible with the solutions presented in the references [6], [7], and [12]. Additionally, for the realization of this encoder, existing optical modules made for incremental encoders can be used, which reduce the development costs of the encoder. Presented pseudorandom rotary encoder uses four signals from code reading heads to perform absolute position measurement within the implemented operation algorithm. Different operation modes of the encoder are implemented to increase its reliability and flexibility, wherein the encoder becomes one intelligent measuring transducer.

II. SCANNING OF PSEUDORANDOM CODE
The scanning of pseudorandom code can be implemented as a serial one-head solution, or even better, two-head solution, which was not possible with classical absolute encoders. The primary solution with one code reading head forms the code words in the reading buffer. During encoder initialization, some movement is required whereby n bits of the PRBS code need to be read to create the first valid code word [6]. Each subsequent code word is formed from the previously read n -1 bits plus one new read bit of pseudorandom code (Fig. 1). An important disadvantage of scanning with one code reading head is the loss of position information at the moment of changing the direction of rotation. The rotational direction (CCW/CW) and the timing of the pseudorandom code scanning are determined using two reading heads, AUT and VER, at a distance of q/2 with the synchronization track. The control logic also determines the LOAD pulse, which is used to load the next read bit from code reading head x(n) into the reading buffer, bidirectional shift register. Next, the formed code word in the buffer must be converted from a pseudorandom to a natural code.
Overcoming the shortcomings of the previous solution was achieved by introducing an additional code reading head at a distance of nq [16], where q is the quantization step of code track (Fig. 2). For the clockwise direction of rotation (CW), bits from the head x(n) are used to fill the shift register, and when the rotation is counter-clockwise (CCW), the code reading head x(0) is used. This solution gives continuity in the formation of code words, even when the direction of rotation is changing. At the same moment, when the code reading head x(n) reads bit S(p), code reading head x(0) reads the bit S(p + n). The disadvantage of this solution is its complex practical realization since the code reading heads are at a very short distance, which is determined by the encoder resolution and disc diameter and is affected by vibration and temperature. The pseudorandom code scanning method used in this paper is based on the use of a two-head scanning solution of two independent code tracks carrying the same PRBS code, but phase-shifted for 2 n-1 + n -1 bits (Fig. 3). Two sensor heads are arranged on a straight line that passes through the center of the disc. One code reading head reads pseudorandom bit S(p) from the first code track, and the other code reading head reads the bit S'(p + n) from the shifted code track. Compared to the previous solution [16], the sensor heads are now scanning two code tracks, and they are in a better position for mounting and centering. This approach allows more reliable encoder operation and easier practical implementation.
Like in the previous solution [16], there is a continuity in the formation of the code words, which is crucial in the moments when the direction of rotation is changing. The code reading error checking method [10] designed for previous solution [16] is now applied to the presented solution. However, code reading error checking is now more reliable, because it is done with the main and control code words, which are obtained using two separate code tracks  Fig. 4. The code disc with a diameter of 45 mm has a 11-bit synchronization track (2048 slits), a 10-bit pseudorandom code track (1024 slits), and an additional 10bit pseudorandom code track that is phase-shifted.
Two pseudorandom code tracks contain a 10-bit pseudorandom binary code obtained by linear feedback shift register (LFSR) with feedback set [10,3] for maximum length sequence. The proposed solution facilitates the implementation of the code reading method since an incremental encoder module, already present in the market, is used. So, the width of the tracks on the disc is customized for the reader, i.e., an optical encoder module M832-1024-6T-U manufactured by Dynapar. The encoder module must be selected for the appropriate incremental track resolution. Each pseudorandom code track has its inverted version next to it due to differential scanning (Fig. 4). Two optical encoder modules were used for scanning of the code disc. One encoder module is used to read the synchronization track (signals A and B) and the first pseudorandom code track (PRBS1), while the other is used to read the shifted pseudorandom code track (PRBS2) (Fig.  5). The index sensor head of the applied encoder module was used to read the pseudorandom code track. One encoder module is positioned closer to the center of the disc so that the index sensor head reads a second pseudorandom track closer to the center of the disc. The encoder modules are positioned against each other in relation to the center of the disc (Fig. 4). Since the rising edge of the signal A in the CW direction is exactly in the middle of the PRBS bit, it is used to define the moment when the PRBS code is read, and in the CCW direction, the falling edge of the same signal can be used. Signals A and B were also used to determine the rotational direction. The signals from two encoder modules, two signals from the synchronization track and two signals from pseudorandom code tracks, were brought to the digital inputs of the USB acquisition card NI USB-6341 from the X series. A virtual instrument for implementing the operation of the presented pseudorandom position encoder is realized, where the flexibility of programming in the LabVIEW environment is maximally exploited when testing different variants of the working algorithms.

IV. OPERATION ALGORITHM AND DISCUSSION
According to the simplified operation algorithm of the encoder (Fig. 6), after the initialization of the system, it switches to the formation of the first accurate code word and the determination of the absolute position after that. For the initial code word, which is a reference for absolute position determination and which is defined during process of encoder mounting on the motor shaft, the code word "1000000000" is selected. The initial code word is the same for both code tracks. After initialization and formation of the first code word, the reading of a next bit from the corresponding code track depending on the direction of rotation follows. The accuracy of the read bit is checked and based on it, the further operation of the encoder is determined. If there was no error in code reading, the encoder continues to operate in a 10-bit or a 12-bit mode depending on the user's choice. In the 10-bit mode, the absolute position is determined after the pseudorandom/natural code conversion of a pseudorandom code word. In the hybrid 12-bit mode, two additional bits were obtained using quadrature signals from the synchronization track. The increase of the overall resolution for two bits is achieved by performing the incremental positioning between two absolute positions. For both 10-bit and 12-bit operation modes, it is necessary to form the main code word to determine the position and the control code word to detect a code reading error. In addition, the presented encoder can provide two independent position information based on read code words using two separate phase-shifted pseudorandom code tracks.
The front panel of the realized virtual instrument (Fig. 7) offers a user to monitor position information, the direction of rotation, operation mode (10-bit, 12-bit, reduced reliability, incremental), and to observe input signals. Also, it can track the read bits from pseudorandom code tracks and the zero position. Additionally, the encoder resolution, samples and sampling rate per channel can be changed. Figure 7 shows the position determination in the 10-bit mode with the position in the range from 0 to 1023. However, the user can choose the 12-bit mode of encoder operation when positions are in the range from 0 to 4095 (Fig. 8). In this mode, the position accuracy is more influenced by the accuracy of the synchronization track reading.  Code words from two phase-shifted pseudorandom binary sequences are used for checking the code reading accuracy according to the method presented in [10]. At the same time, as the main code word is formed by one code reading head, the other head forms the control code word (Fig. 9).
An additional mechanism (less reliable, but useful) has been added for checking the read bits for both code tracks.
It is based on the predictive bit generation that is next read from the code track. To generate the next bit, it is necessary to know the previous code word and the direction of rotation, and then by applying a direct or inverse law of generation, the next bit is obtained. This checking mechanism enables locating the code track from which the bit is incorrectly read.  If the bit reading error occurred in a single code track due to, e.g., the failure of one encoder module or due to the contamination of one code track, the encoder can continue to operate in a mode of reduced reliability with a single code track. For encoder without protection against code reading errors, if one incorrectly read bit from the PRBS code track appears, it would get the values of the position as in Fig. 10, where ten consecutive incorrect position measurements can be spotted. However, as long as the error is detected, the encoder can continue to work in a mode of reduced reliability, whereby we would not have incorrectly registered position information. In reduced reliability mode, the encoder can also work with 10-bit or 12-bit resolution, depending on the user's choice. The previous sentences explain the most significant contribution of this paper that the encoder erroneously reading the code bit under various external influences does not give the wrong position information at the output, but switches to another mode with the possibility of returning to the normal mode of maximum reliability. In the case where the errors of the read bits have occurred in both code tracks, the encoder can continue to work in the incremental mode. In this mode, the position value is obtained by incrementing or decrementing the current position value depending on the direction of rotation using the edges of signals A and B from the synchronization track.
The algorithm was tested with real signals from the encoder disc, with a deliberate change of rotational direction to monitor the continuity of position information. To perform a complete test of the operation algorithm, a virtual instrument is used to simulate additional test conditions. Errors were intentionally inserted in the read bits from pseudorandom code track of the encoder to monitor the behavior of the algorithm. As a code reading error can occur due to some immediate external influence, such as vibration or shock, a testing procedure can be introduced whether the error occurs again in the same place in the subsequent reading of these same bits. This procedure would allow the encoder to quickly return to normal operation mode in the case of a one-time error. An additional advantage of this encoder is that it can also provide "output on-demand" for the end-user: 10-bit absolute position, 12-bit hybrid position, incremental position, and two-position information with two independent code tracks.
The proposed multi-mode encoder solution is flexible, and above all a more reliable encoder solution compared to other encoders available in the market and described in references [1], [2], [6], and [7]. This is because the encoders presented in these references do not have any method for code reading error checking and do not have added redundancy in operation through additional code reading head and code track.   [22] Identification and correction of systematic encoder errors.
Signals from reading heads go to two-stage amplifier circuit before 14-bit analog to digital converter.
Identification of amplitude and offset errors on the line signals.
Method has low stability, and the phase-shift between signals is not considered. [23] Improvement of measurement accuracy of the absolute optical encoder.
Parallel reading of one pseudorandom code track with image sensor.
Error compensation method, which extracts the underlying trend of the measurement error.
Need long time for error compensation. [24] Achieve high-precision and robust measurement for single-track absolute encoder.
Parallel reading with machine vision techniques.
Improved algorithm for reduction of fault errors from signal.
Complex algorithm causes a low calculation speed.
Serial reading with LED and photodetector.
Prediction of encoder's accuracy degradation.
Prediction results are slightly overestimated due to some overlooked errors. [26] Develop absolute encoder using optically modulated binary code.
Single photo-detector senses the coding information from the long range distance.
Good encoder's design can withstand the effect of shock and vibration.
Low angular speed and resolution.

Proposed encoder
Increase reliability and flexibility of absolute encoder.
Serial reading with available optical modules. Two phase-shifted code tracks.
Reliable error detection. Multiple-mode operation.
Complex algorithm, the need for initial movement.
Also, compared to standard absolute encoders, the proposed encoder requires a smaller code disc, because it has significantly fewer code tracks, as well as fewer sensors for code reading. The applied code reading solution, in comparison with [16], enables the use of available optical modules and their easier installation. Using the principle of optical modulation, an encoder has been developed that is more resistant to shock and vibration [26], but works with lower resolutions. Developed encoder has been compared with the prior art in terms of their performance and features, as shown in Table I. The proposed encoder was created in response to the industry's need for a flexible solution that can be applied in high-reliability applications.

V. CONCLUSIONS
The proposed optical absolute encoder is the flexible solution and less sensitive to various external influences that can lead to incorrect position information. External influences cause the erroneous reading of code bits. However, the proposed encoder can detect error and apply its efficient algorithm to continue working in one of its modes, with the possibility of returning to the previous mode if it was a one-time error. The presented encoder has an "output on-demand" possibility, which is important for today's industrial needs. So, the proposed encoder can have maximal 12-bit resolution and reliability at the output, reduced reliability if one code track is used, operate in the incremental mode, and if necessary, give two-position information with two code reading heads and two code tracks. The analysis of the encoder operation algorithm was done using signals from the realized encoder, as well as using simulated test conditions, where it is easier to insert intentional errors and monitor the encoder operation. Arrangement of the synchronization and code tracks, and also of code reading heads, provides reliable code reading and checking of code reading errors. Experimental results verify the validity of the implemented solutions and operation modes of the proposed encoder. The disadvantages of the presented encoder are the need for initial movement during its start-up, more complicated reading of pseudo-random code in relation to other codes, more complex operation algorithm due to embedded error checking procedures and multiple operating modes, and time-consuming conversion of pseudorandom code into natural code.

CONFLICTS OF INTEREST
The authors declare that they have no conflicts of interest.