for CW and RTTY
The CW modem uses a PLL algorithm, which is similar to the LM567 tone decoder
chip, but optimized for discrete-math operation in software. The PLL
settings have reasonable defaults, but can be adjusted by the user through the
SMI interface, and the settings persisted in EEPROM. The PLL uses boxcar
integrators instead of the RC-style LPF used by the 567 and similar parts.
These are used to smoothe the I and Q detector outputs which drive the tone
detection. The I detector is used to drive the output state, while the
Q detector is used to control the software VCO.|
The blue LED is illuminated whenever there is CW tone present, allowing visual indication of the tone detection action.
The PLL Q-phase error level, similar to a loop control voltage in a hardware PLL, is separately integrated with an LPF, and then used to drive the tuning indicator. The three tuning LEDs are lit to indicate the frequency of the received signal, with respect to the center frequency of the VCO. If the signal is on-frequency, only the green LED is illuminated. If the signal is slightly off-frequency, the green LED and one yellow LED will be illumuniated together. If the signal is significantly off-frequency, only the yellow LED will illuminate. One yellow LED is provided for each direction of possible frequency error. This provides a quick visual tuning aid without requiring an elaborate waterfall or other such device. Although the PLL jitter causes a small amount of display error at very low SNR, the indicator was reasonably accurate, and more than enough to ensure accurate decoding in a contest environment. Even at low SNR, using the tuning indicator to zero beat another station will get you much closer to their frequency than most people bother to tune by ear.
The PLL approach allowed accurate detection of signals down to around -20dB SNR in wide-band AGWN. This made the algorithm competitive with many of the popular software decoders in use, and was more than enough to serve as an extra set of ears as I worked CW stations.
In order to remain responsive, and with reasonable frequency accuracy, the PLL requires a sampling rate of at least 8kHz. The default configuration in the firmware runs with 11.025kHz.
The RTTY modem uses a frequency discriminator that is driven by two very
narrow resonant filters, each centered on one of the two expected FSK
frequencies. The output of each filter is individually rectified
and run through individual low-pass filters, to measure the amount of
signal within each of the filters. These two levels are then continually
compared with each other, to determine the net frequency deviation of an FSK
signal that is reasonably zero-beat within the filters. The frequency
deviation is obtained by approximating the arctangent of the two signal levels
as if they were X and Y coordinates on a unit circle. Passing the
resulting "angle" through an LPF and a simple hysteresis comparator
provides the restored Baudot bit stream.|
This approach is a bit brute-force, but when I compared it to the SNR performance of discriminators based on various forms of quadrature detector, the two-filter approach was superior by about 10dB, providing solid copy well below the -20dB SNR point in wide-band AGWN. It did require a bit more adjustment to get the filter settings optimal, but in the end, it was able to copy truly weak RTTY signals in contest conditions. I suspect the reason for its performance is the use of resonant filters, rather than band-pass filters, for each of the tone frequencies. While no filter has zero width, the peaks of each of these filters has essentially zero width, making them ideal for frequency discrimination of individual tones.
The downside to using highly selective filters for detecting individual tones is that it becomes difficult to use any of the resulting information to drive a visual tuning indicator. In essence, the signal is either aligned properly with the filters or it is not. The amount of "offset" information available when the signal is off-frequency is quite limited. What I was able to do was to use the error angle to drive the LED trigraph directly, so that the visual indication is that of the RTTY "diddle" on the yellow LEDs. If the signal was within +/- 20Hz of zero beat, the yellow LEDs dance with the incoming tones. If the signal drifts much beyond this, one LED will stop blinking, and with any further deviation, the other LED will stop blinnking. The LED trigraph is essentially reflecting the hysteresis output, providing more of an alighment indicator than a large-offset tuning indicator. As it turns out, this was good enough for contesting purposes, and it is accurate even at very low SNR.
Unlike with CW, FSK doesn't use key-up time as part of the signaling. With CW, the empty space between key-down pulses is significant, and its length determines whether it is part of a letter, part of a word, or the space between words. FSK uses 100% constant key-down to generate all of the signaling elements, with the two keying elements being the two different carriers. This means that the RTTY demodulator can actually detect three distinct states from the received audio. Since the discriminator output is independent of the signal strength, and depends only on the received frequency, the discriminator is either solidly left of center, right of center, or it is floating near the center. This third state, where the deviation is near zero for an extended period of time is the output when there is no FSK signal present. This allows the FSK demodulator to use a software squelch that operates properly even in the presence of fading, whether selective or full-signal.
The RTTY modem exploits this, and provides an optional squelch setting that will mute the received data stream if the discriminator spends a specific amount of time without achieving enough deviation. The squelch operates with a configurable timeout and deviation limit, so that the details can be adjusted by the operator. Since a single bit of sufficient deviation is enough to open the squelch, the de-squelch operation has essentially negative operating time, un-muting the received data stream before the initial byte from another station has completed transmission. This avoids missing the initial characters of a transmission that arrive when the squelch is already closed. The default settings allow the squelch to operate properly even with signals whose SNR is at the lower limit of the discriminator.
Both modems support a number of commands, each of which has the same meaning regardless of
the operating mode. Some of these can be used by a user interface application to
identify which modem is connected, and what commands are supported:|
The CW modem also has a number of commands specific to CW operation.|
When using the LM567 emulation option (see above), there are a set of additional commands that can either adjust or query the operation of the decoder:
The RTTY modem also has a number of commands specific to RTTY operation.|
Modem 2.0 Downloads (Click Here)|
Click the link above to download firmware or software packages. The source is being released under the GPL version 3, which is also available on the download page.
Note to Integrators: If you intend to use any portion of the source code in your own project, please make sure you are familiar with the terms of the GPL3 before you publish or release your product to the public.
Teensy - Open-source microcontroller and embedded development tools.
SparkFun - Supplier for Arduino boards and hardware.
AdaFruit - Another good source for Arduino hardware.