Three-Dimensional Indoor Visible Light Positioning with a Tilt Receiver and a High Efficient LED-ID

Nowadays, indoor visible light positioning (VLP) is one of the hottest technologies in the field of positioning; as a result, a number of algorithms for VLP have been proposed. However, unfortunately, few algorithms can be applied to the case that the receiver is tilted. In order to solve this problem, we developed a three-dimensional indoor VLP algorithm which can work effectively and accurately when the lens is tilted. When the lens is far away from the LED, the image of the LED is approximately regarded as an ellipse, and the distance between the two is obtained through the geometric relationship, and we finally achieve the positioning of the camera by the triangulation algorithm. The quantitative results show an average error of 6.74 cm when the tilt angle is estimated to be within 30°. At the same time, we propose an ID allocation scheme, which can effectively reduce the demand for ID.


Introduction
During the past few decades, with the emergence of various large structures such as underground parking lots and hospitals, high accuracy indoor positioning is in urgent need. Because of strong attenuation and shadowing effects, global positioning systems (GPS) do not work in indoor environments. Therefore, many new methods emerge as the times require. However, some existing technologies such as Ultra Wideband (UWB) [1], infrared (IR), wireless local area network (WLAN), ultrasound, Radio-frequency Identification (RFID) [2], and Zig bee are usually impossible to reconcile price and accuracy. Therefore, a high accuracy LED-based indoor positioning system using visible light communication (VLC) received a lot of attention. With the widespread use of LED, visible light positioning (VLP) without the requirement of extra expensive and complicated equipment is gradually reducing its cost. According to the receiver type, VLP can be divided into two modes: photodiode (PD)-based [3,4] and image-sensor (IS)-based [5,6]. The former has been deeply explored by many effective positioning methods based on PD such as time difference of arrival (TDOA) [7] and received signal strength (RSS) [8]. Additionally, the indoor VLP system based on RSS can be improved by the method of calibrating indoor positioning systems with low efforts mentioned in [9] to get a better positioning effect. It has the advantages of simplicity, reliability, low cost, and so on. However, PD-based positioning can be easily disturbed when there are other light sources and a large noise signal in the environment. Another drawback of PD-based positioning is that the measuring of received signal strength reduces severely in a big communication range. What is more, in [10][11][12][13], PD has a big shortcoming in that its accuracy highly depends on the direction 2 of 13 of the light beam. The IS-based positioning can avoid these problems well. Therefore, IS-based positioning is a promising alternative. What is more, with the rapid development of the smart phone, the IS-based VLP has a broader application prospect. Meanwhile, the PD-based VLP needs the intensity of receiving light obtained from the direct and reflective channel to realize positioning, but the IS-based VLP is immune to reflected light, which helps to reduce the positioning error to some extent.
There are also many indoor positioning methods based on image sensor that have been put forward. In [14], the authors obtained position coordinates using three constant LEDs and an image sensor, and analyzed the relationship between positioning accuracy and pixel resolution, receiver position, and receiving direction. In [15], a method of VLP using three lamps was proposed. The authors proposed the triple-light positioning algorithm based on a situation with three LEDs, which treated the LED-ID detection and recognition problem as a classification problem in the machine learning field and took the machine learning algorithm into consideration, and the average error was 2.14 cm. In [16], the authors used one LED and an image sensor to realize indoor positioning based on machine learning and the rolling shutter mechanism of the Complementary Metal Oxide Semiconductor (CMOS) image sensor, and the average positioning error was 3.19 cm. However, in all these methods, the authors did not correct the positioning results when the receiver was tilted, which meant that the algorithm could not be applied to the actual situation well. Most existing VLP methods did not take the tilting receiver into consideration, which led to great limitations. In [17,18], three LEDs were used to obtain the lens position. In [17], the author developed an indoor positioning system using a tilting image sensor and three LEDs. However, the method requires knowing the tilt angle and could not achieve high positioning accuracy, meaning that it cannot work in most cases. In [18], a machine learning method was used to calculate the lens to the LED center under the condition of receiver tilt, which means a lot of computation. In [19], the method of the indoor positioning system using visible light based on two-LEDs and an image sensor for the different handhold situation of the mobile phone is proposed. However, this method has more restrictions on the location of LED and the height of the lens. In [20], the author proposed a VLP system based on a single LED that exploits the property of circle projection, and an average positioning error of 17.52 cm was realized in an area of 3 m × 3 m. However, due to the existence of mark points, the lighting effect and appearance of LED are affected, and it is difficult to use in some actual scenes such as shopping malls and hospitals. In [17][18][19][20], the authors take the case of receiver tilt into consideration, but each method has certain limitations. However, our proposed method avoids these problems as much as possible, and achieves high precision indoor VLP in the case of receiver tilt, and achieves good results. Table 1 summarizes the experimental studies in which IS was used as a VLP receiver. Another problem that restricts the development of VLP technology is the problem of ID assignment. In previous studies, to distinguish the different LEDs, a unique ID is necessary for each LED. Sometimes LEDs also need to transmit other information, and continuous strings of 0 s or 1 s are not allowed, because they may cause an obvious flicker effect and a reduced lighting effect. Therefore, we must increase the length of an LED ID. The lengthening of ID also causes another problem. Because of the limitations of the LED modulation frequency, all information cannot be captured in one image, which leads to more computation and added complexity. To solve the problem, many coding methods have been put forward. In [21], a high efficient code called "mask XOR code" is proposed, and the authors drew lessons from the use of eight types of mask patterns in the process of QR code development. The result shows that, relative to the Manchester code, the Mask XOR code improved encoding efficiency and reduced the bit error. In [22], the author proposed a LED-ID detection and recognition method based on VLP using a proximity method, and treated the LED-ID detection and recognition problem as a classify problem in the machine learning filed. The result shows that the method could label roughly 1035 unique LEDs. This algorithm works well for small-and medium-sized scenarios, but it is outshone in large scenarios.
In this paper, we studied the indoor VLP technology when the receiver is tilted, and we proposed an image-sensor-based three-LEDs positioning method. Our method can work effectively when the receiver is tilting, which means that it can be applied to more situations. In most cases, we cannot guarantee that our receivers will always be horizontal, so most of the existing VLP methods fail. In order to expand the application scene of the visible light positioning system, it is very necessary to realize the positioning when the lens tilt. Our method can work well whatever the angle of the receiver is, which shows its practicability and superiority. It avoids the use of an angular sensor so that it can reduce the interference of the environment. What is more, the algorithm is simple, and the speed of positioning is improved. At the same time, we studied the problem of how to allocate a large number of LED-ID in a large scene reasonably, and we purposed an ID assignment scheme based on most three-lamp VLP methods. From the perspective of LEDs' arrangement, our method is different from the existing methods, and the improvement in coding efficiency is particularly significant.
The rest of the paper is structured as follows. In Section 2, we present and discuss a high efficient LED-ID and the positioning algorithm. Section 3 presents the system model and an analysis of the obtained results. The conclusions of the paper are in Section 4. Figure 1a shows the proposed VLP system in an indoor environment. In this system, at least three non-collinear circular LEDS are installed on the ceiling. Their coordinates can be labeled as (X j , Y j , Z j ), (j = 1, 2, 3). Each of the LEDs is assigned a unique signal which represents its location and radius and broadcasts its ID frame repeatedly. A CMOS is placed on the floor at any angle as a receiver and obtains the signals transmitted from LEDs by the VLC technique. The CMOS captures pictures by making use of the rolling shutter mechanism and realizes the signals.

Efficient LED-ID
In the process of VLP based on three LEDs, at least three LEDs are captured; as a result, we proposed a coding method based on the relationship between IDs of the LEDs in the captured image. In some large structures such as underground parking and shopping malls, a lot of LEDs are needed for VLP; in most cases, each LED is assigned a unique ID. However, in our system, we divide these LEDs into two types; one is expressed as odd and the other as even, and they are alternated, as shown in Figure 2a.
For the sake of description, we assumed a scenario that required 32 LEDs and divided them into two groups equally; each group consists of eight odd-numbered LEDs and eight even-numbered LEDs. In the first group, the odd-numbered LEDs are numbered 1, 3, . . . , 15, and the even-numbered LEDs are numbered 2, 4, . . . , 16. LEDs of different labels are arranged in the way shown in Figure 2a. The odd-numbered LEDs are in orange, and the even-numbered LEDs are in blue. Then, we need to figure out some other permutations, so that in each of these permutations, the adjacent odd-numbered LEDs and even-numbered LEDs have different numbers. Through analysis, it is found that as long as the order number of the even-numbered LEDs next to the odd-numbered LEDs is different, the nonredundant order number of the odd-numbered LEDs next to the evennumbered LEDs can be guaranteed. Thus, keeping the odd-numbered LEDs in position is accomplished by moving the even-numbered LEDs, to get different permutations. Take the LED number 8 as an example: In the new permutation, if the No.8 LED is not adjacent to the LEDs No.3, No.5, No.7, and No.11, the new position of No.8 LED must be outside the circle. As a result, there are only two ways in which the numbers of neighbors are completely different in the system. In Figure 2b, we give this new permutation.

Efficient LED-ID
In the process of VLP based on three LEDs, at least three LEDs are captured; as a result, we proposed a coding method based on the relationship between IDs of the LEDs in the captured image. In some large structures such as underground parking and shopping malls, a lot of LEDs are needed for VLP; in most cases, each LED is assigned a unique ID. However, in our system, we divide these LEDs into two types; one is expressed as odd and the other as even, and they are alternated, as shown in Figure 2a.
For the sake of description, we assumed a scenario that required 32 LEDs and divided them into two groups equally; each group consists of eight odd-numbered LEDs and eight even-numbered LEDs. In the first group, the odd-numbered LEDs are numbered 1, 3, …, 15, and the even-numbered LEDs are numbered 2, 4, …, 16. LEDs of different labels are arranged in the way shown in Figure 2a. The odd-numbered LEDs are in orange, and the even-numbered LEDs are in blue. Then, we need to figure out some other permutations, so that in each of these permutations, the adjacent odd-numbered LEDs and even-numbered LEDs have different numbers. Through analysis, it is found that as long as the order number of the even-numbered LEDs next to the odd-numbered LEDs is different, the nonredundant order number of the odd-numbered LEDs next to the even-numbered LEDs can be guaranteed. Thus, keeping the odd-numbered LEDs in position is accomplished by moving the even-numbered LEDs, to get different permutations. Take the LED number 8 as an example: In the new permutation, if the No.8 LED is not adjacent to the LEDs No. 3,No.5,No.7,and No.11, the new position of No.8 LED must be outside the circle. As a result, there are only two ways in which the numbers of neighbors are completely different in the system. In Figure 2b, we give this new permutation. When three LEDs are captured by the CMOS, at least one LED represented by odd and one LED represented by even are in it. Because each odd-numbered LED is surrounded by even-numbered LEDs of different sequence numbers in these two regions, we can determine the region by the sequence number of the even-numbered LEDs. Then, we use the existing method to locate in the region. In the normal method, at least five-bit binary numbers are needed to represent 32 LEDs, but with the help of our method, the number of binary numbers has been reduced to four bits; as a result, the coding efficiency has been greatly improved. The encoding efficiency is 20% higher than the theoretical value.
Then, we had a system with 512 LEDs and divided them into eight groups equally, with each group consisting of 64 odd-numbered LEDs and 64 even-numbered LEDs. In each group, the odd-numbered LEDs are numbered 1, 3, . . . , 63, and the even-numbered LEDs are numbered 2, 4, . . . , 64. The first group is arranged as shown in Figure 3. In one group, we divided it into four smaller groups, and labelled them as A, B, C, D. Keeping the oddnumbered LEDs in position, we moved the even-numbered LEDs in the direction of the arrow. Four moves will bring each part back to its original position. In this way, we can get four permutations. Then, we switch the even-numbered LEDs in A, B, C, and D of each of the four arrays in the order shown in Figure 2a; four other new permutations are obtained. In all these eight permutations, even-numbered LEDs next to the same odd-numbered LEDs have different numbers; as a result, regions can be divided into eight parts.
By this means, we reduced the number of binary numbers in a system with 512 LEDs to six bits, which assumes that nine-bit binary is required in the normal mehtod. The coding efficiency is increased by 33%.
When three LEDs are captured by the CMOS, at least one LED represented by odd and one LED represented by even are in it. Because each odd-numbered LED is surrounded by even-numbered LEDs of different sequence numbers in these four regions, we can determine the region by the sequence number of the even-numbered LED. Then, we use the existing method to locate in the region. In the normal method, at least eight-bit binary numbers are needed to represent 256 LEDs, but with the help of our method, the number of binary numbers has been reduced to six bits; as a result, the coding efficiency has been greatly improved.
Depending on the numbers of LEDs in the system, there are different arrangements, and the coding efficiency will also increase with the number of LEDs. When three LEDs are captured by the CMOS, at least one LED represented by odd and one LED represented by even are in it. Because each odd-numbered LED is surrounded by even-numbered LEDs of different sequence numbers in these two regions, we can determine the region by the sequence number of the even-numbered LEDs. Then, we use the existing method to locate in the region. In the normal method, at least five-bit binary numbers are needed to represent 32 LEDs, but with the help of our method, the number of binary numbers has been reduced to four bits; as a result, the coding efficiency has been greatly improved. The encoding efficiency is 20% higher than the theoretical value.
Then, we had a system with 512 LEDs and divided them into eight groups equally, with each group consisting of 64 odd-numbered LEDs and 64 even-numbered LEDs. In each group, the odd-numbered LEDs are numbered 1, 3, …, 63, and the even-numbered

Proposed Three-Dimensional Indoor VLP Algorithm
Because the distance between the LED and the CMOS sensor is usually ten times the size of the LED, which means the object size is small enough with respect to the distance from the CMOS sensor to the object, the LED image can be seen as an ellipse according to the weak perspective projection theorem [23]. Figure 4a shows two steps of the weak perspective projection. The depth, or Z, is replaced by the depth of the centroid of the LED Z c . The plane S1 is the average depth plane, and the plane S2 is the image plane. The first step is a parallel projection of the LED onto the plane S1. As a result of the parallel projection, the projection of the LED is an ellipse, and the length of the long axis of the ellipse is equal to the diameter of the LED. The second step is a perspective projection of that plane onto the plane S2, which is actually a uniform scaling of that plane. The relationship between the long axis of the ellipse on plane S1 and the ellipse on plane S2 and LED radius can be represented by the following formula, where l 1 and l 2 represent the diameter of the lamp and the long axis of LED imaging.
Electronics 2021, 10, x FOR PEER REVIEW 6 of 14 group, we divided it into four smaller groups, and labelled them as A, B, C, D. Keeping the odd-numbered LEDs in position, we moved the even-numbered LEDs in the direction of the arrow. Four moves will bring each part back to its original position. In this way, we can get four permutations. Then, we switch the even-numbered LEDs in A, B, C, and D of each of the four arrays in the order shown in Figure 2a; four other new permutations are obtained. In all these eight permutations, even-numbered LEDs next to the same oddnumbered LEDs have different numbers; as a result, regions can be divided into eight parts. By this means, we reduced the number of binary numbers in a system with 512 LEDs to six bits, which assumes that nine-bit binary is required in the normal mehtod. The coding efficiency is increased by 33%.
When three LEDs are captured by the CMOS, at least one LED represented by odd and one LED represented by even are in it. Because each odd-numbered LED is surrounded by even-numbered LEDs of different sequence numbers in these four regions, we can determine the region by the sequence number of the even-numbered LED. Then, we use the existing method to locate in the region. In the normal method, at least eight-bit binary numbers are needed to represent 256 LEDs, but with the help of our method, the number of binary numbers has been reduced to six bits; as a result, the coding efficiency has been greatly improved.
Depending on the numbers of LEDs in the system, there are different arrangements, and the coding efficiency will also increase with the number of LEDs. Then, we can obtain where f and r are the focal length of the CMOS sensor and the radius of the circular LED. According to this proportional relation, we can calculate the distance between the center of the LED and the CMOS sensor. The geometrical scheme between the LED and lens is shown in Figure 4b. The lens plane is the plane which the lens is on. Point A is the center of the image sensor, and line segment AB is perpendicular to the lens plane. Point E is the center of the lens, and line segment EF is perpendicular to the image plane. Point E is the center of the ellipse; according to the principle of pinhole imaging, the points A, E, and G are on the same line. Vector n is a normal vector directed outwards from the surface of the lens. As the lens plane and the image plane are parallel, line AB is parallel to line EF. According to geometry, Electronics 2021, 10, 1265 7 of 13 triangle ABE and triangle EFG are similar triangles. As a result, the sides of these two triangles have the following relationships: where l1 and l2 represent the diameter of the lamp and the long axis of LED imaging Then, we can obtain = 2 where and are the focal length of the CMOS sensor and the radius of the cir LED. According to this proportional relation, we can calculate the distance betwee center of the LED and the CMOS sensor.  The geometrical scheme between the LED and lens is shown in Figure 4b. The plane is the plane which the lens is on. Point A is the center of the image sensor, and segment AB is perpendicular to the lens plane. Point E is the center of the lens, and line ment EF is perpendicular to the image plane. Point E is the center of the ellipse; accordi the principle of pinhole imaging, the points A, E, and G are on the same line. Vector n In Equation (1), we have obtained Combining Equations (2) and (3), we obtain The distance d in the right triangle ABE can then be calculated as We can also get the equation which contains d, where (x, y, z) is the coordinate of the LED. As shown in the Figure 5, with at least three non-collinear circular LEDs installed on the ceiling, these three LEDs are the same height, and thus we can obtain the following system of equations,

Analysis of Focal Length
The camera's auto focus function makes the focal length change slightly, but this small change is an important factor that cannot be ignored in the deviation of the positioning result. Therefore, while positioning, the focal length needs to be corrected at different heights. Before positioning experiments, we measured the focal length values at different known heights according to ( 1 − )/ = / .We keep the camera placed horizontally, get radius "a" of the imaging circle, and then get f. Through experimental data, we construct a mathematical model of focal length: = 0 + × ( 1 − ). For an environment where the problem cannot be solved by modifying the code, the above method is no longer needed.

Simulation and Analysis
We conducted an experiment to verify the performance of the proposed system and verified our theoretical analysis. Four LEDs are installed in a cube frame. According to our algorithm, the three complete lights in the picture will be automatically selected as LEDs used in the positioning algorithm. If all four LEDs can be fully recognized, the three lights closest to the image center are selected as the positioning LEDs, so as to reduce the impact of lens distortion on positioning accuracy. Our experimental facility is shown in Figure 6, and the system parameters are listed in Table 2. Subtracting Equations (9) and (10) from Equation (8), and leaving the unknowns on the left-hand side, we obtain Equations (11) and (12) can be rewritten in the matrix form as Equation (13), where d 1 , d 2 , and d 3 can be acquired according to Equation (6). Substituting the already obtained x and y into Equation (8), z is obtained,

Analysis of Focal Length
The camera's auto focus function makes the focal length change slightly, but this small change is an important factor that cannot be ignored in the deviation of the positioning result. Therefore, while positioning, the focal length needs to be corrected at different heights. Before positioning experiments, we measured the focal length values at different known heights according to (Z 1 − Z)/R = f /r. We keep the camera placed horizontally, get radius "a" of the imaging circle, and then get f. Through experimental data, we construct a mathematical model of focal length: f = f 0 + k × (Z 1 − Z). For an environment where the problem cannot be solved by modifying the code, the above method is no longer needed.

Simulation and Analysis
We conducted an experiment to verify the performance of the proposed system and verified our theoretical analysis. Four LEDs are installed in a cube frame. According to our algorithm, the three complete lights in the picture will be automatically selected as LEDs used in the positioning algorithm. If all four LEDs can be fully recognized, the three lights closest to the image center are selected as the positioning LEDs, so as to reduce the impact Electronics 2021, 10, 1265 9 of 13 of lens distortion on positioning accuracy. Our experimental facility is shown in Figure 6, and the system parameters are listed in Table 2.

Parameter Value
Position of the four LED s (x, y, z)/m  We did ten trials at each positioning point to avoid random error. The resulting positioning effect is shown in Figure 7a,b.
As shown in Figure 7, the result of the experiment performs well. By comparing the results obtained with the actual data, we can get the maximum error of 5.03 cm and the average error of 2.76 cm. Figure 8 gives the cumulative distribution function (CDF) of the positioning error. In the CDF plot, we can see that 90% of the points are less than 4.287 cm.
Then, we held the phone away from the LEDs and tilted it 20 degrees, 30 degrees, and 40 degrees. The result of the VLP is shown in Figure 9. The test error is shown in Table 3. As shown in Figure 7, the result of the experiment performs well. By comparin results obtained with the actual data, we can get the maximum error of 5.03 cm and average error of 2.76 cm. Figure 8 gives the cumulative distribution function (CDF) o positioning error. In the CDF plot, we can see that 90% of the points are less than cm. Then, we held the phone away from the LEDs and tilted it 20 degrees, 30 deg and 40 degrees. The result of the VLP is shown in Figure 9. The test error is shown in T 3.  As shown in Figure 7, the result of the experiment performs well. By comparing the results obtained with the actual data, we can get the maximum error of 5.03 cm and the average error of 2.76 cm. Figure 8 gives the cumulative distribution function (CDF) of the positioning error. In the CDF plot, we can see that 90% of the points are less than 4.287 cm. Then, we held the phone away from the LEDs and tilted it 20 degrees, 30 degrees, and 40 degrees. The result of the VLP is shown in Figure 9. The test error is shown in Table  3.     Figure 10 gives the cumulative distribution function (CDF) of positioning error. The positioning results when the lens is tilted are slightly worse than the positioning results when the lens is horizontal. This is mainly because when the lens is tilted, we approximate the image of the LED as an ellipse, but in fact it is not a standard ellipse, so a large error is introduced. The positioning results when the lens is tilted are slightly worse than the positioning results when the lens is horizontal. This is mainly because when the lens is tilted, we approximate the image of the LED as an ellipse, but in fact it is not a standard ellipse, so a large error is introduced.

Conclusions
In this paper, we developed a new three-dimensional indoor VLP method with a tilt receiver. Based on this algorithm, VLP can be used in more situations. We test in the cases of horizontal and inclined, respectively, and achieved good experimental results. The positioning accuracy can reach 2.76 cm when the receiver is horizontal, and the average error is 8.54 cm when the receiver is tilt is at 20, 30, and 40 degrees. We also proposed an ID assignment scheme which can improve the coding efficiency greatly.

Conflicts of Interest:
The authors declare no conflict of interest.

Conclusions
In this paper, we developed a new three-dimensional indoor VLP method with a tilt receiver. Based on this algorithm, VLP can be used in more situations. We test in the cases of horizontal and inclined, respectively, and achieved good experimental results. The positioning accuracy can reach 2.76 cm when the receiver is horizontal, and the average error is 8.54 cm when the receiver is tilt is at 20, 30, and 40 degrees. We also proposed an ID assignment scheme which can improve the coding efficiency greatly.

Conflicts of Interest:
The authors declare no conflict of interest.