An error compensation method for a linear array sun sensor with a V-shaped slit

Existing methods of improving measurement accuracy, such as polynomial fitting and increasing pixel numbers, cannot guarantee high precision and good miniaturization specifications of a microsun sensor at the same time. Therefore, a novel integrated and accurate error compensation method is proposed. A mathematical error model is established according to the analysis results of all the contributing factors, and the model parameters are calculated through multi-sets simultaneous calibration. The numerical simulation results prove that the calibration method is unaffected by installation errors introduced by the calibration process, and is capable of separating the sensor’s intrinsic and extrinsic parameters precisely, and obtaining accurate and robust intrinsic parameters. In laboratorial calibration, the calibration data are generated by using a two-axis rotation table and a sun simulator. The experimental results show that owing to the proposed error compensation method, the sun sensor’s measurement accuracy is improved by 30 times throughout its field of view (±60°  ×  ±60°), with a RMS error of 0.1°.


Introduction
A sun sensor is an important measuring component in the attitude determination and controlling system of a satellite. It is capable of obtaining the satellite's attitude by measuring the angle between the sunlight and a certain reference axis or plane of a sun sensor, and converting to the satellite coordinate frame.
With the progress of MEMS (microelectro mechanical systems), integrated design and precision manufacturing technology, microsatellites have developed rapidly in the last decade [1,2]. This puts forward higher requests to the miniaturization specifications (such as weight, size, and cost) of attitude measurement devices [3,4]. Generally, an analog sun sensor weighs more than 500 g and has a relatively large size and power consumption [5]. It is also vulnerable to incoming light from non-solar sources, which decreases the sensor's working reliability and measurement accuracy. This was followed by the digital sun sensor, which weighs about 200 to 300 g and typically employs a 2D detector array, such as a CCD or CMOS to reach a high precision (about 0.01°) [6,7]. But it is still too large and too heavy for a nano-satellite or pico-satellite. As a result, several types of microdigital sun sensors specially designed for microsatellites are invented by organizations such as the Jet Propulsion Laboratory of the United States [8], the TNO-TPD Company of Holland [9,10] and the Solar MEMS Company of Spain [11]. Their weight is less than 100 g, but the manufacturing process requires a special optoelectronic integration technique. Besides, the main chipsets of these sensors are custom-made and cost over one hundred thousand dollars, limiting their application to lowcost satellite missions. Recently, one novel approach is to make use of a diaphragm with V-shaped or N-shaped slit and a single linear array image sensor to enable effective attitude measurement. This type of microsun sensor has become the best choice for microsatellites owing to its light weight (only several tens of grams), small size, low power consumption, and low cost with modest precision.
Currently, there are only a few institutes doing research on microlinear array sun sensors. Among their products, the SS-411 series sun sensor of Ryerson University, Canada [12] is regarded as the most advanced. Based on a 256-pixel linear detector array, it weighs only 35 g and reaches a mean measurement precision of 0.2°. In China, Tsinghua University and the Beijing Institute of Control Engineering are also involved in this area. They use a linear APS of 3468 and 2048 pixels, respectively. As a result, the two sensors reach a much higher measurement precision of 0.02° and 0.03° but a relatively heavy weight of 133 g and 420 g, respectively. It can be seen that, to achieve a high precision sun sensor by increasing the number of pixels at the cost of weight and size, will in some ways limit its application to nano-satellites or pico-satellites.
In contrast, software compensation methods can improve a sun sensor's measurement precision without increasing its weight, size, or costs. Existing software compensation methods can be roughly classified into two categories: (1) Polynomial fitting. This is adopted by He Liang et al from the Beijing Institute of Control Engineering [13] and Song Li et al from the Harbin Institute of Technology [14]. This method is very simple but has low precision. It uses only a second order or higher order polynomial to describe the input-output relation of the sensor and ignores its geometric model [15]. The coefficients of the polynomial are of no physical meanings. In addition, the sensor's FOV (field of view) needs to be divided into two or three parts to get a best fit. (2) Modeling. This is used by Wensong Wei et al from Tsinghua University and John Enright et al from Ryerson University Canada. The precision of this method is better than that of polynomial fitting [16]. However, Wei's method only considers the refraction effect but ignores other smaller system errors and laboratory errors (errors that are introduced in experiments and are irrelevant to the sensor itself). Enright's method covers many contributing factors of system errors and laboratory errors. Unfortunately, his model is relatively complicated and the refraction index of protective glass is not calibrated but is assumed to be a known constant, which will lead to an accuracy loss [17].
To overcome the disadvantages of these software compensation methods, a novel error compensation method based on a microlinear array sun sensor with a V-shaped slit is proposed in this paper. The sun sensor's measurement precision is significantly improved by establishing an integrated and accurate model of error compensation and performing parameter calibration. Meanwhile, the sensor's miniaturization specification does not suffer from this process. The error modeling and parameter calibration methods are also applicable to a sun sensor with a N-shaped slit or other slit patterns.

System structure and working principle
A linear array sun sensor is usually made up of an optical mask, a linear array image sensor, and signal processing units. A V-shaped or N-shaped slit is etched on the optical mask. The two sensors share a similar working principle. In this paper, the working principle and geometry model of a linear array sun sensor will be introduced with a V-shaped one as an example.
In the sensor's geometry model, the image sensor coordinate frame O-XYZ and optical mask coordinate frame O′-X′Y′Z′ are defined as follows. They are both right-hand coordinate frames. The X-axis and Y-axis are along the row and column of the linear imaging array, respectively. The Zaxis is perpendicular to the X-Y plane and crosses the center of the linear imaging array. The V-shaped slit is formed by a vertical slit and a tilted slit. The angle between them, δ, is designed to be 45° to simplify the calculation. The Y′-axis is parallel to the vertical slit. The Z′-axis is the bore sight of the sun sensor which crosses the center of the tilted slit and intersects the image sensor plane at the principal point (Δx, Δy). Suppose that the three axes of O-XYZ and O′-X′Y′Z are parallel to each other. The distance between the optical mask plane and the image sensor plane is h. Sunlight passing through the V-shaped slit creates a pair of bright spots on the image sensor. The coordinates of the two spots on the X-axis are x 1 and x 2 , respectively. The incident angle of sunlight in the X′O′Z′ plane and Y′O′Z′ plane are α and β, respectively. When α changes, the two spots will move, but maintain their distance (figure 1). When β changes, the left bright spot will move while the right one is fixed ( figure 2). Therefore, the two-axis incident angle of sunlight α, β can be calculated according to the position changes of the two bright spots, as described in equations (1) and (2).

Error factors
The measuring formulas above can only apply to ideal conditions. Due to the machining and assembling process of the sun sensor and the non-ideal characteristics of the components, there are other relevant factors. (3) Quantization error: The first step of image processing is spot position estimation, which identifies the contributing pixels of a bright spot and calculates its centroid. However, the continuous illumination pattern may not be resolved by the coarse spacing of pixels, resulting in quantization error (see section 3.2.3). (4) Random errors: There are other error factors, such as the nonuniformity, gain, and ageing of pixels, thermal noise, A/D error of the processing circuit etc. These errors may decrease the sun sensor's measurement precision. Hereinafter, an in-depth error analysis is given and a complete error compensation model is established based on the results analysis.

Analysis on the impacts of the errors
The compensation model will become very complicated if all the error factors are taken into consideration. Therefore, only those errors larger than the sensor resolution will be included.

Sensor resolution.
The sensor resolution can be calculated from the derived functions of equations (1) and (2), as shown in equation (3): d angle denotes the sensor resolution. γ is the angle between the incident light and that perpendicular to the sensor. This ranges from −60° to 60°. The centroiding algorithm can reach a subpixel accuracy of 0.1 pixels [18], and the pixel spacing Δx is known to be 63.5 μm, so dx is 6.35 μm. The design value of h is 2 mm. Thus, the highest and lowest sensor resolutions are 0.0455° and 0.1819°, respectively. The relationship between the measurement error (caused by structural errors) throughout the FOV and the sensor resolution is described in table 1. It can be seen that the structural errors have significant impacts on the measurement precision of the sun sensor, so they should be included in the compensation model. By comparing the data in table 1, additional conclusions can be reached: δ has a larger impact than b and c; T 1 and T 2 have an equal impact, which is a little larger than T 3 's. Figure 11 is a schematic diagram of the sun sensor's optical refraction effect. If there is no refraction, the distance between the bright spot created by the sunlight's oblique incidence and the vertical incidence is l. When refraction occurs, the distance becomes l′. According to the

Refraction effect.
law of refraction, l and l′ can be expressed as equations (4) and (5): tan arcsin sin . 2 1 glass (5) Suppose that the glass's refractive index (n glass ) is 1.4, and its thickness (h 1 ) is 1 mm. h 2 denotes the thickness of the vacuum between the optical mask and the upper surface of the glass. It satisfies the relation h 1 + h 2 = h = 2 mm. The simulation of the refraction effect on the measurement error is shown in figure 12.
Obviously, the refraction effect increases with the light's incident angle. The maximum measurement error reaches 1.4°, while the incident angle ranges from −10° to 10°. The largest measurement error throughout the FOV is about 8.45°. Therefore, to compensate the measurement error caused by refraction is an important task. To evaluate the refraction effect, the real values of the refractive index and the thickness of the protective glass should be calibrated precisely.
and the center position of the bright spot calculated by the centroiding algorithm [19,20] is: Suppose that the real centroid of the bright spot is x c , then the quantization error Δx c is: The intensity distribution of the light stripe is shown in figure 14. The origin of the X-axis is the center of pixel i and the Y L -axis is perpendicular to the light stripe. x i is the position of the real centroid of the bright spot.
Although a different incident angle of the sunlight leads to different spot positions and intensity, it will not change the relative distribution of the light intensity. In other words, the centroiding algorithm is insensitive to the incident angle. So it is reasonable to take the vertical incidence as an example to analyze the impact of the quantization error. In that case, the intensity distribution of the light stripe along the Y L -axis is expressed as: g(x) The light wavelength (λ) is 1000 nm. The pixel spacing (Δx) is 63.5 μm. The distance between the optical mask and the image sensor (h) is 2 mm. The width of slit (w) is 100 μm. Based on equations (6)-(9), the relationship between x i and Δx c within one pixel is plotted in figure 15.
If the curve is extended to both sides, then a curve oscillating periodically with a constant amplitude along the X-axis can be obtained. The following conclusions can be drawn: The minimum quantization error, i.e. 0, occurs when the real centroid of the bright spot is located in the center of one pixel or the middle of two neighboring pixels. Within a pixel, the quantization error first increases then decreases as |x i | grows. The maximum quantization error is 0.043°, which is smaller than the highest sensor resolution. So the quantization error can be safely ignored during the process of error compensation.
Aside from the above analysis, experiments and estimations of those random errors are carried out in the product development process. The results show that they are much smaller than the sensor resolution. Since these error factors are generally independent of each other, their synergetic effect can be evaluated according to the principle of error combination. It is still smaller than the sensor resolution and can be neglected in the error modelling below.
In summary, there are two main factors that lead to significant measurement error of the linear array sun sensor: Structural errors and the refraction effect.

Error compensation model
According to the previous analysis results, the structural errors involve six parameters: δ, b, c, T 1 , T 2 , and T 3 . The refraction effect relates to two parameters: n glass and h 1 . Those eight parameters are defined as the 'intrinsic parameters' of the sun sensor because they are constants and decided by the sensor itself. The error compensation model of the sun sensor is established in the following way.
First, consider the structural errors. For simplicity, define the rotation matrix between O-XYZ and O-X′Y′Z′ to be R and the displacement vector of the two origins to be T. R can be denoted by a, b, and c. The nine components of R are a 11 ~ a 33 : Based on the working principle of the sun sensor and the transformation of O-XYZ and O′-X′Y′Z′, the expression of tanα and tanβ can be derived from the intrinsic parameters and the coordinates of the two spots as follows: T y X a T a T tan tan tan Equations (11) and (12) describe the mathematic model of error compensation which only involves the structural errors. Yet X 1 and X 2 are the coordinates of the two spots without refraction and they cannot be obtained directly. In this paper, they are calculated in an indirect way according to the refraction model in figure 11.
k is a parameter introduced to define l/l′. ′ X 1 and ′ X 2 are the known coordinates of the two spots calculated by the sun sensor. X 10 and X 20 are the coordinates of the intersection between vertical sunlight and the linear imaging array, which can be expressed as follows:  (16) Substitute the variables in equations (11) and (12) with equations (13)- (16), then the two-axis incident angle of sunlight can be expressed as: , , , , , , In equations (17) and (18), δ, b, c, T 1 , T 2 , and T 3 are unknown constants, yet k is a parameter that varies with incident angle θ. That is to say, different α and β lead to a different k. On the basis of the definition of k and equations (4) and (5), k can be solved using a Newton iteration algorithm in the following way.  (20) and ( ) ′ G k is the derived function of G(k). Substitute k in equations (17) and (18) with the above expressions, then the two-axis incident angle of sunlight can be expressed as: T T T n  h  , , , , , , , , , . That is the final mathematic model of error compensation involving all eight intrinsic parameters, which takes both structural errors and refraction effect into consideration. During online processing, the sun sensor calculates these functions to get estimates of the two-axis incident angles of sunlight.

Calibration devices
The eight intrinsic parameters in equations (21) and (22) must be precisely calibrated to guarantee the high measurement accuracy of the sun sensor. The setup of the sun sensor's calibration system is shown in figure 16. The main devices include a sun simulator, a two-axis rotary table, a controller for the rotary table, and a computer. The sun sensor is mounted on the internal frame of the rotary table with the bore sight of the sun simulator pointing towards the optical mask of the sun sensor. Incident angles at even intervals throughout the FOV of the sun sensor can be simulated by turning the internal and external frames to different positions. These positions are predetermined and can be precisely controlled. The sun sensor captures the image, processes it, calculates the centroid coordinates of the two spots ′ X 1 and ′ X 2 , and transfers them to the processing computer. The rotation angle of the internal frame θ 1 and the rotation angle of the external frame θ 2 , as well as ′ X 1 and ′ X 2 , are recorded as calibration data.

Calibration method
Prior to the sensor calibration, the light from the sun simulator should ideally be exactly vertical to the plane formed by the two rotation axes of the rotary table. Besides, the sun sensor coordinate frame should be in accordance with the rotary table coordinate frame. However, these requirements are not likely to be met in practice. As a result, installation errors are inevitably introduced during the calibration process. Parameters relating to the installation errors are called the 'external parameters' of the sun sensor. In fact, the calibration results of the intrinsic parameters can be easily affected by the extrinsic parameters. In order to obtain the accurate intrinsic parameters used in the error compensation model, an integrated calibration model including both the intrinsic and the extrinsic parameters are proposed in this paper. The integrated calibration model is established in the following way. The sunlight vector V r from the sun simulator in the coordinate frame of rotation table can be expressed as: The mounting error between the coordinate frame of the sun sensor and the rotation table are denoted by rotation matrix R sr : where ω x , ω y and ω z denote the rotation angles between the three axes of the two coordinate frames, respectively. The optical mask coordinate frame O′-X′Y′Z′ is defined as the reference coordinate frame of the sun sensor. Therefore, the sunlight vector V r in the coordinate frame of the sun sensor can be denoted by V s : In this paper, ϕ 1 , ϕ 2 , ω x , ω y , and ω z are called the 'extrinsic parameters' the of sun sensor. They describe the exact relationship between the sunlight vector and the sun sensor. The five extrinsic parameters will be calibrated together with the eight intrinsic parameters.
The 'theoretical value' of the two-axis incident angle of sunlight α 0 and β 0 can be expressed by the function of θ 1 and θ 2 , together with the five extrinsic parameters: , , , , , , , , , , , , . Meanwhile, the sun sensor gets an estimate of the incident angles α′ and β′ denoted by the spots coordinates ′ X 1 , ′ X 2 and the eight intrinsic parameters as described in equations (21) and (22). If the sensors are rotated to m different positions, there will be m pairs of equations of the deviation between (α 0 , β 0 ) and (α′, β′), which is called the calibration error. All the intrinsic and extrinsic parameters are included in these equations. The goal of calibration is to solve for their optimal values that minimize the RMS (root mean squared) calibration error over the test sequence.

Calibration algorithm
In this paper, all the intrinsic and extrinsic parameters are optimized with a nonlinear least square algorithm. There will inevitably be coupling between parameters because the number of parameters involved is large. To eliminate the coupling, especially between intrinsic and extrinsic parameters, a multi-sets simultaneous calibration method is proposed in this paper. Take triple-sets simultaneous calibration as an example, i.e. to perform a global optimization on three individual data groups generated by three single-set calibration process described in section 5.1. As a result, intrinsic parameters of high accuracy and good robustness can be obtained. Here is the procedure of the triple-sets simultaneous calibration.
(1) Perform the calibration process in section 5.1 three times and acquire m sets of data each time. After each calibration, re-install the sun sensor onto the rotation table. This is to obtain different extrinsic parameters for each calibration.
(2) Perform a nonlinear least squares fit on these data groups.
ΔS′ is the RMS of the 3m groups of statistic deviation between (α 0 , β 0 ) and (α′, β′). The goal of triple-sets simultaneous calibration is to work out the optimized values of all the parameters that minimize ΔS′ using a nonlinear least square algorithm.

Numerical simulation
To validate the calibration method and algorithm, a numerical simulation is conducted before laboratory testing. First assume one set of intrinsic parameters and three sets of extrinsic parameters to simulate a sun sensor mounted on the rotation table three times. Next, generate three sets of spot coordinates based on the integrated error compensation model throughout the FOV of the sun sensor. Then add random errors ranging from −10 to 10 μm to the spot coordinates. Finally, perform a triple-sets simultaneous calibration and three single-set calibrations. The calibration result of all the parameters and RMS errors are listed in table 2.
The following conclusions can be drawn according to the result: (1) Intrinsic and extrinsic parameters can be separated from each other and the calibration results are all near their set values, despite the noise. This is accurate proof of the validity of the calibration model and the method proposed in this paper. (2) Triple-sets simultaneous calibration is superior to singleset calibration in both precision and robustness, with the coupling between parameters eliminated. This helps build a more accurate error compensation model.

Laboratory calibration
The setup of the calibration experiment is shown in figure 16. The sun sensor is rotated to 139 positions distributed evenly throughout the FOV. For each position, the joint angles (θ1, θ2) of the rotation table and the coordinates of the two bright spots are recorded as calibration data. The sun sensor is re-installed another two times and the test procedures are repeated. Finally perform a triple-sets simultaneous calibration described in section 5.3 on all these calibration data. The calibration results of the extrinsic and intrinsic parameters are shown in tables 3 and 4, respectively. The residual errors are shown in figures 17 and 18. In addition, the estimation errors of γ (the angle between the sunlight and the sensor bore sight) are shown in figure 19, which gives insight into the sensor behavior before and after compensation. With a RMS error of 0.1°, the sun sensor's measurement precision is improved by nearly 30 times.

Conclusion
In this paper, an integrated and accurate error compensation model for a microlinear sun sensor with a V-shaped slit is established, and a parameter calibration method that is unaffected by installation error is proposed. The simulation results prove that the multi-sets simultaneous calibration method is capable of obtaining accurate and robust intrinsic parameters of the sun sensor. The experimental results show that with the help of error modeling and the parameter calibration method, the sun sensor's measurement precision is improved by nearly 30 times throughout the FOV (±60° × ±60°) and meet the requirements of general microsatellites with modest precision and good miniaturization specifications.   Test Sequence Number

Error of γ(°)
After Before