## 5 Communication Protocol Design
### PHY Layer Description
#### 5.1.2 Spreading and Modulation  
The proposed communication protocol employs direct-sequence spread spectrum (DSSS) modulation technique, where the transmitted data symbols are multiplied by an independent pseudo-noise (PN) sequence of \"chips\", as shown in Figure 5. The spreading PN sequence has a significantly higher chip rate than the original data symbols; therefore, it expands the bandwidth of the original signal accordingly. When the same PN sequence is precisely known and timed at the receiver, its correlation with the received noise-like signal allows for the reconstruction of the original data symbols; see Figure 5. When properly constructed PN-codes are assigned to the sensor nodes, the communication links in the base station vicinity effectively allow for an asynchronous DS-CDMA scheme.  
In the proposed DS-CDMA protocol, each sensor node is allocated a unique PN spreading sequence, and the same sequences are known _a priori_ at the base station. Two fundamental performance measures of the PN sequences are their auto-correlation and cross-correlation functions. The auto-correlation function is defined as:  
\[R_{i}(\tau)=\int\limits_{-N_{c}T_{c}}^{N_{c}T_{c}}\mathrm{PN}_{i}(t)\cdot \mathrm{PN}_{i}(t-\tau)dt \tag{1}\]  
where \(N_{c}\) is the length of the PN sequence and \(T_{c}\) is the chip period. The auto-correlation function is expected to have a high correlation peak at \(\tau=0\) and close to zero value at \(\tau\
eq 0\), to enable accurate detection of the spread signals. Meanwhile, the cross-correlation function is defined as:  
\[R_{i,j}(\tau)=\int\limits_{-N_{c}T_{c}}^{N_{c}T_{c}}\mathrm{PN}_{i}(t)\cdot \mathrm{PN}_{j}(t-\tau)dt \tag{2}\]  
where \(N_{c}\) is the length of the PN sequence and \(T_{c}\) is the chip period. \(R_{i,j}(\tau)\) should have close to zero value for any \(\tau\), as it measures the agreement between sequences, \(\mathrm{PN}_{i}\) and \(\mathrm{PN}_{j}\), and, consequently, characterizes the possible interference between the two transmitters using these spreading sequences.  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline
**PHY Header** & \multicolumn{3}{c}{**PHY Payload**} \\ \hline Sync pattern & Source address & Sequence number & Payload data & CRC 16 \\
2 & 1 & 2 & 15 & 2 \\ \hline \hline \end{tabular}
\end{table}
Table 2: Frame format and field lengths (bytes) used in the experimental protocol.  
Figure 5: Simplified block diagram of a direct-sequence spread spectrum (DSSS) transceiver.  
PN sequences with outstanding auto-correlation and good cross-correlation properties can be generated using simple linear-feedback shift registers. The class of exactly \(2^{L}-1\) long sequences, which can be produced by L-stage shift registers, are called maximal-length sequences or, simply, _m-sequences_[24]. The proposed DS-CDMA protocol relies on m-sequences that have a corresponding period of \(2^{11}-1\). The nodes are assigned one of the 176 distinct m-sequences to spread the synchronization and data symbols. The PN-generator is reset only at the start of the transmission, as opposed to after each data symbol. Therefore, the transmitter associates a different chip pattern with each symbol, and the receiver follows this same \"long-code\" approach for PN sequence generation in order to detect and despread the received signal. The binary data symbols are differentially encoded before spreading, and the spread chips are modulated onto the carrier using differential binary phase-shift keying (DBPSK modulation).