Absolute Two-Tracked Optical Rotary Encoders Based on Vernier Method

Driving synchronous machines requires early and accurate knowledge of the absolute position of the rotor; current solutions based on resolvers, sin–cos, or absolute encoders are complex, bulky, and costly. Hence, in this work two variants of absolute rotary encoder based on the Vernier method are analyzed. One, already discussed in the literature, displays the Vernier scale across the whole circumference (full-Vernier), and the other shows half Vernier traces over the entire perimeter (half-Vernier), which is an original feature. Both the implementations are characterized by only two tracks and as many sensors: the proposed conditioning algorithms provide the absolute angular position as a function of the time delays between the wave edges generated by the two traces, thus being of easy implementation on low-cost microcontroller units (MCUs). The Vernier encoders are also compared with the state-of-the-art absolute and relative solutions, i.e., incremental, binary, and Gray-code encoders. Experimental tests are carried out to assess the accuracy of the proposed sensors. The investigation shows that: 1) the full-Vernier cannot provide, in practice, a reliable estimate of the direction of rotation and of the actual angular sector without resorting to a third sensor; 2) the half-Vernier produces a trusty measurement of the absolute angle and velocity; and 3) can give a reliable position result with less than 30° shaft turn, but it can suffer from marginal performance degradation at low velocities in conjunction with high accelerations. Compared with the Gray encoder, the half-Vernier provides a simpler and more compact hardware for a given resolution, similar to that of an incremental encoder, at the expense of a small accuracy reduction at low speed.


I. INTRODUCTION
M EASURING the angular position and velocity of a rotating component with high resolution in limited space sets new challenges for rotary encoders, especially when the absolute angle is required [1]. This problem is addressed in many ways and by diverse devices (encoders, resolvers, Hall effect sensors) relying on different physical phenomena (optical reflection, magnetic field, image recognition, Hall effect).
Resolvers incorporate such a piece of information in sine and cosine waves generated by the inductive coupling of the stator windings through the rotor. These are well-known for their accuracy, robustness, and reliability, but they are bulky and expensive, due to the need of windings. Hall effect rotary sensors exploit the Hall effect to detect the magnetic field which varies based on the angular rotor displacement. Also, the popularity of Hall effect sensors descends from their robustness and reliability; their major drawback is the limited 60 • angular resolution. A noteworthy resolver configuration, also referred to as inductive angular sensor, is presented in the patent [2]. Its stator is a printed-circuit board (PCB) equipped with printed traces, namely, an exciting coil and multiple receiving coils; the coupling, which is a function of the angular position, is ensured by a rotor exhibiting a peculiar coil pattern to properly direct the induced currents. Alternatively, the same coupling can be attained through a ferromagnetic rotor with a lobed profile by virtue of its eddy currents [3]. The instrument generates a three-phase sinusoidal signal, which conveys the angle information. Another instance of inductive angular sensor is available as a commercial product [4]: in contrast to its counterparts (see [2], [3]), this returns quadrature sine and cosine waves, as ordinary resolvers do. Inductive angular sensors are significantly simpler, cheaper, and more compact than the traditional resolvers, of which they share the same basic working principle (angle-dependent magnetic coupling) and are tolerant with respect to the mounting errors in the same way. In addition, Brajon et al. [5] proposed a design that combines inductive angular sensors with Hall effect instruments to improve the measurement accuracy and achieve the immunity to stray fields and stray metals.
In more recent years, some authors presented novel rotor position detection methods based on machine learning (ML). Dhar et al. [6] proposed a procedure based on artificial neural network (ANN) suitable for the compensation of the systematic error of measurement of low-cost encoders; the authors managed to improve the accuracy by one order of magnitude. Makni and Zine [7] described a sensorless (that is, encoderfree) strategy exploiting ML to infer the rotor position of a permanent-magnet electric motor (IPMSM) from the phase currents. A similar approach was followed by [8] who implemented a sensorless control of an electric motor that exploits an ML-based estimator of the rotor position. [9] presented a position estimator for a synchronous machine (PMSM) using the neural network models to map from the voltage response of an array of linear Hall effect sensors to the electrical angle of the motor. In [10], an angle-tracking observer for a resolver is combined with an ANN to reduce the angle estimate error. Jia et al. [11] used a hybrid algorithm which integrates the Fourier expansion, back-propagation neural,network and genetic algorithm (FE-GABPNN) to compensate the error This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/ of an articulated coordinate measurement machine in the presence of temperature variations. Also, an original optical rotary encoder was proposed in [12], relying on the recognition of an image uniquely identifying the absolute rotor angle; ML techniques were adopted for sector classification and angle regression.
It is clear that ML may offer notable advantages compared with the traditional methods. However, the algorithms based on ML can be too obscure for safety-critical applications because of the lack of a clearly predictable relationship between the inputs and the outputs of the system, especially when the algorithm is forced to operate in a region that exceeds the training domain [13], [14]. This also suggests the importance of collecting meaningful datasets to be exploited during the training stage, which can be very demanding, time-consuming, and costly. Moreover, the computational burden connected to the ML algorithms is generally nonnegligible, and this proves why such an approach has become popular only recently, thanks to the widespread of high-speed computers [6].
In the field of digital transducers, a significant position is covered by incremental and Gray-code encoders, which provide relative and absolute angular position, respectively. The success of the incremental (or "quadrature") encoder derives from the simplicity of its assembly, characterized by only two sensors and one or two tracks (depending on the relative position of the readheads), and of the corresponding software or hardware decoder [15], [16]. This translates to reliable measurements, ease of installation, and fast tuning. The Gray-code encoder shares with the incremental one the simplicity and robustness at the cost of a less compact design to fit the higher number of tracks and sensors for a given resolution [17]. In contrast to resolvers and Hall effect sensors, absolute rotary encoders do not rely on electromagnetic induction; instead, they recover the angle through an array of photosensors by detecting a visual pattern over a disk connected to the rotor.
The Vernier encoder acts as the link between the incremental and Gray-code ones: it inherits most of the geometry and compactness from the former and the absolute measurement capabilities from the latter. Essentially, the Vernier encoders exploit the nonius-Vernier scale, the same used in calibers, to increase significantly the resolution of the measurement while providing absolute angle information. Some adaptations of such an encoder design have already been inspected in a number of works (see [18], [19], [20]), are the subject of some patents (see [21], [22]), and are available as commercial products (see [23]).
Decoding the angle from the Vernier encoders is computationally more expensive compared with the incremental and Gray-code solutions and requires at least three sensors or three tracks. Specifically, the fundamental design described in [18] and [21] is characterized by three tracks. The first one provides a signal with n = 1024 cycles per revolution and the second one gives a signal with n − 1 cycles per revolution: their difference is a signal that encodes the angular position as a linear function of an index i ∈ [0, n]. Theoretically, the third track is unnecessary; in practice, it is introduced so that the difference in its signal with that of the first track is another periodic signal that can be blended with the other difference signal: this strategy allows mitigating the noise. In [19], the Vernier scale is introduced by considering an auxiliary track, in addition to those of an ordinary Graycode encoder, equipped with 2 n t thin slits, where n t denotes the number of conventional tracks. Such a design allows increasing substantially the resolution of the corresponding Gray-code encoder from 360 • /2 n t to 360 • /[2 n t (2 n t − 1)]; the downside is that this design requires 2 n t − 1 more sensors relative to the conventional counterpart.
Significantly, in the Vernier-type encoders the rotational direction may be extracted by means of an ancillary track that generates a quadrature wave relative to that of a base track. Alternatively, the same quadrature signal can be retrieved through an additional sensor mounted with a quarterperiod offset. These techniques are used also in incremental encoders [24]. As a result, the existing Vernier encoders make use of at least three signals to retrieve the absolute angle in conjunction with the rotational direction. A twotrace-only conditioning based on position observers is first proposed in [22].
In this investigation, we address the lack of a minimalist and cost-effective optical rotary encoder, yet with absolute angle decoding capabilities. The objective is having a more compact, more reliable, easier-to-tune, and faster-to-install system. This need comes from the drive world, where early knowledge (i.e., with limited or null motion of the shaft) of the absolute angular position is mandatory for proper motor supply. We solve such a problem by proposing two encoder designs based on the Vernier scale. The assembly simplicity is attained in the sense that the absolute angle information is encoded in just two tracks, and only two optical sensors are needed. This is a major improvement with respect to the Gray-code optical encoder, which is equipped with a greater number of tracks and sensors for a given resolution, requiring many parallel lines or a high-level communication interface [e.g., synchronous serial interface (SSI)]. Indeed, all the existing absolute rotary optical encoders such as Graycode, binary, and barcode [25] make use of more complex conditionings compared with our Vernier instruments, which require only two photodiodes and two Schmitt trigger buffers.
The present work also proposes two original algorithms, the former for the conventional Vernier encoder (also referred to as full-Vernier) and the latter for the novel design (half-Vernier). In contrast to the ML-based procedures, our proposed algorithms rely exclusively on objective features (angular superpositions of the two tracks) exhibiting an intelligible physical interpretation. Table I shows comparison of the ML-based position sensors with the half-Vernier encoder, in terms of accuracy and resources required for conditioning. Metrics for the full-Vernier are not reported, since it cannot give trustable direction information.
The remainder is organized as follows: Section II illustrates the working principle of the two two-tracked Vernier encoders along with the decoding algorithms for direction, velocity, and angle; Section III describes the experimental setup and results, assesses the accuracy of the half-Vernier encoder, and suggests how to reduce the uncertainty; finally, the main findings are summarized in Section IV.

II. TWO-TRACKED VERNIER ENCODERS
A. Working Principle 1) Full-Vernier: The first adaptation of the Vernier encoder is referred to as full-Vernier, and its pattern is displayed in Fig. 1. This consists of two tracks which differ by one in terms of the number of notches (depicted in black), as suggested by the nonius principle. For clarity, the external track has N notches, the internal one N − 1: in the remainder, the former will also be referred to as high-resolution track or S wave, and the latter low-resolution track or A wave. On each track, the notches have the same angular width, which equals also that of the holes (represented as white spaces in the figure), resulting in a duty cycle of 50%: in the presence of a notch, the wave is high, and it is low elsewhere. Such geometrical properties translate to a relative angular shift between the two generated waves that varies seamlessly along the entire circumference, justifying the descriptor full.
The pattern is such that for the counterclockwise direction of rotation, in the range [0 • , 180 • ] ([180 • , 360 • ]), the rising (falling) edges of A trace occur when S trace is high. Conversely, when the direction of rotation is clockwise, the rising (falling) edges of A trace are in the second (first) half. Similar observations can be made when S trace is low. Moreover, it can be noted that the width of the angular sector where both the waves are high is a univocal piecewise linear function of the angular position across the whole circumference. Similarly, the angular sectors where S trace is low and the other trace is high have unique values within a revolution. Such an amount of angular superposition is displayed as a normalized quantity in Fig. 2 for the case N = 8. This quantity is significant because it carries the absolute angular position. It is clear that the angular superposition is linear within each half, and it shows a minimum (or maximum) in the sectors around 180 • .
In addition, the pattern is such that it includes two occurrences of coincident edges, corresponding to the angles 0 • and 180 • . The two instances are uniquely determined regardless of the direction of rotation: the double rising (falling) edge denotes the counterclockwise (clockwise) zero-crossing, Fig. 2. Normalized amount of angular superposition for the full-Vernier encoder, N = 8. Specifically, the "high" curve defines how much A trace is high when S trace is high as well, whereas "low" indicates how much A trace is high when S trace is low. For clarity, "0" denotes null contemporaneity, and "1" indicates full superposition.
whereas the contemporary presence of a rising (falling) edge on S trace and a falling (rising) edge on the other indicates the counterclockwise (clockwise) 180 • -crossing. Theoretically, the double edges can be exploited to receive a univocal feedback on the direction of rotation and absolute position twice per revolution.
Unfortunately, from a practical viewpoint, the inherent manufacturing tolerances may harm the detection of the geometrically univocal features of the full-Vernier encoder in terms of edge sequences. Specifically, the characteristics that this encoder exhibits in the range [0 • , 180 • ] for counterclockwise rotation can be confused with those displayed in [180 • , 360 • ] while rotating clockwise. Moreover, the double-edge detection is not a trivial task, especially when the precision of the mechanical assembly is poor. Overall, the full-Vernier encoder equipped with only two sensors may be prone to miss the actual direction of rotation.
2) Half-Vernier: The half-Vernier encoder is designed to remove the inherent symmetries of the full-Vernier one. This is achieved by arranging the pattern that the full-Vernier displays in the first half throughout the circumference, after which the descriptor half is assigned. As can be observed in Fig. 3, the new encoder is characterized by the same high-resolution trace of its counterpart, whereas the internal track is obtained by spacing N notches (as many as they are on the external one) along the circumference so that two of them collapse in a single one with double width. Hence, the actual number of notches is again N − 1 for A track. Also, by construction, this pattern avoids simultaneous double edges, and the angular superposition as defined in the previous section has a linear trend throughout the circumference as shown in Fig. 4. The characteristic is an unequivocal measure of the absolute angular position and, consequently, of the direction of rotation. The latter can also be retrieved by the conventional technique often adopted for the incremental encoders, consisting in sampling one wave when the edges of the other occur [24]. Specifically, if the rotation is counterclockwise (clockwise),  . Normalized amount of angular superposition for the half-Vernier encoder, N = 8. Specifically, the "high" curve defines how much A trace is high when S trace is high as well, whereas "low" indicates how much A trace is high when S trace is low. For clarity, "0" denotes null contemporaneity, and "1" indicates full superposition. the rising edges of A track occur when S track is high (low), and the falling edges of A occur when S wave is low (high). Finally, it is interesting to note that the double notch is an inherent feature that also indicates the zero-crossing.

B. Decoding Algorithms
The following decoding algorithms describe two approaches for retrieving the absolute direction δ (which can be +1 or −1), angle θ , and velocity ω from the two Vernier encoders. Both the codes exploit the time delay between edges as the fundamental indicator of the angular position.
1) Full-Vernier: Algorithm 1 recovers the normalized angular superposition depicted in Fig. 2 from the temporal delays between relevant edges. The routine is invoked whenever a new edge η is detected by the hardware timer, configured for input capture. There are four possible types of η as follows.
1) AR, rising edge on the low-resolution track ( A wave).
2) AF, falling edge on the low-resolution track ( A wave).
3) SR, rising edge on the high-resolution track (S wave). Subsequently, the algorithm can take distinct expressions based on η. The time elapsed between homologous edges, i.e., t, is computed at lines 5, 9, 13, and 21: t min is the timer resolution, and τ AR , τ AF , τ S R , and τ S F are the previous values of the timer for the edge A R, AF, SR, and SF, respectively. These values are saved for the next step at lines 6, 10, 14, and 22.
When a new edge is detected on the high-resolution track, some additional steps are performed to compute as follows.
1) τ S i.e., how long S wave was low since the last SF event (line 15) or high since the last SR event (line 23). 2) τ A i.e., how long A wave was high while S was low (lines [16][17][18][19] or high (lines 24-27). Fig. 5 displays the quantities mentioned so far across the unrolled full-Vernier encoder. The representation refers to the counterclockwise rotation at constant velocity, nonetheless the principle holds for any motion. It is clear that the two alternative expressions of the conditional statements computing τ A descend from the inherent sequence symmetry pointed out above.
The section of Algorithm 1 from lines 28 to 34 is executed only when τ S > 0, i.e., when the new edge belongs to S, and concerns the update of the direction and angular position. Specifically, the degree of superposition ρ is estimated as τ A over τ S (line 29).
The updated angular position θ is returned by a lookup table as a function of ρ (line 30). Such table expresses the same relationship depicted in Fig. 2.
Subsequently, the direction of rotation δ is estimated based on the state of A wave (line 32), and flipped according to η and on the relevant half (lines 33 and 34). Also, the direction update is performed only if the magnitude of ω is below a given threshold ω inv , i.e., the detection of δ variations at higher velocities is considered as a reading error and discarded.
The final section (lines 35-39) performs the velocity update, provided that t > 0. Because the number of notches is different for the two tracks, the computation of ω varies accordingly depending on η. Finally, a low-pass filter reduces the noise.

18:
else 19: Simultaneous edges are not exploited, since in practice they are identified as very close events, and their order depends on the hardware tolerances and microcontroller drivers.
2) Half-Vernier: Albeit Algorithm 1 can be easily adapted to work with both the Vernier encoders, Algorithm 2 is presented as an alternative that fits well the peculiarities of the half-Vernier geometry.
This algorithm requires a buffer to save not only the latest timer count values (i.e., τ AR , τ AF , τ S R , and τ S F ) and the corresponding edge identifiers but also the penultimate occurrences of the edges SR and SF, whose counting is denoted by τ * S R and τ * S F , respectively. For convenience, the buffer that stores the last six η values is denoted by H, whereas that which stores the corresponding timer counts τ is indicated by T. These steps are summarized in the first six lines of the pseudocode. The main body of the program (lines 8-34) provides a double estimate of the angular position, i.e.,θ 1 andθ 2 , the elapsed time t, and the updated direction δ. Such quantities result from slightly different expressions in connection with the latest edge type and can be recognized with the help of Fig. 6. It is worth noting that t is computed only for the edges of S because the presence of the double notch on A track would alter it once a revolution, which should be handled separately. Also, the elapsed time, which is functional to the computation of the velocity in the final line of the procedure, is obtained as in the other algorithm.
Concerning δ, this can be inferred as indicated at lines 13-15 and 20-22, which consists in reading the state of S wave provided that |ω| is not too large. In addition, owing to the double notch, reading the state of A when η equals SR or SF is not always univocal, the determination of δ based on this feature is avoided. The estimatesθ 1 andθ 2 are finalized at lines 31-34.
This strategy relies on the time delays between combinations of edges, therefore, like the previous one, this algorithm may show degraded performance when angular accelerations at relatively low speeds take place. To attenuate such an issue, the angle update is performed in two distinct ways. When the magnitude of ω is below the threshold ω cnt and the startup procedure has already been terminated as denoted by the variable ϕ = 1, a pure incremental counting through the index i is executed (lines 35-37). Else, if bothθ 1 and θ 2 are meaningful (i.e., no reading error occurred) and the previous conditions were not met, i is expressed as the average ofθ 1 ,θ 2 , and θ * (lines 38-41), where θ * is assigned for the next function call at lines 37 and 41. Specifically, the aforementioned counting consists in increasing or decreasing the edge index i based on δ; i ∈ [0, N η [ allows retrieving θ through the lookup table that enumerates the angular positions of all the edges (line 42). Moreover, the average mentioned above, which takes into account the angle rollover, acts as a smoothing filter and is performed across two steps, resulting in a weighted mean in which θ * has a double contribution relative to the other entries.
Finally, as soon as ω inv is exceeded, the startup procedure is flagged as concluded by setting ϕ = 1 (line 43), and the velocity is updated (line 44).

A. Set-Up Description
The setup consists of a single shaft all the encoders under test are fixed to. The encoders are manufactured as circular PCBs with matte solder mask on top of the whole surface, except over the characteristic patterns, which ensures the reflection (see Fig. 7), being impressed in tin-covered copper patches. The diameter of the disks used for the experimental  test is 116 mm. This size testifies that our encoder is still a prototype, and miniaturization will be required to turn it into a commercial product suitable for electric motors and other applications. The selected disk size was also determined by the dimension of the reflective optical sensors [26] that were chosen based on their low cost and availability, and by the manufacturing process based on PCB rather than optical printing.
The sensing is entrusted to reflective optical sensors mounted on a dedicated PCB (see Fig. 8); this accommodates up to six reflective optical sensors with phototransistor output [26] and one hex-non-inverting precision Schmitt trigger [27] suitable to digitalize the analog signals of the photosensors. The two absolute encoders (Gray and binary) need all the sensors, while the incremental and the two Vernier-based solutions only need two photodiodes to be populated. Five sensing boards (one for each disk type) are connected to another PCB which interfaces them with the STM32 Nucleo-F446RE board, where the decoding takes place. The overall experimental setup is shown in Fig. 9.
Regarding the conventional alternatives selected for the comparison with the Vernier algorithms of Section II-B, the quantities are obtained via standard procedures. Specifically, the incremental encoder relies on a dedicated hardware timer performing the signed counting of the impulses produced by the notches [24]. The modulus of such a counter matches the number of impulses, i.e., angular sectors, occurring across a σ ← σ BIT XOR γ 6: θ ← θ min · σ revolution for a given direction, so that the counter value is proportional to the angular position θ , i.e., θ ← σ · θ min (1) where θ min is the angular width of a single sector, and σ denotes the sector number. The aforementioned counting can increase or decrease based on δ, which is implicitly given by the state of a given wave when a new edge on the other occurs [24], as for the half-Vernier. Likewise, retrieving θ from the binary encoder translates to reading the register that contains the angular sector number σ , and converting it by applying (1). It is important to note that σ is nothing but the number resulting from the concatenation of the bits that indicate the current state of the encoder tracks. Similarly, the procedure for decoding θ from a Gray-code consists in these steps, in addition to the conversion of the register value from Gray (γ ) to binary (σ ) format (Algorithm 3). Naturally, δ can be directly inferred from θ for both the absolute encoders.
The velocity ω is recovered through the procedure reported in Algorithm 4 describing how the state of all the three standard encoders is updated. First, it is worth observing that in contrast to Algorithms 1 and 2, this procedure is invoked with fixed time step (equal to 100 μs), rather than at each new edge occurrence. The velocity update follows a twofold strategy, namely, ω refresh at constant elapsed time τ max (lines 4-7) and ω refresh after sector variation detection (lines 8-11). In Algorithm 4, the superscript " * " indicates a previous value of the related quantity, as suggested by lines 6-7 and 10-11; the whole procedure implicitly includes angles' unwrapping. Finally, a low-pass filter is applied (line 12).  The incremental encoder adopted for this study has N = 64, resulting in an angular resolution of 360 • /(4 × 64) ≈ 1.4 • . Binary and Gray-code encoders are equipped with six tracks, corresponding to an angular resolution equal to 360 • /2 6 ≈ 5.6 • . The two Vernier encoders (see Fig. 7) are characterized by N = 32 (that is, 4 × N = 128 edges on the full circumference), which translates to the average angular resolution of an incremental encoder with the same N, i.e., 360 • /(4 × 32) ≈ 2.8 • . Also, the same resolution can be obtained by a Gray encoder equipped with log 2 128 = 7 tracks and as many optical sensors.

B. Discussion of the Results
The conducted tests aim at assessing the effectiveness of the Vernier encoders together with their decoding both under constant and variable speed, including inversion. Indeed, the low-velocity accelerations can be critical for the Vernier encoders because they can distort the observed time delays between the edges, degrading performance in terms of θ estimate. Conversely, the three conventional encoders are inherently immune in this regard because the computation of θ is time-independent and not based on previous samples. A meaningful portion of the first test carried out, suitable to convey the main findings, is reported in Figs. 10-13: Fig. 11.
Angle estimate: full-Vernier versus incremental and Gray-code encoders.  the first two figures concern the full-Vernier encoder in comparison to incremental and Gray-code instruments, and the others refer to the half-Vernier encoder versus the same conventional instruments. In fact, incremental and Gray-code encoders act as the reference instruments, thanks to their recognized accuracy. Conversely, the results related to the binary encoder are omitted because they are strongly affected by the noise induced by multiple bit transitions at a time. It is worth noting that the angle estimate of the incremental encoder has been offset in postprocessing to match the absolute amount, since no zero-reference track is used in the implementation. Fig. 10 depicts the speed estimates provided by the incremental, Gray-code, and full-Vernier encoders, and Fig. 11 displays the corresponding angle estimates. In both the cases, the speed transitions from −700 to 800 r/min take place in approximately 1.5 s. It is evident that the incremental and Gray-code encoders generate very smooth profiles totally unaffected by the zero-crossing. Conversely, the full-Vernier encoder manifests multiple defects introduced by the almost symmetrical pattern and by the ambiguity in terms of doubleedge detection. These issues translate to the fact that the sign of ω is wrong in the first half and regains the proper trend only when zero is approached (see Fig. 10). Fig. 11 confirms that the weaknesses of the full-Vernier encoder affect also the angle estimate. In particular, owing to the wrong direction presented in the first half of the figure, the full-Vernier instrument misses the actual angle profile multiple times, especially while crossing 180 • . The correct angle is recovered after approximately 1.5 s, i.e., after the first time θ crosses zero following the inversion. This experiment highlights the substantial unreliability of the full-Vernier encoder when the track reading is performed via only two sensors and corroborates the concerns pointed out in Section II-A.
The response of the half-Vernier encoder, compared with the incremental and Gray-code instruments, can be observed in Fig. 12 and 13. The former shows that the novel Vernier pattern ensures a neat ω estimate in line with the two well-established instruments. The only minor flaw is in the proximity of zero, and it is due to the fact that the velocity update of the half-Vernier occurs only in the presence of new edges. Concerning θ (see Fig. 13), the half-Vernier encoder confirms its trustworthiness throughout the time interval. Indeed, the novel Vernier encoder provides a very stable angle estimate Figs. 14 and 15 show another significant aspect of the Vernier encoders' operation, i.e., the absolute angle recovery after the startup. Specifically, the figures concern a quite demanding test where, immediately after the setup activation, the shaft is rapidly accelerated from zero to −1200 r/min in less than 0.2 s.
In addition, in this test the half-Vernier encoder displays an accurate response and an adequate readiness, very close to those of the two reference instruments. As can be observed in Fig. 15, for the adopted pattern with N = 32 notches, the absolute angle profile can be attained within a shaft rotation of 30 • .
However, the angle provided by the half-Vernier is marginally erratic during the acceleration transient, and the error becomes smaller as |ω| increases. This behavior is related the fact that the expressions ofθ 1 andθ 2 in Algorithm 2 are exact when the velocity is constant, and they move away from the real θ proportionally to the level such a condition is violated. Indeed, after 0.2 s, where the transient is substantially finished, the angle profile becomes very smooth and stable.

C. Half-Vernier Accuracy Assessment
To assess the accuracy of the half-Vernier encoder, it is possible to compute the standard deviation of a collection of angle measurements with respect to the measurements given by the well-established incremental encoder, which is also the instrument with the highest resolution (360 • /(4 × 64) ≈ 1.4 • ) among those available for the experimental tests. The accuracy is determined based on a set of 10 000 angle measurements performed across an experiment consisting in multiple full rotations and direction inversions suitable to explore a broad range of operating points. The results are reported in Figs. 16-19. Fig. 16 shows the average angle measurement along with the corresponding standard deviation interval for each angle of the incremental encoder. The figure testifies the overall good performance of the half-Vernier encoder. Average half-Vernier angle measurement and relative standard deviation interval compared with the ground-truth incremental encoder measurement. However, there exists a loss of precision about the origin. The issue is attributable to the presence of the double notch, which locally reduces the sensitivity of the encoder. In addition, the average angle oscillates in accordance with the varying distance between homologous edges as defined by the Vernier scale. Moreover, the amplitude of such a fluctuation tends to increase as the angle grows: this feature is confirmed by Fig. 17, where the standard deviation is reported as a function of the angle. Here, the average accuracy is ±6.51 • .
A further indication of the accuracy of the half-Vernier encoder is conveyed by Fig. 18, where the absolute measurement error with respect to the incremental encoder is expressed in terms of percentage of samples within a given interval [9].
To strengthen the analysis, Fig. 19 depicts the standard deviation of the half-Vernier angle measurement relative to that of the incremental encoder as a function of the angular velocity. In addition to the computed points, the fitting of the samples is reported to highlight the trend. The standard deviation exhibits the minimum at zero velocity: as the speed magnitude increases, the angle measurement degrades because  of the decreasing number of clock periods between two consecutive edge events.

D. How to Reduce Half-Vernier Measurement Uncertainty
Some measures can be taken to reduce the measurement uncertainty of the half-Vernier. First, one can increase the clock frequency to ensure an adequate number of clock events is available also at high speed, which affects the estimate of angular superposition ρ and, in turn, of the angle θ . Second, one may increase the geometrical accuracy of the disk pattern: improving the quality of the printed features in terms of edge sharpness and relative placement is beneficial for the sake of uncertainty reduction. It is worth mentioning that the manufacturer of the PCB disks declares a spatial resolution (minimum clearance) of the manufacturing process of 0.2 mm. Finally, the measurement uncertainty can be decreased by tuning the gain of the optical sensors, thus augmenting the dynamic range of reflectance between opaque and reflective features. Such an optical gain can be altered by adjusting the gap between the sensor and the disk, by tuning the resistance that conditions the sensor components, or using photodiodes with a higher optical gain (and possibly higher price).

IV. CONCLUSION
In this study, on two-tracked Vernier encoders, two novel algorithms for position, speed, and direction decoding have been described and their performance evaluated against the state-of-the-art position sensors for drives. The main objective was to devise a new and simple solution for angular position sensing, cheaper than resolvers and absolute encoders. The results showed inadequacy of the full-Vernier implementation to drive applications, but it also demonstrated the effectiveness of the half-Vernier alternative for the purpose.
Under real operation, the full-Vernier encoder, in conjunction with the proposed decoding algorithm, offers little margins to retrieve correctly the direction of rotation, and this issue reflects adversely also on angle and velocity. Such a problem may be mitigated by increasing the accuracy of the mechanical assembly; however, this restricts the applicability of the full-Vernier solution to high-precision systems. Alternatively, the issue could be overcome via a third optical sensor with quadrature arrangement relative to one track, a solution already adopted by Vernier encoder manufacturers.
Conversely, the half-Vernier encoder embodies attractive qualities that make it a feasible alternative to the conventional absolute optical encoders. Indeed, it offers adequate encoding performance in conjunction with a significantly simpler and more compact hardware design compared with that of the binary and Gray-code alternatives for a given resolution. The tested implementation, with a 7-bit resolution (2.81 • ), exhibits an accuracy of ±6.51 • . Moreover, it gives a correct position information in less than 30 • , outperforming both the incremental encoders with index track (180 • average rotation for correct absolute angle) and Hall sensors (threetrack absolute encoder with 60 • uncertainty). The half-Vernier is also suitable for cost-effective applications possibly with high assembly tolerances, as in the test setup used in this study. Its major weakness concerns the response under low and variable velocity operation.
Therefore, the half-Vernier encoder exhibits similar compactness, inexpensiveness, and tolerance to mounting errors when compared with the inductive angular sensors, but the working principle is radically different and the conditioning is completely digital, and hence it can be read entirely within software, without the need of analog-to-digital converters (ADCs) or dedicated integrated circuits (ICs).
Our solution emphasizes the flexibility and affordability, and its originality can be found in the minimalist implementation of the Vernier scale: to the best of our knowledge, there exists no other encoder with absolute angle detection capability in such a minimalist assembly and with similar performance as the half-Vernier has.