## 3 System Architecture
### Match Filter  
To highlight the advantages of the matched filter with the COOK scheme, we will compare the matched filter with zero crossing filter (which we used in the conventional COOK scheme). Similar to its name, the zeros crossing filter distinguishes the ON/OFF levels in the receiver side based on the zero levels as the threshold level. This method will have a good performance if the SNR of the system is high, but with the SNR lower, the distinction between ON/OFF statuses is unclear as shown in Figure 2. Then if we depend on the zero levels to define the threshold level, the performance of the system is reduced. From that, we can conclude that the zero crossing filter becomes ineffective with the low signal to noise system. In Section 4, we demonstrate the relationship of SNR, exposure time of camera, and communication distance. With the same exposure time, the SNR will be reduced if the communication distance is high. From that, we need another technique instead of the zero crossing filter to improve the communication distance and the system performance.  
The matched filter is a filter technology achieved by comparing a template signal with the real signal to determine the template signal in the real signal. The matched filter, which is one of the linear filter technologies, optimizes the SNR in the appearance of additive random noise. Matched filters are  
\begin{table}
\begin{tabular}{c c} \hline
**RLL Code** & **Proposed Preamble (SF)** \\ \hline Manchester & 011100 \\
4B6B & 0011111000 \\
8B10B & 0000111111111100000 \\ \hline \end{tabular}
\end{table}
Table 1: Coding scheme and proposed preamble.  
Figure 2: An experimental result of COOK signals within a rolling image with low signal-to-noise ratio (SNR).  
widely used in almost all wireless communication systems, such as mobile communications and radar systems to maximize the SNR of the system; these filters increase the system performance. In the IEEE 802.15.7-2018 standard [25], the matched filter is also recommended for use in the OCC system. The performances of the matched filter and zero-crossing filter in the COOK scheme have been compared in Section 4. In this paper, we used the matched filter for two purposes: detect preamble and decode data.  
To detect preamble positions, the received signal is multiplied with the known preamble signal via the convolution algorithm as Equation (1). The preamble positions in each image are the peak of the resulting signal as Figure 3. From that, we can explore payload positions.  
\[(\mathrm{f*g})(\mathrm{t})\triangleq\int\limits_{-\infty}^{+\infty}\mathrm{f} (\mathrm{\tau})\mathrm{g}(\mathrm{t}-\mathrm{\tau})\mathrm{d}\mathrm{\tau} \tag{1}\]  
After the detect preamble, to decode data, we also used the matched filter to decode data to improve the system performance. By create known patterns as Figure 4, the received signal is multiplied with the known preamble signal via the convolution algorithm. From convolution results, we can know that: which patterns are the most like the received signal? From that, it is easy to verify the value of signals (0 or 1). Same with the Manchester code, we can create 16 patterns of 4B6B code to decode data.