Walkie-Talkie Transmitter Using Analog Devices AD9361/AD9364
This example shows how to use the Xilinx® Zynq-Based Radio Support Package with Simulink® to implement a walkie-talkie transmitter. The transmitted signal can be received by a compatible commercial walkie-talkie. Alternatively, the signal can be received by the companion Walkie-Talkie Receiver with Analog Devices™ AD9361/AD9364 example if you have a second SDR platform.
Refer to the Getting Started documentation for details on configuring your host computer to work with the Support Package for Xilinx® Zynq-Based Radio.
Walkie-talkies provide a subscription-free method of communicating over short distances. There are a number of different standards used around the world. This example uses Simulink to implement two of these standards: Family Radio Service and Personal Mobile Radio 446.
- Family Radio Service (FRS): Operates on 14 channels at frequencies around 462 MHz and 467 MHz. The channel spacing is 25 kHz. FRS radios are commonly found in the North and South America. More details on FRS can be found in [ 1 ].
- Personal Mobile Radio 446 (PMR446): Operates on 8 channels around 446 MHz. The channel spacing is 12.5 kHz. PMR446 radios are commonly found in Europe. More details on PMR446 can be found in [ 2 ].
Both FRS and PMR446 use analog frequency modulation (FM) with a maximum frequency deviation of +-2.5 kHz. They also use a Continuous Tone-Code Squelch System (CTCSS) to filter unwanted signals at the receiver. CTCSS is implemented in this example.
This example allows the transmitted audio to be a continuous tone, a chirp signal or voice from an audio file. The audio sample rate is always 8 kHz.
Before running the example, ensure you have performed the following steps:
1. Configure your host computer to work with the Support Package for Xilinx® Zynq-Based Radio. See Getting Started for help.
- Some additional steps may be required if you want to run two radios from a single host computer. See Setup for Two Radios - One Host for help.
2. Ensure that you have a suitable receiver. This example is designed to work in conjunction with any of the following possible receivers:
- The Walkie-Talkie Receiver Using Analog Devices AD9361/AD9364 MATLAB® example
- The Walkie-Talkie Receiver with Analog Devices AD9361/AD9364 Simulink example
- A commercial FRS/PMR446 radio
3. Ensure that your receiver is set to the same protocol, channel and CTCSS code.
Running the Example
Before running the example, make sure that walkie-talkie protocol is set to a standard that is legal for use in your location.
Once both the transmitter and receiver are active, you should hear the transmitted audio on your receiver. By default, a voice signal is transmitted.
You can configure various settings that control the model using the Model Parameters block. Except for the walkie-talkie protocol, all of the parameters can be changed while the model is running.
Transmitter Design: System Architecture
The top level of the model is shown below.
The system has been split up into a number of subsystems, each performing a specific task:
- Audio Generator: Generate the audio signal to be transmitted
- CTCSS Generator: Generate the CTCSS tone
- Software Interpolator: Upsample the 8 kHz audio signal to 528 kHz
- FM Baseband Modulator: FM modulate the audio signal
- SDR Transmitter: Send the modulated signal to the SDR hardware for further upsampling and transmission
Each subsystem is explored in more detail below.
The Audio Generator subsystem is where the audio signal that is audible at the receiver is generated. A simple Multiport Switch block allows the audio source to be switched during model execution. The audio signal can be a single tone, a chirp or audio played from a multimedia file.
The CTCSS Generator subsystem is where the CTCSS tone is generated. The Continuous Tone-Coded Squelch System (CTCSS)[ 3 ] allows receivers to filter out received signals that did not originate from the target transmitter. The transmitter generates a tone between 67 Hz and 250 Hz and transmits it along with the audio 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 a 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 because 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.
The Software Interpolator subsystem is where the 8 kHz audio signal is upsampled to the radio baseband rate of 528 kHz. It uses an FIR Interpolator block, the filter coefficients of which are generated in the helper function zynqRadioWalkieTalkieTxHelperAD9361AD9364SL_SimParams.m.
FM Baseband Modulator
The FM Baseband Modulator subsystem is where the upsampled audio signal is frequency modulated. This example implements the FM modulator using a simple digital IIR filter as an integrator. The frequency sensitivity gain is used to control the modulation. It is related to the frequency deviation by the formula:
frequencySensitivityGain = frequencyDeviation * (2*pi*Ts) / A
where peakFrequencyDeviation is 2.5 kHz, Ts is the sampling period of the SDR transmitter, and A represents the maximum amplitude of the modulating signal i.e. the audio signal. This example assumes the generated audio is normalized and therefore has a peak amplitude of 1.
See [ 4 ] for more information on frequency modulation.
The SDR Transmitter subsystem is where the radio baseband data is passed to the SDR hardware via an ZC706 and Analog Devices FMCOMMS2/3/4 Transmitter block. The SDR hardware is configured to use input ports for the RF center frequency. Using an input port for these parameters allows them to be updated while the model is running. The desired center frequency is dependent on the channel selected in the Model Parameters block.
Transmitter Design: System Sample Rates
The system has two different sample rates:
- The audio sample rate, 8 kHz
- The SDR hardware baseband rate, 528 kHz
The upsample by 66 from 8 kHz to 528 kHz is done in software. The upsample to 528 kHz is necessary for two reasons:
- By Carson's rule, the approximate passband bandwidth of the desired FM signal is 2*(frequencyDeviation + peakAudioFrequency). In this example, that equates to a signal bandwidth of 2*(2.5e3 + 4e3) = 13 kHz. This means we need to use a sample rate greater than 13 kHz.
- The sample rates in software have no relation to the real world transmission rates. The actually transmission rate is determined entirely by SDR basebasnd sample rate. To make the software sample rates meaningful, the sample rates at the software/hardware interface must match. For the AD9361/AD9364, one of the possible baseband sample rates that is a multiple of 8 kHz and greater than 13 kHz is 528 kHz. Using an integer upsample factor means a smaller interpolation filter (fewer taps) can be used.
Things to Try
To modify the example, double click on the Model Parameters block. Most of the parameters can be altered while the model is running. Some possible modifications include:
- Try changing the channel.
- Try changing the CTCSS code. Note that the receiver will not play the transmission out loud unless it has the same CTCSS code, or it has CTCSS disabled by setting the code to 0.
- Try changing the audio source. You can send a voice recording, a single tone or a chirp signal.
- Try replacing the From Multimedia File block in the Audio Generator subsystem with an Audio Device Reader block from the Audio System Toolbox™. This would allow you to transmit audio captured from a microphone in real time.
This example implements a walkie-talkie transmitter in Simulink. You can also view the equivalent system implemented using MATLAB in the Walkie-Talkie Transmitter Using Analog Devices AD9361/AD9364 using MATLAB example.
Troubleshooting the Example
If you cannot hear the transmitted signal on your receiver, try the following:
- Make sure that the transmitter and the receiver are set to the same channel and CTCSS code.
- Disable CTCSS on the receiver by setting the code to 0. Note that codes higher than 38 use Digital Coded Squelch, which is not implemented in this example.
General tips for troubleshooting SDR hardware can be found in Xilinx Zynq-Based Radio Processing Errors and Fixes.
List of Example Helper Files
This example uses the following helper files
- zynqRadioWalkieTalkieTxHelperAD9361AD9364SL_SimParams.m: returns a structure of variables used to control constant parameters in the model.
- zynqRadioWalkieTalkieTxHelper_ModelParamsMask.m: controls the Model Parameters mask and updates the model depending on the parameters supplied in the mask.
- zynqRadioWalkieTalkieHelper_CTCSSCode2Tone.m: converts a CTCSS code to a frequency.
- zynqRadioWalkieTalkieHelper_Channel2Frequency.m: converts a channel number to an RF frequency.
- sdrzWalkieTalkieHelper_voice.wav: the audio file used when the audio source is set to 'Audio file'.