# Designing an Adaptive Underwater Visible Light Communication System +
## 7 Experimental Setup  
The real-time hardware setup is illustrated in Figure 13. MATLAB generates a 16-bit PN sequence, which is modulated with a 2.4 MHz tone. This signal is then upsampled and converted into an analog signal using the D/A converter of the USRP. The USRP is equipped with two low-frequency (LF) daughterboards: LFTx1, which is connected to the Li-Fi transmitter, and LFRx1, which is linked to LFTx2 of the receiver USRP. The Li-Fi transmitter is mounted on an assembly, as shown in Figure 13, and the assembly includes a positional servo motor (SG90M) that can be used for non-line-of-sight communication in the future. The Li-Fi system, after adding a DC bias, transmits the signal through a 1-watt blue LED. The experiment was conducted using a water tank (dimensions: 36 cm \(\times\) 26 cm \(\times\) 22.5 cm). The tank is covered with a black screen to prevent interference from external light sources. On the receiving end, the Li-Fi receiver is mounted on the same SG90M servo motor. The Li-Fi system removes the DC bias and sends the signal to LFRx2, which downsamples the signal by a factor of 16. The downsampled signal is then digitized by an A/D converter and received by MATLAB.  
The system is programmed such that the Li-Fi receiver is initially positioned at 90\({}^{\circ}\) (directly facing the transmitting station). The receiver then changes its position to 30\({}^{\circ}\)  
Figure 12: Flow chart for receiving signal [4].  
followed by 40\({}^{\circ}\), 60\({}^{\circ}\), and 80\({}^{\circ}\), respectively. During this time, power is calculated at each position, storing the values in an array for later comparison to determine \(Pmax\). The receiver then shifts back to 90\({}^{\circ}\), calculates the power, and subsequently moves to 150\({}^{\circ}\) (with other angles being 140\({}^{\circ}\), 120\({}^{\circ}\), and 100\({}^{\circ}\)), where it calculates and stores the power in the array as well.  
Meanwhile, the transmitter remains in wait mode. MATLAB at the receiver compares the power at various angles (e.g., 30\({}^{\circ}\), 90\({}^{\circ}\), and 150\({}^{\circ}\)), determining that the maximum power occurs at 90\({}^{\circ}\). The receiver then realigns to 90 degrees and generates the ACK signal, which is modulated with the same 2.4 MHz tone. This ACK signal is transmitted back to LFRx1 of the transmitting USRP via LFTx2 of the receiving USRP. The transmitter receives the acknowledgment and calculates the power. If there is any synchronization issue, the program may halt.  
The transmitter then compares the power of the received ACK signal with a predefined threshold. If the power is sufficient, the transmitter proceeds to send the preamble and the payload of the 4-PPM, 223.2 kHz signal. The preamble is retransmitted to account for any offset introduced due to differences in the master clock rates (100 MHz) of the two USRPs. The received signal's frequency is observed to be 2.4046 MHz instead of 2.4 MHz due to this offset (as shown in Figure 12) [4]. After offset compensation, the signal is demodulated and filtered to recover the baseband PPM signal.  
PPM demodulation is achieved using a matched filter, which identifies peaks by cross-correlating the PPM signal with a pulse of the same width as the PPM pulse. These peaks are then used to decode the PPM signal. The regenerated signal is compared to the actual transmitted signal to calculate the BER.