This model shows a walkie-talkie transmitter and receiver. The specific radio standard that this example follows is FRS/GMRS (Family Radio Service / General Mobile Radio Service) with CTCSS (Continuous Tone-Coded Squelch System). The example implements USA standards for FRS/GMRS operation. The technical specifications for these standards can be found at  and .
|On this page…|
Walkie-talkies provide a subscription-free method of communicating over short distances. Although their popularity has been diminished by the rise of cell phones, they are still useful when lack of reception or high per-minute charges hinders the use of cell phones.
Modern walkie-talkies operate on the FRS/GMRS standards. Both standards use frequency modulation (FM) at 462 or 467 MHz, which is in the UHF (Ultra High Frequency) band. To enable real-time operation, this example model does not upconvert to any RF frequency, but instead performs all its processing at complex baseband.
This is the top-level block diagram of the model:
For a signal source, you can choose between a sound file, a pure tone, or a chirp via the Model Parameters GUI. You can further parameterize the tone and the chirp signal through the GUI.
Set the transmitter and receiver CTCSS codes in the Model Parameters GUI in the model to any value from 1 to 38. You can also set the receiver code to 0, in which case no squelch system is used and all received messages are accepted. (Note that the private codes above 38 are digital codes and are not implemented in this example.) To start, make sure that the transmitter and receiver CTCSS codes match. Run the model and see if the decoded CTCSS code matches your specified value, and that you can hear an audio output. If not, try slightly decreasing the "Average CTCSS decoding amplitude threshold" parameter. You can change the parameters in the Model Parameters GUI without stopping and restarting the model.
The following sections provide more detail about the processing in the FRS/GMRS transmitter and receiver.
The following block diagram illustrates the subsystem of sources for the model:
The source signal can be a pure tone sine wave, a chirp signal, or a multimedia file. To switch between these sources, double-click the Model Parameters block to bring up a GUI. This GUI also allows you to set the pure tone frequency or the chirp signal target/sweep time (which controls the duration of the chirp signal). This example works properly with tones as low as 500 Hz and as high as 4 kHz.
When using a multimedia file, a resampler converts the sample rate from 22050 Hz to 8 kHz. This provides a convenient intermediate sample rate from which to resample to the transmitter output 200 kHz rate.
Walkie-talkies operate on a shared public channel, allowing multiple users to access the same channel simultaneously. The CTCSS  method filters out undesired communication or interference from these other users by generating a tone between 67 Hz and 250 Hz and transmitting it along with the source signal. The receiver contains logic to detect this tone, and acknowledges a message if the detected tone matches the code setting on the receiver. The receiver filters out the tone, so that the user does not hear it.
The CTCSS tone generator generates a continuous phase sine wave with frequency corresponding to the selected private code. The amplitude of the tone is usually 10%-15% of the maximum amplitude of the modulating signal. Note that since the maximum amplitude of all the source signals is 1, the default amplitude of 0.15 for the CTCSS tone corresponds to 15% of the modulating signal's maximum amplitude.
An FIR Interpolator block converts the sampling rate of the sum of the modulating signal and CTCSS tone to a suitably high rate of 8 kHz * 25 = 200 kHz. This rate ensures that the FM modulated signal does not suffer from any aliasing. The resampling filter is designed using the MFILT object from the DSP System Toolbox™ product.
The following block diagram illustrates the FM Baseband Modulator subsystem:
This example implements the FM modulator using a simple digital IIR filter as an integrator. The frequency sensitivity parameter (K) in the model is related to the frequency deviation (FD) by K=FD/A*(2*pi*Ts), where FD is 2.5 kHz, A represents the maximum amplitude of the modulating signal, and Ts represents the inverse of the sampling rate at the output of the interpolator, or 1/(200 kHz) = 5e-6 seconds. The current value of K is computed assuming A = 1. It should be changed if you change the signal source maximum amplitude.
The following block diagram illustrates the FRS-GMRS Receiver subsystem:
The Automatic Gain Control block is the first block that processes the received signal. It processes the signal to ensure that the average magnitude of the samples is about 1.
The channel selectivity filter is the next block. If the incoming signal is from an adjacent channel, a low pass channel separation filter will reduce its power significantly. The gap between adjacent channels is 25 kHz, which means the baseband bandwidth is at most 12.5 kHz. Thus, we choose the cutoff frequency to be 10 kHz.
Next, a channel selector computes the average amplitude of the filtered signal, and if it is greater than a threshold (set to a default of 10%), the channel selector determines that the received signal is from the correct channel and it allows the signal to pass through. In the case of an out-of-band signal, although the channel separation filter reduces its magnitude, it is still FM modulated and the modulating signal will be present after FM demodulation. To reject such a signal completely, the channel selector outputs zero.
The output goes into the FM Demodulator block, where a simple differentiation operation performs the demodulation.
After FM demodulation, the FIR Decimation block converts the sampling rate to 8 kHz. This is one of the native sample rates of the audio device on your host computer.
The CTCSS  decoder computes the power at each CTCSS tone frequency using the Goertzel algorithm  and outputs the code with the largest power into the Decision block. The Goertzel algorithm is used because it provides an efficient method to compute the frequency components at predetermined frequencies (namely, the tone code frequencies used by FRS/GMRS).
The Decision block compares the decoded code with a preselected code and sends the signal to the audio device if the two codes match. When the preselected code is zero, it indicates no squelch system is used and the decision block passes the signal at the channel to the audio device no matter which code is used.
Before the audio device, a high pass filter with a cutoff frequency of 260 Hz is used to filter out the CTCSS tones (which have a maximum frequency of 250 Hz) so that they are not heard.
The To Audio Device block is set up by default to output to the current audio device in your system preferences.
The example sets its transmitter and receiver CTCSS codes to be identical. However, you can change them while the example runs. If they do not match, you should not hear any audio output. The exception is if you set the receiver code to 0, in which case no squelch system is used and you should hear audio output.
You can also change the values of the transmitter CTCSS amplitude and the receiver average CTCSS decoding amplitude threshold. The default transmitter CTCSS amplitude of 0.15 is consistent with the CTCSS spec . If you set the decoding threshold to be much greater than the transmitter CTCSS amplitude, then the channel selector should reject the received signal, even if the CTCSS codes match. In that case, you should not hear any audio output.
If the sound output of the model exhibits regular gaps, the model may not be running in real time. In that case, you can run it in Accelerator mode to achieve real-time performance.
The CTCSS decoding computes the DTFT (Discrete-Time Fourier Transform) of the incoming signal using the Goertzel algorithm and computes the power at the tone frequencies. Since the tone frequencies are very close to each other (only 3-4 Hz apart) the block length of the DTFT should be large enough to provide enough resolution for the frequency analysis. However, long block lengths cause decoding delay. For example, a block length of 16000 will cause 2 seconds of delay, since the CTCSS decoder operates at an 8 kHz sampling rate. This creates a tradeoff between detection performance and processing latency. In an actual FRS walkie-talkie system, the optimal block length may depend on the quality of the transmitter and receiver, the distance between the transmitter and receiver, and other factors. You are encouraged to change the block length in the initialization function by navigating to the getParamsCommFRSGMRSDemo function and changing the value of the FRSParams.DecodeBlockSize field. This will enable you to observe the tradeoff and find the optimal value for the transmitter/receiver pair in the model.