# Design of Indoor Visible Light Communication PAM4 System
## 2 Theoretical Basis
Figure 1: The waveform diagram of the PAM4 signal. Assuming that the transmission channel is equivalent to the AWGN channel. From the above analysis, it can be seen that the average BER \(P_{e}\) is [19]:  
\[P_{e}=\frac{1}{4}\sum_{m=1}^{4}P[error|m]=\frac{1}{4}\Bigg{[}6Q\Bigg{(}\sqrt{ \frac{2d^{2}}{N_{0}}}\Bigg{)}\Bigg{]}=\frac{3}{2}Q(\sqrt{\frac{2\epsilon_{avg} }{5N_{0}}})=\frac{3}{2}Q(\sqrt{\frac{2}{5}SNR}) \tag{7}\]  
where \(P[error|m]\) is the probability of error at each level, \(N_{0}\) is the noise power, \(SNR\) is the signal-to-noise ratio (SNR), and the expression of the Q function is:  
\[Q(x)=\frac{1}{\sqrt{2\pi}}\int_{x}^{\infty}e^{-\frac{2}{\pi}}dt \tag{8}\]  
Assuming that the channel noise model is a Gaussian mixture model (GMM), its conditional probability density function (PDF) is [20]:  
\[s_{m}(t)=A_{m}p(t),\ 0\leq t\leq T,\ m=1,2,3,4 \tag{1}\]0  
where \(s_{i}\) is the transmitted symbol, \(\varepsilon_{b}\) is the average bit energy, \(\mu_{nj}\) is the mean, \(\sigma_{nj}\) is the variance, \(\varepsilon_{j}\) is the weight value of the GMM, then the BER is [20]:  
\[s_{m}(t)=A_{m}p(t),\ 0\leq t\leq T,\ m=1,2,3,4 \tag{1}\]1  
SNR is given by Equation (11) [20]:  
\[s_{m}(t)=A_{m}p(t),\ 0\leq t\leq T,\ m=1,2,3,4 \tag{1}\]2  
Assuming that the channel noise model is a lognormal model, if the transmitted signal energy is \(E_{b}\), the received signal energy is \(h^{2}E_{b}\). At this time, the SNR at the receiving end becomes \((h^{2}E_{b})/N_{0}\). The BER can be obtained by Equation (7) [19]:  
\[s_{m}(t)=A_{m}p(t),\ 0\leq t\leq T,\ m=1,2,3,4 \tag{1}\]3  
where \(h\) reflects the channel state and conforms to the lognormal distribution. Since \(h\) is a random variable, there is:  
\[s_{m}(t)=A_{m}p(t),\ 0\leq t\leq T,\ m=1,2,3,4 \tag{1}\]4  
where \(f\) (\(h\)) refers to the PDF of the lognormal distribution. In the VLC system, the transmitting end must maintain synchronization with the receiving end [21]. The data must be sent in the format of a frame after being encoded by PAM4. The system inserts a Barker code sequence as a frame synchronization signal at the head of the PAM4 data, thereby forming a PAM4 data frame and then sending the data out. The format of the PAM4 data frame is shown in \[s_{m}(t)=A_{m}p(t),\ 0\leq t\leq T,\ m=1,2,3,4 \tag{1}\]5 The data segment of PAM4 contains multiple sets of PAM4 data. The function of the protection segment is to provide the system with enough time to calculate the relevant parameters. In this paper, gray coding and 8b/10b coding are added before the PAM4 coding. The purpose is to minimize the error rate of symbols during transmission according to the coding rules of gray coding and 8b/10b coding. 8b/10b coding encodes 8 bits data into 10 bits data. By increasing the redundancy of information, the coding is more reliable, and the security of information transmission is improved. When there is data input at the receiving end, the data is first stored in the buffer, and then the data is judged. When the data is equal to the frame synchronization data, it is considered that the frame header is detected, and the data can be received. This process is called frame synchronization. Frame synchronization is realized by designing a Barker code correlator. In order to successfully decode the original data source, the clock data must be restored, which requires extracting the clock signal from the PAM4 signal to make a correct judgment on the data at the sampling time. This process of recovering the clock signal is called bit synchronization. After bit synchronization recovery using the lead-lag bit synchronization method, PAM4 decoding is performed according to the clock signal to recover the source data.