N1NKM's
Chattering smiley
PSK31 Theory Page

N1NKM


NOTICE: This page was copied from "The Internet Archive" for a page that no longer exists.
Here is the link to the last known copy of this page: WAYBACK MACHINE ARCHIVE
All rights to this content remain those of the original author. I only present it here because it is worthy of preservation.

PSK31 Theory of Operation

By Peter Martinez G3PLX

PSK31 Fundamentals

  1. Background: The PSK31 philosophy
  2. The QPSK mode
  3. Information Coding: Varicode
  4. Contact Information

Background: The PSK31 philosophy.

PSK31 is the result of my belief that the present batch of "data" modes have left a gap in amateur radio operating, the gap that was previously filled by AMTOR or even traditional RTTY, in which two or more operators chat to each other on an open channel. Modes such as packet radio, Pactor, and others, are highly complex, are unsuited to multiway conversations, and in particular, the long block lengths introduce an unacceptable delay in the processing of text such that even normal conversation is unpleasant and quick-break question/answer sessions are impossible. The move to automated unattended message forwarding has left a gap in the person-to-person communication field, and PSK31 is an attempt to remedy this situation with a simple but efficient code structure coupled with the narrowest possible bandwidth, and with only enough error-correction to match typical typing-error rates, and with no time-consuming synchronisation, changeover, and ARQ processes.

The 31 baud BPSK modulation system used in PSK31 was introduced by SP9VRC in his SLOWBPSK program written for the EVM. Instead of the traditional frequency-shift keying, the information is transmitted by patterns of polarity-reversals (sometimes called 180-degree phase shifts). This process can be thought of as equivalent to sending information by swapping-over the two wires to the antenna, although, of course, the keying is more usually done back in the audio input into the transceiver. A well-designed PSK system will give better results than the conventional FSK systems that amateurs have been using for years, and is potentially capable of operation in much narrower bandwidths than FSK. The 31 baud data rate was chosen so that the system will just handle hand-sent typed text easily.

There is a problem with PSK keying which doesn't show up with FSK, and that is the effect of key-clicks. We can get away with hard FSK keying at moderate baudrates without generating too much splatter, but polarity reversals are equivalent to simultaneous switching-off of one transmitter and switching-on of another one in antiphase: the result being keyclicks that are TWICE AS BAD as on-off keying, all other things being equal. So if we use computer logic to key a BPSK modulator such as an exclusive-or gate, at 31 baud, the emission would be extremely broad. In fact it would be about 3 times the baudrate wide at 10dB down, 5 times at 14dB down, 7 times at 17dB down, and so on (the squarewave Fourier series in fact)

The solution is to filter the output, or to shape the envelope amplitude of each bit which amounts to the same thing. In PSK31, a cosine shape is used. To see what this does to the waveform and the spectrum, consider transmitting a sequence of continuous polarity-reversals at 31 baud. With cosine shaping, the envelope ends up looking like full-wave rectified 31Hz AC. This not only looks like a two-tone test signal, it IS a two-tone test signal, and the spectrum consists of two pure tones at +/-15Hz from the centre, and no splatter. Like the two-tone and unlike FSK, however, if we pass this through a transmitter, we get intermodulation products if it is not linear, so we DO need to be careful not to overdrive the audio. However, even the worst linears will give third-order products of 25dB at +/-47Hz (3 times the baudrate wide) and fifth-order products of 35dB at +/-78Hz (5 times the baudrate wide), a considerable improvement over the hard-keying case. If we infinitely overdrive the linear, we are back to the same levels as the hard-keyed system.

There is a similar line of reasoning on the receive side. The equivalent to "hard-keying" on the receive side is a BPSK receiver which opens a gate at the start of a bit, collects and stores all the received signal and noise during the bit, and then "snaps" the gate shut at the end. This process gives rise to the receive-side equivalent of key-clicks, namely sidelobes on the receiver passband. So, although this "integrate-and-dump" method is 100% efficient in the task of sorting out signal from noise, it will only reject signals by 10dB at 3 times the baudrate wide and so on, the same spurious rejection figures that we got as spurious emission figures for the transmit side. The PSK31 receiver overcomes this by filtering the receive signal, or by what amounts to the same thing, shaping the envelope of the received bit. The shape is more complex than the cosine shape used in the transmitter: if we used a cosine in the receiver we end up with some signal from one received bit "spreading" into the next bit, an inevitable result of cascading two filters which are each already "spread" by one bit. The more complex shape in the receiver overcomes this by shaping 4 bits at a time and compensating for this intersymbol interference, but the end result is a passband that is at least 64dB down at +/-31Hz and beyond, and doesn't introduce any inter-symbol-interference when receiving a cosine-shaped transmission.

Note that the transmitter and receiver filters have to be "matched" to each other for the ISI performance to be right. Some systems like this use a pair of identical receive and transmit filters which are matched. If I did this and someone else came along wanting to improve the performance, they would have to get everyone else to change their transmit filters. I have therefore chosen to use the simple cosine shape for the transmitter and match that in the receiver. This leaves the way open for others to develope better receivers without new transmitters being incompatible with old. This is slightly different from the SP9VRC approach.

To summarise: PSK31 has been designed not only to give all the weak-signal-in-white-noise advantages that PSK has to offer, but to go further and optimise the performance in the presence of other signals, to reject them on receive and not to interfere with them on transmit. PSK31 is therefore ideally suited to HF use, and would not be expected to show any advantage over the hard-keyed integrate-and-dump method in areas where the only thing we are fighting is white noise and we don't need to worry about interference.

The QPSK mode

In December 1997, PSK31 introduced the QPSK mode. In this mode, instead of just keying by phase reversals, that is, 180-degree phase-shift, an additional pair of 90 and 270 degree phase-shifts are possible. If you thought of BPSK as reversing the polarity of the signal, then QPSK can be thought of as two BPSK transmitters on the same frequency but 90 degrees out of phase with each other. By thinking of the receiver as being two BPSK demodulators at 90 degrees, we have two channels sharing the same frequency, but of course, with only half the transmitter power in each. We therefore have twice the bit-rate but at 3dB less signal-to-noise ratio. We could use this feature to transmit data at twice the speed with 3dB less noise margin.

The PSK31 philosophy is to stay at the speed needed to handle hand-keyed text, so why do we condider QPSK at all? The answer is that we can use the extra capacity to reduce the error-rate while keeping the bandwidth and the traffic speed the same. Note that because we have a 3dB SNR penalty with QPSK, any error-correction scheme we introduce has to be at least good enough to correct the extra errors which result from the 3dB SNR penalty, and preferably a lot more, or it will not be worth doing. By doing simulations in a computer, and tests on the bench with a noise generator, it has been found that when the bit error-rate is less than 1% with BPSK, it is much better than 1% with QPSK and error-reduction, but when the BER is worse than 1% on BPSK, the QPSK mode is actually worse than BPSK. Therefore, if we are dealing with radio paths where the signal is just simply very noisy, there is actually no advantage to QPSK at all!

However, all the tests we have done on the air show that QPSK with the chosen error-reduction scheme is better than BPSK, except where we have deliberately attenuated the signal to make it artificially weak. Typical radio circuits are far from being non-fading with white noise. Typical radio paths have errors in bursts rather than randomly spread, and error-reduction schemes can give useful benefits in this situation in a way that cannot be achieved by anything we can do in the linear part of the signal path. With the code used in PSK31, a 5:1 improvement is typical, but it does depend on the kind of path being used. For this reason it is worth keeping both modes available and remembering that there may be times when one mode works betterthan the other and others when the reverse will be the case. When comparing PSK31 with other modes, remember that the switch between "straight" and "error-corrected" modes in PSK31 is done with both the bandwidth and the data-rate remaining the same. In most other systems that can switch, either the bandwidth or the data rate changes when the system switches, and the figures for error-rate improvement can be misleading unless they are carefully compared.

The error-reduction code chosen is one of a type known as convolutional codes. The code systems used in the past have been block codes, where each character is a fixed-length code, and a fixed number of extra bits are added to make a longer block, and this longer block is capable of correcting errors within itself. These extended blocks are then transmitted as a serial bitstream. In a convolutional code, the characters are converted to a bitstream and then this bitstream is itself processed to add the error-reduction qualities. There is no relationship between the boundaries between characters and the error-reduction process. Since the channel errors are also not related in any way to the character boundaries, convolutional codes are better suited to serial links than block codes, which were originally designed for protecting errors in memory banks and similar structures.

It is not quite correct to refer to the convolutional code system as "error-correcting", since the raw data is not actually transmitted in it's original form and therefore it makes no sense to talk about it being corrupted by the link and corrected in the decoder. In PSK31, the raw data is transformed from binary (1 of 2) to quaternary (1 of 4) in such a way that there is a precisely known pattern in the sequence of quaternary symbols. In the code used in PSK31, the pattern of quaternary symbols is derived from a run of 5 consecutive data bits. For example, if we label the four phase-shifts as A, B, C, and D, and suppose that the transmitter sends continuous A's when the raw datastream is sending continuous 0's. Because the convolutional encoder works on a run of five bits, when the datastream sends ..000010000..., the transmitter actually sends ..AAAADCCBDAAAA...,  that is, each binary bit to be transmitted results in a unique 5-symbol sequence, overlapping with the sequences from adjacent bits, in a predictable way which the receiver can use to estimate the correct sequence even in the presence of corruptions in parts of the sequence.

The decoder, known as a Viterbi decoder after the man who thought of it, is not really a decoder at all, but a whole bank of parallel encoders, each fed with one possible "guess" at the transmitted data sequence. The outputs of these parallel encoders are all compared with the received symbol-stream. Each time a new symbol is received, the encoders need to add an extra bit to their sequence guesses and consider that the new bit might be a 0 or a 1. This doubles the number of sequence guesses, but a clever technique allows half of all the guessed sequences to be discarded as being less likely than the other half, and this means that the number of guesses being tracked stays constant. After a large number of symbols have been received, the chances of a wrong guess at the first symbol tends to zero, so the decoder can be pretty sure that the first bit was right and it can be fed to the output. In practice this means that the decoder always outputs decoded data bits some time after they have been received. This delay in PSK31 is 20 bits (640mS) which is long enough to make sure that the decoder has done a good job, but not so long that it introduces an unacceptable delay in displaying the received text.
.

Information Coding: Varicode

This is a description of the variable-length coding used in the 31.25 baud BPSK system.

The normal asynchronous ASCII coding used on the original version of this system by SP9VRC, and indeed the asynchronous system used for transmission of RTTY for the last 50 years, uses one start-bit, a fixed number of data-bits, and one or more stop-bits. The start-bit is always the opposite polarity to that of the stop-bit. When no traffic is being sent the signal sits in stop polarity. This enables the receiver to start decoding as it receives the edge between the stop-signal and the start-bit.

One disadvantage of this process is that if, during a long run of traffic, an error occurs in either a stop-bit or a start-bit, the receiver will lose synchronisation, and may take some time to get back into sync, depending on the pattern of following characters: in some situations of repeated characters the receiver can even stay in a false sync. for as long as the repeated pattern persists.

Another disadvantage of this system arises when, as will be the case for normal amateur radio contacts, the traffic being sent consists of plain language. In all languages there are some characters which occur more often that others and there are some which may hardly ever be used. In morse code this is used to advantage by using short codes for the common letters and longer codes for less-common ones. In the asynchronous start-stop system all characters are neccesarily the same length, and so the overall speed of transmission of plain-language is not as fast as a variable-length code would be.

The variable-length code used in the BPSK system overcomes both these disadvantages, and works in the following way.

1. All characters are separated from each other by two consecutive 0 bits.
2. No character contains more than one consecutive 0 bit.

It follows from this that all characters must begin and end with a 1.

With such a code, the receiver detects the end of one code and the beginning of the next by detecting the occurence of a 00 pattern, and since this pattern never occurs inside a character, the "loss of sync" problem that occurs with asynchronous systems can never occur. The 00 gap between characters is equivalent to the gap between letters in morse code in this respect, and in a similar way allows the possibility of a variable-length code system.

The variable-length coding used in the BPSK system was chosen by collecting a large volume of English language ASCII text files and analysing them to establish the occurrence-frequency of each of the 128 ASCII characters. Next a list was made of all the binary patterns that meet the above rules, namely that each pattern must start and end with a 1, and must not contain more than 1 zero in a row. This list was generated by computer, starting at the shortest. The list was stopped when 128 patterns had been found. Next the list of ASCII codes, in occurence-frequency order was matched to the list of binary patterns, in length order, so that the most frequently-occuring ASCII codes were matched to the shortest patterns, and that completed the variable-code alphabet. To finish the job, a simple calculation was made to predict the average number of bits in typical plain language text transmitted by this code, taking into account the 00 gap between characters. The result was between 6 and 7 bits per character. This compares very favourably with 9 bits per character for the asynchronous system.

The actual alphabet is shown below, shown in ASCII order starting with NUL and ending with DEL.

NUL 1010101011
SOH 1011011011
STX 1011101101
ETX 1101110111
EOT 1011101011
ENQ 1101011111
ACK 1011101111
BEL 1011111101
BS  1011111111
HT  11101111
LF  11101
VT  1101101111
FF  1011011101
CR  11111
SO  1101110101
SI  1110101011
DLE 1011110111
DC1 1011110101
DC2 1110101101
DC3 1110101111
DC4 1101011011
NAK 1101101011
SYN 1101101101
ETB 1101010111
CAN 1101111011
EM  1101111101
SUB 1110110111
ESC 1101010101
FS  1101011101
GS  1110111011
RS  1011111011
US  1101111111
SP  1
!   111111111
"   101011111
#   111110101
$   111011011
%   1011010101
&   1010111011
'   101111111
(   11111011
)   11110111
*   101101111
+   111011111
,   1110101
-   110101
.   1010111
/   110101111
0   10110111
1   10111101
2   11101101
3   11111111
4   101110111
5   101011011
6   101101011
7   110101101
8   110101011
9   110110111
:   11110101
;   110111101
<   111101101
=   1010101
>   111010111
?   1010101111
@   1010111101
A   1111101
B   11101011
C   10101101
D   10110101
E   1110111
F   11011011
G   11111101
H   101010101
I   1111111
J   111111101
K   101111101
L   11010111
M   10111011
N   11011101
O   10101011
P   11010101
Q   111011101
R   10101111
S   1101111
T   1101101
U   101010111
V   110110101
W   101011101
X   101110101
Y   101111011
Z   1010101101
[   111110111
\   111101111
]   111111011
^   1010111111
_   101101101
`   1011011111
a   1011
b   1011111
c   101111
d   101101
e   11
f   111101
g   1011011
h   101011
i   1101
j   111101011
k   10111111
l   11011
m   111011
n   1111
o   111
p   111111
q   110111111
r   10101
s   10111
t   101
u   110111
v   1111011
w   1101011
x   11011111
y   1011101
z   111010101
{   1010110111
|   110111011
}   1010110101
~   1011010111
DEL 1110110101
 

Contact Information

The source code which you may have with this distribution is freeware, provided it is used only for amateur purposes. If you have suggestions for improvements, or you find bugs, please report them back to me and do not broadcast your own modifications or bug-fixes

Peter Martinez G3PLX
High Blakebank Farm
Underbarrow
Kendal
Cumbria LA8 8BN
United Kingdom
 

N1NKM HOME PAGE