## Instrumentation
### Decoder  
The BPSK decoder was separate from the detector and host environment. It was implemented and evaluated in MathWorks MATLAB 7.0 before it was translated into C++ for optimization as a standardone utility. The major steps required to successfully decode a JSATS acoustic microtransmitter message are (1) estimate the most likely message locations and compute the corresponding phase angles; (2) decode the candidate messages and validate the messages; (3) compute the time difference of arrivals between different hydrophones for selected messages, given the time of arrival of each decoded message at the hydrophones. Figure 5: Correlation of an impulse noise that does not pass the JSATS detector: **(a)** wave; **(b)** cross-correlation. Figure 6: Correlation of a candidate signal that passes the JSATS detector. The detailed steps for estimating the most likely message locations and computing the corresponding phase angles are as follows:  
1. Locate all carrier peaks and their locations in the time-domain waveform. Insert or delete peaks as necessary to maintain cycle accuracy (_i.e._, one peak for each of the 6-sample cycles). 2. Compute signal energy using the peaks and correlate the signal energy with one message size (310 cycles) to obtain total energy within one message. 3. Search for predefined number of energy peaks (usually set to 5) from the energy obtained from step 2. 4. Locate the start of signals corresponding to the energy peaks. These signal starts are the most likely message locations. 5. Compute the signal-to-noise ratio (SNR) of the time-domain waveform around each of the most likely message locations. 6. Screen signals above the predefined minimum SNR. 7. Estimate frequency and phase of signal using statistical properties of the phase distribution. 8. Convert the time-domain waveform to phase data. 9. Convert the phase data into bipolar bits by comparing the phase data to a decision threshold (each bit represents one carrier cycle). The detailed steps for decoding the messages after converting the time-domain waveform into bipolar phase bits are:  
1. Identify valid message locations from the bipolar phase bits data by correlating phase data with the Barker code. 2. Convert the valid message phase bits into symbol bits using the relationship of 10 carrier cycles per symbol. 3. Locate the Barker code in symbol data by checking the message synchronization character. 4. Compute and check the CRC of the message (a valid CRC is zero). 5. Compute the phase margin of the message
6. Repeat for the other five phase shifts (total of six possible phase shifts with six samples per cycle)
7. Repeat with a split-phase clipping level, effectively doubling the number of phase offsets checked. 8. Output the decoded code, start time, SNR, phase margin, and other information after converting decoded code into hexadecimal code. As an example, the acquired waveform shown in Figure 3 is selected to demonstrate how the different components function in the decoding process. The most likely message locations are then computed by searching for windowed energy peaks (Figure 6). There is only one possible energy peak at sample number 9,798 with an energy number of 714 or a SNR of 12.9 dB, and the corresponding likely message start is sample number 7,938. All other energy peaks have SNRs lower than 0 dB. The most likely message is then extracted by including 1,800 samples prior to the most likely message start and 3,500 samples after the most likely message. The phase angle of the message [Figure 7(a)] is computed using a matched filter and converted to bipolar clipped phase [Figure 7(b)]. The clipped phase is then correlated with the Barker code to locate the Barker code. After the clipped phase bits are converted to symbol bits and the synchronization character is located, the binary value of the decoded message is then obtained: 0111 0010 0111 1010 1010 1100 1111 1101. The corresponding hexa-decimal code is identified as 727 AACFD; 72 is the Barker code, 7 AAC is the ID, and FD is the CRC.