The Receiver Part
Last month you got me started on building a direct sequence spread spectrum (DSSS) transceiver. You covered the transmitter discussion and promised to come back to explain the receiver and error-correction code.
Signed, Bob the (Radio) Builder
Wise Guy: The receiver section of the narrowband Amplitude Shift Keying (ASK) transmitter is simple: a circuit tuned to 2437 MHz. Once the antenna receives the signal, it downconverts it to baseband by injecting a local oscillator signal of 2437 MHz into the electrical mixer. There are many variations on this receiver design including double heterodyne designs that rely on downconversion to fixed intermediate frequency (IF) stages, like the 400 kHz IF stage in FM receivers.
If you've followed along so far from last month, congratulations! You've just built an AM radio station that operates within the industrial, scientific, and medical (ISM) band.
As you'll recall from last time, DSSS mixes bits— i.e., interleaves spreading code—with the data. So once the message has been sent and the receiver has detected the pulses coming in, it needs to extract the data from the code.
The received signal resembles audio "white noise," but can be filtered out to recover the original data by again multiplying the same pseudorandom (PN) sequence that was used at the transmit side. This process, known as "de-spreading," mathematically constitutes a correlation of the transmitted PN sequence with the receiver's assumed sequence. (Fourier transform buffs will recognize that we are performing a variant of an inverse transform on the receive side.)
For de-spreading to work correctly, the transmit and receive sequences must be synchronized. This requires the receiver to sync its sequence with those of the transmitter using a timing search process. Fear not; this apparent drawback can actually be a significant benefit. If the sequences of multiple transmitters are synchronized with one other, the synchronizations the receiver must make can be used to determine relative timing, which, in turn, can be used to calculate the receiver's position if the transmitters' positions are known.
A method for reconstructing the transmitted data sequence is shown in Figure 1. Notice that the receiver must use the same PN code sequence as the transmitter and that it must sync with the transmitter by stepwise shifting until the payload data stream results. Sequences resulting from multipath propagation from the same transmitter can be identified and combined to improve transmission quality. (There is a slick way of performing clock recovery and PN code extraction on unknown data sequences, but that's for another day).
Figure 1. The fast PN code is XOR d with the data sequence (payload). Notice that a few errors may be corrected in the signal-reconstruction process
A Few Final Details
Usually a few synchronization bits precede the actual message, and serve to wake the asynchronous communication channel. Since this is a homegrown DSSS transceiver, you can choose whatever preamble/sync code you want. Remember that its function is to wake up the receiver and get the edge detection/clock signal synchronized with the transmitted frame. The sync frame used in 802.11 is shown in Figure 2. Notice all of those preamble and header bits; they're at the start of every frame transmitted. And you wondered why the laptop battery lasts for only about an hour when you have WiFi on! (Repeat after me: Every bit transmitted in a battery-powered system brings the battery closer to death.)
Figure 2. The actual bit configuration in a transmitted 802.11 frame