## 4 Implementation
### Experimental SNR Measurement  
SNR was measured to ensure that the SNR criterion of 10 dB required to achieve a BER of 10\({}^{-4}\) in OOK modulation is satisfied. In the experiments, a small LED (5V DC-0.2 W) was used to measure SNR. Figure 3 shows the devices used in this measurement. A Point Grey rolling-shutter camera was set up with exposure times of 2000, 3000, and 4000 us, and a distance of 20-50 m. A small LED (5 V- 0.2 W, 2 mm in diameter) was used in a model of the system.  
Figure 4 demonstrates the SNR computation of the 20, 30, 40, and 50 m scenarios. The red line represents pixel amplitude when there is no dominant light signal from the LED, which is considered background noise. Furthermore, for the divergence of distance, the blue line illustrates pixel amplitude when there is a dominant light signal from the LED. From this, the SNR (in dB) can be expressed as:  
\[SNR_{dB}=20\log\left(\frac{\sqrt{\frac{1}{n}\sum\limits_{i=0}^{n-1}\left|A_{-} on\right|^{2}}}{\sqrt{\frac{1}{n}\sum\limits_{i=0}^{n-1}\left|A_{-} off\right|^{2}}}\right), \tag{3}\]  
where _A_on_ denotes the measured pixel amplitude with the LED turned on, _A_off_ is the measured pixel amplitude with the LED turned off, \(i\) is the i-th of measured samples and \(n\) is the number of measured samples.  
The received pixel amplitude at the camera will be larger over a short communication distance, and vice versa. Another critical factor that affects the SNR calculation is shutter speed, otherwise known as the camera's exposure time. Figure 5 illustrates the relationship between pixel SNR and pixel intensity for different exposure times (2000, 3000, and 4000 us). The SNR was measured based on changes in exposure time and distance. With long distance, the received signal power is low, lead to the SNR measurement is small, and the BER performance increases. However, the SNR measurement can be controlled by changing the exposure time, which is shown in Figure 5. The image sensor operates as a low-pass filter; so, a greater exposure time will smoothen the high-tone signal. When the exposure time increases, the communication bandwidth decreases, thus reducing the total noise power spread over the bandwidth. This proves that if the exposure time is set longer, the SNR result is higher.  
Figure 3: Devices for Signal to Noise (SNR) measurement.  
In summary, the LOS link always guarantees the minimum SNR of 10 dB that is required for a BER value of \(10^{-4}\), which is lower than that with single-carrier modulation. The SNR can be increased to more than 34 dB by controlling the camera's exposure time. However, the decrease in communication bandwidth must be carefully considered to guarantee system performance. Furthermore, higher exposure times increase the probability of fuzzy LED states. To mitigate the higher ratio of fuzzy states, OOK modulation must employ forward error correction or a smart decoding algorithm (such as an artificial intelligence decoder).  
Figure 4: SNR measurement with rolling-shutter camera at 20, 30, 40, and 50 m with 3000 \(\upmu\)s exposure time setting.  
Figure 5: The measurement result of pixel SNR versus pixel intensity.