FRS/GMRS Walkie-Talkie Transmitter with SDR Hardware

This example shows how to use the Software Defined Radio hardware device with MATLAB® to implement a walkie-talkie transmitter. 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 transmitted signal can be received by a compatible commercial walkie-talkie.

To run this example, you need a SDR board with an appropriate transmitter daughterboard that supports the UHF 462-467 MHz band (for example, Analog Devices FMComms1). Refer to Support Package Hardware SetupSupport Package Hardware Setup for details on configuring your host computer to work with the SDR Transmitter System object, comm.SDRADIFMCOMMSTransmitter.

This example is designed to work with USA standards for FRS/GMRS operation. The technical specifications for these standards can be found at [ 1 ] and [ 2 ]. Operation in other countries may or may not work.

Overview

Walkie-talkies provide a subscription-free method of communicating over short distances. Although their popularity has been diminished by the rise of cell phones, walkie-talkies are still useful when lack of reception or high per-minute charges hinders the cell phone use. 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. The SDR device in this example will transmit messages at either 462 or 467 MHz, in a manner that is compatible with FRS/GMRS devices.

Initialization

The configureSdrfFRSGMRSTxDemo.mconfigureSdrfFRSGMRSTxDemo.m function initializes some simulation parameters and the getParamsSdrfFRSGMRSTxDemo.mgetParamsSdrfFRSGMRSTxDemo.m function initializes a number of simulation parameters which are output to a structure, frsTx. The fields of this structure are the parameters of the FRS/GMRS transmitter system at hand. You can change the input arguments in a local copy of this file in order to match your hardware.

Type 'help sdrload' to see all possible board names.

% Configure the example to transmit on channel 12 with the CTCSS code 5.
channel = 12;
CTCSSCode = 5;

frsTx = configureSdrfFRSGMRSTxDemo(channel, CTCSSCode)

Load FPGA Image

The example communicates with the SDR board using the SDR Tramsmitter System Object. An image must be loaded into the FPGA. The sdrload function can be be used to download the configuration bit stream to the FPGA via a JTAG cable. Alternatively, the sdrfgensysace function can be used to create a SystemACE configuration image that can be copied to a compact flash card and used to configure the FPGA directly using SystemACE. See sdrloadsdrload and sdrfgensysacesdrfgensysace. To configure the FPGA as part of the Example, the following lines should be uncommented:

sdrload('Device', frsTx.MotherboardName, ...
          'RFBoard', frsTx.RFBoardName);

FRS/GMRS Transmitter

The FRS/GMRS transmitter combines signals from a source and CTCSS tone generator. The script FM modulates the combined signal and sends to the SDR board to transmit over the air.

Source Signals

This example uses a source object, hSource, which is an sdrfFRSGMRSDemoSource System object, to generate data signals for the transmitter. The source signal can be a pure tone sine wave, a chirp signal, or a multimedia file. To switch between these sources, you can change the Signal property of hSource. The source object 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, the sampling rate needs to be converted to 8 kHz; therefore, the sdrfFRSGMRSDemoAudioSource System object class employs a rate conversion filter to convert the 22.5 kHz signal to an 8 kHz signal.

% Create a data source to transmit the contents of a sound file at a
% sampling frequency of 8 kHz.
hSource = sdrfFRSGMRSDemoSource('Sound file', frsTx.SampleRate);

Continuous Tone-Coded Squelch System (CTCSS)

Walkie-Talkies operate on a shared public channel, allowing multiple users to access the same channel simultaneously. The CTCSS [ 3 ] 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 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.

hCTCSS = dsp.SineWave(frsTx.CTCSSAmplitude, ...
  frsTx.ToneFrequencies(frsTx.CTCSSCode), ...
  'SampleRate',       frsTx.SampleRate, ...
  'SamplesPerFrame',  frsTx.SourceFrameLength, ...
  'OutputDataType',   'single');

Interpolator and FM Modulator

The interpolator converts the sampling rate of the sum of the modulating signal and the CTCSS tone to match the SDR hardware sampling rate of 200 kHz. The resampling filter is designed using the MFILT object from the DSP System Toolbox.

hInterpolator = dsp.FIRInterpolator(frsTx.InterpolationFactor, ...
  frsTx.Numerator);

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, Ts represents the sampling time of SDR Transmitter (5 us = 1/200 kHz), and A represents the maximum amplitude of the modulating signal. The current value of K is computed assuming A = 1. It should be changed if you change the signal source maximum amplitude.

hIntegrator = dsp.IIRFilter(...
  'Structure',    'Direct form I', ...
  'Numerator',    1, ...
  'Denominator',  [1 -1]);

SDR

The script communicates with the SDR board using the SDR Transmitter System object. You can supply the IP address of the SDR board as an argument when you construct the object. The IP address can be any address within the same sub-network as the host computer. You set the rest of the properties using name-value pair arguments. This example configures the hSDR object to accept the center frequency as an input argument.

The interpolation factor is set to 500 to provide an integer upscale factor to convert the sampling rate from 8 kHz to 200 kHz using a simple interpolation filter.

hSDR = comm.SDRADIFMCOMMSTransmitter('IPAddress', '192.168.2.2', ...
  'CenterFrequencySource',  'Input port', ...
  'DACRate',                frsTx.RadioDACRate, ...
   'InterpolationFactor',    frsTx.RadioInterpolationFactor)

Running the Example

Turn on your walkie-talkie, set the channel to 12 and the private code to 5. The center frequency is a function of the selected channel number.

% Get the carrier frequency for the selected channel
fc = mConvertChan2FreqFRSGMRSDemo(frsTx.Channel);

You can obtain the information about the daughterboard using the info method of the object. This method returns a structure with fields that specify the valid range of SDR properties. You can verify that the daughterboard covers the UHF frequency range, which is 462 MHZ to 467 MHz.

hwinfo=info(hSDR);

Stream Processing Loop

Generate a data signal for the FRS/GMRS transmitter using the hSource object. Combine the data signal with the CTCSS tone, and pass them through a rate converter to generate a 200 kHz signal. FM modulate the resampled signal and send it to the SDR board. The loop runs for 20 seconds and you should be able to hear the voice from your commercial walkie-talkie device.

try
    % Loop until the example reaches the target stop time.
    timeCounter = 0;
    while timeCounter < frsTx.StopTime

        data = step(hSource);
        dataWTone = data + step(hCTCSS);
        outResamp = step(hInterpolator, dataWTone);

        % FM modulator
        outInteg  = step(hIntegrator, outResamp);
        outMod    = exp(1i*frsTx.FrequencySensitivityGain * outInteg);

        lostSamples = step(hSDR,outMod,fc);

        if lostSamples
            warning('Transmitter lost samples');
        end
        timeCounter = timeCounter + frsTx.SourceFrameTime;

    end
catch ME
    rethrow(ME);
end

Release the SDR resources

release(hSDR); clear hSDR

If you cannot hear the voice, slightly increase the CTCSS amplitude parameter using the Amplitude property of the hCTCSS object, and try again. You can also edit the value of the CTCSSAmplitude field of the frsTxParams structure in getParamsSdrfFRSGMRSTxDemo.mgetParamsSdrfFRSGMRSTxDemo.m.

Conclusion

In this example, you used Communications System Toolbox™ System objects to build an FRS/GMRS transmitter utilizing a SDR hardware device. This example showed that the MATLAB script can generate signals for the SDR hardware device in real time.

Further Exploration

You can set your walkie-talkie channel to one of the 14 channels (numbered 1 to 14) and the private code to either one of the 38 private codes (numbered 1 to 38) or 0, in which case the squelch system is not used and all received messages are accepted. Note that the private codes above 38 are digital codes and are not implemented in this example. Set the channel and private code in the example so that they match the walkie-talkie.

Part 95.637 (Modulation standards) of the FCC wireless standards [ 4 ] state that the maximum frequency deviation (FD) is 2.5 kHz for FRS and 5 kHz for GMRS. In practice, it is usually set to 2.5 kHz for both systems. If the maximum signal amplitude increases, the frequency sensitivity parameter (K) should decrease. Otherwise, the receiving walkie-talkie will not decode the CTCSS code correctly. You can try to use a different signal with different values for K to see if your walkie-talkie works properly. If the FD value is too large, you may not hear anything from your receiver when using a non-zero CTCSS private code. Set the CTCSS code to 0, which disables the squelch system. If you hear the transmitted signal, the CTCSS decoding of the non-zero code is incorrect.

You can reduce the amplitude of the CTCSS tone to determine the minimum amplitude required for your receiver to work correctly.

Appendix

The following scripts and System objects are used in this example.

References

  1. Family Radio Service on Wikipedia

  2. General Mobile Radio Service on Wikipedia

  3. Continuous Tone-Coded Squelch System on Wikipedia

  4. Part 95.637 (Modulation standards) of the FCC wireless standards

Was this topic helpful?