## 3 Theoretical Analysis of Proposed Smart Home Control System
### Smart Home Control with Directional Angle Data Assisted 3D Indoor VLP Algorithm  
Security is a major concern in several application scenarios, particularly in residential environments. The traditional RF-based communication technologies such as Wi-Fi, Bluetooth, and ZigBee face a security challenge since the signal can penetrate through walls, allowing someone outside the house premises to control the devices inside. If the smart devices are managed with position-based authorization, i.e., the user can only control the device by being at a specific area inside the house defined via precise 3D position coordinates, the security of the system can be significantly improved. In addition, high-precision positioning can further help in simplifying control by using the orientation angle of a smartphone for distinguishing multiple identical smart devices in close proximity. For instance, the user can directly point the phone at the target device to establish a connection based on the current location and orientation.  
Inspired by the two propositions above, we propose a smart home control system based on an orientation-supported 3D positioning algorithm [35] to further increase the precision of indoor positioning. The proposed 3D positioning algorithm relies on the principle of projective geometry, where the smartphone camera takes a picture of the LED lightbul in the ceiling and the corresponding projection of the light on the image is used to determine the relative position of the smartphone w.r.t the LED light [36], as shown in Figure 5. The positioning algorithm follows the principle of the pinhole camera model, which is given as follows:  
\[\mathrm{s}\begin{bmatrix}\mathrm{u}\\ \mathrm{v}\\ 1\end{bmatrix}=\mathrm{K}\begin{bmatrix}\mathrm{X}_{\mathrm{C}}\\ \mathrm{Y}_{\mathrm{C}}\\ \mathrm{Z}_{\mathrm{C}}\end{bmatrix} \tag{4}\]  
where \(\mathrm{X}_{\mathrm{C}}\), \(\mathrm{Y}_{\mathrm{C}}\), and \(\mathrm{Z}_{\mathrm{C}}\) represent 3D coordinates of the LED light w.r.t the camera coordinate frame. The camera transforms these 3D points into 2D px coordinates u and v, with s being the scaling factor, on the image plane using the transformation matrix \(\mathrm{K}\). The matrix \(\mathrm{K}\), called the camera intrinsic matrix, can be expanded to rewrite Equation (4) as follows:  
\[\mathrm{s}\begin{bmatrix}\mathrm{u}\\ \mathrm{v}\\ 1\end{bmatrix}=\begin{bmatrix}\mathrm{f}_{\mathrm{x}}&\mathrm{v}&\mathrm{u}_{ 0}&0\\ 0&\mathrm{f}_{\mathrm{y}}&\mathrm{v}_{0}&0\\ 0&0&1&0\end{bmatrix}\begin{bmatrix}\mathrm{X}_{\mathrm{C}}\\ \mathrm{Y}_{\mathrm{C}}\\ \mathrm{Z}_{\mathrm{C}}\end{bmatrix} \tag{5}\]  
where \(\mathrm{f}_{\mathrm{x}}\) and \(\mathrm{f}_{\mathrm{y}}\) are the focal lengths of the x-axis and y-axis, respectively; \((\mathrm{u}_{0},~{}\mathrm{v}_{0})\) are the center coordinates of the image plane; and \(\mathrm{y}\) is the skew coefficient between the x-axis and  
Figure 4: Simulated waveforms of designed VLC-based LED lightbulb.  
y-axis. Since the information on the LED light's position is in the 3D world coordinates (\(X_{\text{W}}\), \(Y_{\text{W}}\), \(Z_{\text{W}}\)), a transformation needs to be performed to convert from the world frame to the camera frame. This transformation is performed by inserting a 3 \(\times\) 3 rotation matrix \(\mathbf{R}_{3\times 3}\) and a 3 \(\times\) 1 translation matrix \(\mathbf{T}_{3\times 1}\) in Equation (5) as follows:  
\[z_{\text{c}}\begin{bmatrix}u\\ v\\ 1\end{bmatrix}=\begin{bmatrix}f_{\text{x}}&\gamma&u_{0}&0\\ 0&f_{\text{y}}&v_{0}&0\\ 0&0&1&0\end{bmatrix}\begin{bmatrix}R_{3\times 3}&\overbrace{x_{0}}^{T_{3 \times 1}}&\begin{bmatrix}X_{\text{w}}\\ Y_{\text{w}}\\ Z_{\text{w}}\end{bmatrix}. \tag{6}\]  
It is important to note that the translation matrix \(\mathbf{T}_{3\times 1}\) given in Equation (6) represents the 3D coordinates of the camera w.r.t