Suppression of Noise to Obtain a High-Performance Low-Cost Optical Encoder

Currently, commercial encoders endowed with high precision are expensive sensors, and optical low-cost designs to measure the positioning angle have undesirable levels of system noise which reduce the good performance of devices. This research is devoted to the designing of mathematical filters to suppress noise in polarized transducers, in order to obtain high accuracy, precision, and resolution, along with an adaptive maximum response speed for low-cost optical encoders. This design was proved through a prototype inside a research platform, and experimental results show an accuracy of 3.9, a precision of 26, and a resolution of 17 [arc seconds], at least for the specified working conditions, for the sensing of the angular position of a rotary polarizer. From this work has been obtained a high-performance low-cost polyphase optical encoder, which uses filtering mathematical principles potentially generalizable to other inventions.


Introduction
The sensors devoted to obtain the angular position for a shaft are known in engineering as encoders.The most commercial and popular are incremental and absolute encoders, resolvers, and encoding potentiometers.
Also, some efforts have been made in designing optical encoders taking advantage of the polarization properties of light.The state of the art related with these types of devices is mainly found in patent publications.The main patents related to this subject are briefly described in the following chronological order: An encoder principle is proposed in [1], to identify the polarization of light in proper phase sequence, using photoelectric devices.
In [2], a photoelectric conversion design is presented to measure the rotation angle of a shaft using polarizer discs.
In [3], an angular position transducer is designed with various processing devices to convert an analog signal generated by polarizing light into a discrete output signal, utilizing a polarized disc with coded tracks.
In [4], an angular position sensor is designed with three polarized phases rotated 60 °to each other.
In [5], a simple principle for an encoder design is presented, which detects the amount of light using a photoemitter and a photodetector, arranged on opposite sides of two polarized filters.
In [6], the polarized light is directed towards a plurality of fixed analyzers and light detectors which outputs an electrical signal to a phase processor.
In [7], the angular position is detected by using amplitude and quadrant information.
In [8], polarization difference imaging techniques are used to calculate the orientation of a rotatable member.
In [9], an encoder is constructed with a multichannel reception module to generate two signals proportional to light intensity of the beam from the polarizers.
In [10], a device is presented for detecting a reference position signal and for calculating a relative rotation angle between both a fixed and a movable unit.
A new approach is developed in [16], where a novel encoder is proposed to obtain better accuracy, precision, and resolution than commercial encoders, but using lowcost optical components.

Motivation for This
Research.On the one hand, conventional rotary encoders have some drawbacks which are difficult to overcome: most of them require expensive processes for manufacturing their coded wheels; their accuracy, precision, and resolution are limited by the number and the size of the holes in their wheels; they are susceptible to interference; potentiometers present electromechanical problems due to friction; and so on.On the other hand, commercial use of encoders designed with polarization of light is currently very limited, because they are both expensive and susceptible to fails.These facts open up opportunity areas for innovative concepts to improving the performance of optical encoders.
Additionally, to obtain high performance in measuring angular positions, most commercial encoders must be adapted to expensive antibacklash gear-reduction systems; even so, when gears wear out, they begin presenting small measurement errors.So, the obtaining of high accuracy, precision, and resolution, directly from the transducer, and without the need to use specialized motion reducers, has always been a motivation for encoder designers.These goals have been partially achieved by [1][2][3][4][5][6][7][8][9][10][11][12][13][14][15][16].Every one of them have smart operating principles based on the polarization of light; nevertheless, their commercialization has been frustrated because they are not confident devices from the engineering point of view; thus, research must be made to complete previous designs, for the obtaining of reliable lowcost positioning sensors.

The Contribution of This Work.
The main contribution of this work is the design of a noise suppression system to obtain a high-performance low-cost optical encoder (HP-LCE), to be used in engineering fields where high accuracy, precision, and resolution, along with an excellent maximum response speed, are required to measure angular positions.This design can be incorporated at low cost to mechatronic machinery, industrial robotics, and every closed-loop control system where exactness in positioning is needed.Furthermore, since this design can be encapsulated in small-size and low-weight devices, it could be considered for use in drones, unmanned aerial vehicles, or even space aircraft applications.This contribution also has the potential to become the operating principle for accelerometers, gyroscopes, inertial measurement units, and compasses/magnetometers, among others.

Problem Statement.
When a light beam passes through a rotary polarizer and after through a fixed analyzer behind which a photoreceiver is located as is shown in Figure 1, a characteristic graph can be generated in the plane formed by the detected intensity of light versus the angular position of the polarizer.
In theory, according to Malus' Law I θ = I 0 cos 2 θ , the angular position of the polarizer should be obtained from where θ represents the angular position for the rotary polarizer, I θ is the intensity of light detected by the photoreceiver, and I 0 is the initial intensity of light.Defining the keyword "system noise" as a random fluctuation of system variables that degrades the quality of signals and data; then, θ in (1) is accurate, only for imperceptible levels of system noise.In real applications, every technological device has its own levels of system noise.Particularly, commercial LEDs produce fluctuations, and commercial photoresistors delay change detection, of light intensity.Figures 2 and 3 are enlarged views of real characteristic curves, devoted to show the system noise produced by the combination of the mentioned fluctuations and delays.Actual data, hereafter called Y θ , is represented by the nonsoft function (piecewise curve), which shows measurement inaccuracies; that is, Y θ is a noisy signal.
Thus, a "filtering process" must be designed to reject noise, even for low-cost optoelectronic components, in order to successfully use (1).The concept of filters to avoid system noise is represented by the continuous function (thick line) in Figures 2 and 3 and labelled as Y * θ .
Even more, the dynamic operation of the optical system can contain nonmodelled disturbances which are unknown sources of noise.Suppression of system noise can lead to increasing accuracy, precision, and resolution, for optical transducers.

Methodology
Claim 1.Since the use of both specialized optical components and optoelectronic hardware, for filtering processes, increases the production cost for any device, then a high- 2 Journal of Sensors performance low-cost optical encoder must be free from these specialized solid-state elements.
Claim 2. Polarization properties of the light have enough potential to serve as the transducer principle to obtain a high-performance encoder.
Claim 3. Mathematical methods can be used as filters to deal with system noise produced by the polarization of light, in order to maintain the designed platform at a low cost.
Hypothesis 1.A high-performance low-cost optical polarizing encoder can be obtained by suppressing system noise, through the use of reliable mathematical methods.
To prove hypothesis 1, it is mandatory that the designing of the filtering process be included in an experimental system.Two filters are proposed in this work to suppress system noise: one of them has a static operation and the other one works on active conditions, hereafter called Sta-F and Dyn-F, respectively.
2.1.Preliminary Design.Optical components with strictly linear behaviours should be plotted according to Malus' Law as the dashed line shown in Figure 4, but these types of optoelectronic components are very expensive.
When the system in Figure 1 is implemented with lowcost optical components, the resulting characteristic graphics do not corresponds to Malus' Law, but the nonlinear behaviour of photoresistors generate curves as that exemplified by the thick line in Figure 4; however, this problem has already been successfully resolved in [16], where it is proposed that the curve generated by low-cost optical components can be adjusted to Malus' law by using the polynomial expression where Y θ is the quasi continuous function formed by actual readings of intensity of light, B are constant coefficients; b is the power of the polynomial; and I * θ is a quasi continuous function to identify the value for I θ , such that lim b→∞ I * θ = I θ .This adjustment is exemplified by the thin curve of Figure 4.
For the purposes of this work, Figure 1 is called the "phase."Equation (1) can contain errors in obtaining the angular position, because in the real-world, there are phase identification errors (e), that is, I * = I + e, and also because in the vicinity of 0, π/2, π, 3π/4, … , small increments in intensity of light (ΔI * ) are unclear and blurred to read for small changes of angular positions (Δθ).To deal with these drawbacks, it is introduced the concept of the "polyphase" optical encoder: Figure 1 is an encoder with one phase, while Figure 5 is an encoder with two phases, phase-shifted δ = π/2 [rad], and its behaviour is represented by Figure 6.
Evidently, by increasing the number of phases, we increase the amount of information coming from the encoder.

Design of the Static Filter.
Sta-F is devoted to reducing noise from Y θ and, thus, obtains a filtered version of (2), which is not a time-dependent function.Thus, the characteristic behaviour for every phase implemented with low-cost components remains invariant in time.As the filter retains this characteristic, the filter for Y θ has a static nature.Definition 1.Let Φ i be the ith phase of the polyphase optical encoder, where i = 1, … , N, and N is the total number of phases.Definition 2. Let F i ∈ R M be an ordered set of points corresponding to Φ i , located in a two-dimensional surface plotted by the angular position (0 < θ m < π) of a rotating polarizer and a normalized intensity of light (0 < y m < 1) , where M * is the total number of points.
Note 1.For the purposes of this work, the ordered sets comply with properties of reflexivity, antisymmetry, and transitivity only for the angular position (θ).
Note 2. The elements θ m , y m * are not actual data but points taken from Y * i θ ; as such, M * can be as large as desired.
Knowing Definitions 1-4, Sta-F is stated as follows: the filter Y * i θ for Φ i can be obtained via the following polynomial expression: where A 0,…,a are constant coefficients and the power a must be as large as needed to correctly filter Y i θ .According to Definition 5, from (3), the filtered set F * i can be obtained with M * as large as desired.
Implementing static filter implies that (2) becomes which is the identification of intensity of light for Φ i .
2.3.Design of the Dynamic Filter.Even when Sta-F is designed to remove noise from ( 1)-(2), remaining system noise coming from nonmodelled and unknown dynamics of the encoder must also be treated.
A statistical approach is proposed to deal with this remaining noise, by computing the statistical mean for a large number of θ values which are normally distributed according to the Central Limit Theorem.Also, two algorithms to obtain every individual θ are proposed.This new filter has a dynamic nature, because θ values are dynamically computed.Definition 6.Let θ j be a set of independent angular values with j = 1, … , k, obtained from the same position of the polarizer (via some specific algorithm) and normally distributed around some statistical mean θ.Definition 7. Let θ be the angular position of the polarizer, obtained by Definition 8. Let θ * j be independent and identically distributed values with mean x and finite variance σ 2 , which generates the random variable From Definitions 6, 7, and 8, the following remarks can be stated: where e i is the identification error for Φ i , ϵ represents an error coming from a phase-shifting technique (if some is used), and ε i is the hidden and unknown phase error for Φ i (see [16]).
Remark 3. The θ can make use of statistical properties stated by the Central Limit Theorem, provided that θ j has Gaussian distribution.

Light source Polarizer
Phase-1 Phase-2 0º 90º Definition 11.Let θ * s,u be independent and identically distributed values with mean x u and finite variance σ 2 u , which generates the random variable From Definitions 9 and 11 can be stated the following remarks: As such, accuracy and precision for the angular position of the proposed encoder is directly proportional to k and v. And, taking sufficiently large values for k and v, the remaining errors produced by phase identifications, PS adjustments, and angular measurements vanish for practical purposes.
Summarizing, Dyn-F is used to dynamically obtain the statistical mean value of the angular position of the polarizer, provided that θ j and θ s,u have Gaussian distributions.

Implementation Example
For implementing the filtering process, a research system was manufactured, which includes the experimental prototype (i.e., the encoder), a motion system to move the rotary polarizer, and the hardware used.This section begins with the description of the research system and continues with an example of implementing Sta-F and Dyn-F, and finally, results of this implementation example are given for an interval of study from 1 to 15 degrees and 8 × 32 reads for each degree, that is, N = k = 8, t = 32, and v = 15.

The Research System
3.1.1.Experimental Prototype.For this practical example, a polyphase optical encoder was manufactured as presented by Figure 7, which shows the exploded view of the experimental prototype, with the following components: (1) The source of light is a white-light ultra brilliant LED.
(2) Base attached on the inner ring of the bearing.
(3) Bearing to allow rotary movements for the polarizer.
(4) Polarizer mounted on the inner ring of the bearing.
(5) Base for the outer ring of the bearing.As is presented by issues 6-7 of Figure 7, there are 8 phases; thus, N = 8. Figure 8 shows the geometric distribution of the polarization axes of the analyzers, with phaseshifting δ ≃ π/4 [rad].
3.1.2.Motion System.The motion system is devoted to move the rotary polarizer (issue 4 of Figure 7), which is mounted on a bearing for extremely smooth movements.
A bipolar stepper motor is mounted on a solid structure after which an antibacklash gear-reduction system reduces the movement with a ratio of 311 85748 1.The stepper motor has 200 steps; as such, the resolution for angular displacements is 0 °0′ 20 78 ″ .
For N ≥ 3, k number of angular measurements can be obtained from the possible number of combinations between phases, utilizing the phase-shifting (PS) general form θ j = G tan −1 ∑ p=1 β p I p /∑ q=1 β q I q , where G is a constant according to the step of the used PS algorithm and β p,q represent constant coefficients usually valued as −1, 0, 1.

Algorithm 1
For N ≥ 1, k = N number of angular measurements can be obtained from θ j = 1/2 cos −1 2I * i θ − 1 , which is Malus' Law of (1) but taking the normalized intensity of light to ensure homogeneity in the set F i .Note that only for this case, i = j.

Journal of Sensors
It is important to note that the motion system is not part of the encoder but is only implemented for research purposes.

The
Hardware.An Arduino Mega-2560 board has been used as the controller, to do the following sequence of tasks: (1) Controlling the ignition sequence to move the stepper motor, via a L298 H-bridge used as the power electronics.The long of steps of the motor are calculated according to the value of M.
(2) Collecting data (F i ) from the experimental prototype.
(3) Sending F i to a computer.
(4) Waiting for the characteristic equations for each phase, which are being generated by the computer, that is, (5) Collecting the characteristic equations I * i from the computer.
When issue 5 has finished, the characterization process for the phases has been concluded.From this moment, the encoder can work indefinitely and the angle is dynamically calculated while the system is switched on.(6) Obtaining the angular position of the rotary polarizer by using Dyn-F.For this example, this point also includes dynamically displaying the value for the angle in the serial monitor of the Arduino editor.

Example of Implementation of Sta-F.
Matlab is the selected software to implement issue 4 mentioned in the sequence of tasks of the Arduino board.
To exemplify the implementation of Sta-F, the Matlab functions polyfit and polyval have been used in the following code (displayed in compact form): where for this example i = 1, … , 8, x is the set of ordered and consecutive numbers from 1 to M = 180, a = 7 is the power of the polynomial for the filter, b = 3 is the power of the polynomial representing the identification of Malus' law, and δ i is the phase shifting for Φ i .Note that Y i is not included in the code because this concept only represents a curve.Also note that lines from (a.1) to (a.6) are not included in the dynamical operation of the encoder, while line (a.7)establishes the link with Dyn-F.

Example of Implementation of Dyn-F.
For this example, PS algorithms are not utilized at all, which greatly simplifies implementation.Equation of Algorithm 2 was selected to obtain θ 1 , … , θ 8 , in the following form: where for this case i = j = 1, … , 8. For an encoder with N = 8, (5) becomes 3.4.Experimental Results

Evaluation of Accuracy, Precision, and Resolution.
As is stated in [16], according to ISO 5725-1, the accuracy is defined as the proximity of measurement results to the true The definition for resolution is taken as the capability of distinguishing between two separate but adjacent measurements.To evaluate these three concepts for the proposed encoder, real data has been taken from the research system, which has a structure exemplified in Table 1.Numerical data has not been included in this technical report to avoid large and unnecessary tables, but every table, experimental data, and additional information mentioned herein is available by contacting the authors.The structure of Table 1 has 15 rows, for an interval from 1 to 15 degrees and 32 columns, which are 32 different readings.Every set of readings is completed in 1.17 hours; as such, the data of Table 1 has been obtained in 37.44 hours.The low-cost used for this encoder has a product life of 50 hours approximately.
In the same way, the average error for columns is E s,u and the average error for rows is E s,u .The results for E s,u are shown in Figure 9, while Figure 10 shows the results for E s,u .
Using Table 1, and information from Figures 9 and 10 (2) Taking into account the average of individual errors, (A e ) is given by If we take this second criteria, then, the proposed encoder has A e = 0 9 [arc sec].
To evaluate the precision for the encoder, let us consider the worst working conditions, which consist in taking equations I * 1,…,8 for 37.44 continuous working hours of the Led; that is, no tuning or adjustment of parameters are permitted.Under these conditions, Figure 11 shows results for 5, 10, and 32 reads, where it can be seen that increasing the size of the sample, the precision error (P e ) decreases.For 32 readings, the average for the precision error is P e = 0 007318343    To evaluate the resolution for this device, every step of the motor (0 °0′ 20 78 ′′ ) has been taken to capture light intensity values for every phase; that is, from 0 to π/2 [rad], there are 15600 × 8 = 124,800 reads.Every read is compared with respect to 5 last reads and so can be determined how many significant changes (No Changes) have been really produced (increasing or decreasing its value).Taking this criteria, the resolution for the encoder is obtained by computing R = No Changes/124,800.Numerical result for the encoder resolution is R = 16 9418622 [arc sec].
3.4.2.Evaluation of Maximum Response Speed.Accuracy, precision, and resolution are important parameters to evaluate encoders; nevertheless, the maximum response speed (MRS) of the proposed filtering process must be studied, because this is another important parameter for the characterization of this encoder.The filters used for noise suppression need program execution time, which must be experimentally obtained (theoretical calculations are not exact).To investigate this MRS, the following program structure (displayed in compact form) was performed, which includes both Sta-F and Dyn-F:  This filtering program running on an Arduino board (with a microprocessor at 16 MHz) gives an elapsed time of 24 μs (microsec), which gives an execution speed of the filtering program of (1/0.000024=)41.67KHz.In industry, instrumentation and control tasks are actually done by robust electronics as professional data acquisition cards (DACs) supported by specialized software running on commercial or professional computers; to exemplify this case, it can be mentioned that the execution speed of the same filtering program on C++ is in the order of 4.94 MHz on a computer running at 1.90 GHz (AMD A10-7300).
For the case of conventional incremental and absolute encoders, the MRS is called maximum response frequency (MRF) and is usually calculated with where PPR is the points per revolution on the encoding disc and RPM is the revolutions per minute of the rotor shaft.Equation ( 18) is useful to determine the minimum speed of the data acquisition card (DAC) that must be used and also to know the performance of the encoder (e.g., working inside a closed-loop control system).
To make comparisons between both types of encoders, let us take as a reference the value of 1750 rpm, which is the speed of the most used electric motors in industry.According to (18), we need a disc with a PPR = 1428 to obtain a MRF = 41.67 KHz, which is the equivalent frequency of the MRS of the program running on the Arduino board.However, we need a disc with 169,352 points per rev to obtain a MRF = 4.94 MHz, which is the MRS of the program running on a conventional computer.
Even when the data acquisition card (DAC) is not part of an encoder, for implementation purposes, it is important to take into account the speed of the data acquisition process.The Arduino board also has the possibility to work as a DAC using the command analogRead(AnInput(i)), which has an average execution time of 108 μs.As a result, conventional incremental and absolute encoders with MRF > 10 KHz are unable to use an Arduino board as a DAC, while the HP-LCE is able to work with any DAC speed.

Application Discussion
From Section 3.4.2can be concluded that the MRS for the proposed filtering process depends on both the speed of the computer processor and the number of commands used to implement the filters (e.g., the number of phases selected from the HP-LCE and the way to obtain θ j ); this flexibility lets the HP-LCE become an adaptive encoder.

Journal of Sensors
The HP-LCP is able to work with any DAC speed (e.g., Arduino, NI cards, and dSPACE-1103), because its phase-based design has an analogical nature and the frequency constraint coming from the PPR parameter does not exist; this fact lends itself to a large variety of applications.
For the common use in mechatronic devices, for example, robot arms, conveyor belts, and positioning plates, the HP-LCE can be successfully implemented at low cost.However, this sensor can be used in unmanned aerial vehicles, because it is designed with low-weight materials and components.
For the case in which high-quality optical components are used, linear behaviour is expected; as such, (2) is not required, but the filtering process is needed.
This novel HP-LCE has great operational flexibility, because it can be implemented by any PS algorithm, with N ≤ 3, but also, PS algorithms can be avoided, as is exemplified in the case of the study.
The design for the HP-LCE can work with low-, medium-, and high-cost components.
Table 2 shows a comparison between the HP-LCE (first column), the polyphase encoder given in [16] column), and conventional encoders (third column).
Finally, Table 3 shows a performance comparison between HP-LCE, the polyphase encoder, and a conventional incremental encoder with PPR = 2000.The units of these numerical results are given in arc seconds.
Implementation Example contains every detail to successfully implement the HP-LCE.

Conclusions
Experimental results support the claim that the given hypothesis 1 is true, since they show that the filtering process to suppress noise is the key point to increase accuracy, precision, and resolution in the proposed HP-LCE compared with the polyphase encoder, at least for the specified working conditions.Another important conclusion is that the filtering process has a MRS which can work with any DAC, no matter its speed, performance, and cost.
Currently, commercial high-performance optical sensors are expensive devices.However, based on the philosophy that total acceptance of nature produces knowledge, the authors consider that in order to reduce manufacturing costs for high-performance optical devices, research must be made to study the behaviour of low-cost materials and components (accepting them as they are), looking for models of their actual physics behaviour, along with mathematical proposals and strategies to indirectly obtain high precision, accuracy, resolution, and repetitiveness, for the designs under consideration.This work gives evidence that this philosophical claim can be applied at least to optical sensors and sets methodological basis for further inventions related to optical sensors.Some filtering concepts given herein could also be implemented in inventions as [1][2][3][4][5][6][7][8][9][10], among many others.

Remark 1 .
The distribution function Γ k converges to the standard normal distribution function as k increases without bound.Remark 2. Considering θ* ≃ x as the actual value for the measured angle, then, when θ → θ * , ϵ + ε i j = 0, 7

Remark 5 . 11 Remark 7 .
The distribution function Γ t,v converges to the standard normal distribution function as v increases without bound.Remark 6. Considering θ * s,u ≃ x u as the actual value for the measured angle, then, when θ s,u → θ * s,u , lim + ϵ + ε i j,u = 0 The θ s,u can make use of statistical properties stated by the Central Limit Theorem, provided that θ has Gaussian distribution.

Figure 7 :
Figure 7: Exploded view of the experimental prototype.

15 s=1
, let us take two different criteria to evaluate accuracy error (A e ): (1) Taking into account the absolute value for individual errors, (A e ) is given by abs θ s,u − s 15 According to this criteria, for the proposed encoder, A e = 0 001085034 [deg] or A e = 3 906 [arc sec].
where M represents the total number of actual readings from Φ i .Definition 3. Let Y i θ be a quasi continuous function conformed by the union of consecutive elements of F i .
* i θ be a soft function, where its first angular derivative d/dθ Y * i exists and is Lipschitz continuous, with the same amplitude and phase than Y, such that

Table 1 :
Data to obtain accuracy and precision including 32 readings from 1 to 15 deg.