homelist of postsdocs about & FAQ

Baudot/Murray/ITA2 codes

This post is a proof that losing internet for some time can in fact boost your productivity. Or at least it made me go back to an old and well forgotten project of mine. Back in ?2005? I was very excited about acquiring an MW or HW band transciever and trying get in contact with some radio amateurs. Unfortunately I only ended up experimenting with my home-made pirate FM 88-108 MHz transmitter hooking it up to my PC's sound card and using some radio amateur PSK bursting software to transmit text to another PC, which's sound card was connected to an FM receiver. It did actually work pretty well, tranferring data at about 300~600 baud.

As I do not have internet for a while now, I have decided to spend some time on home-made FSK encoding program. I know there is a plenty of choice when it comes to radio amateur software, but this helped me to slightly rub-off my rust in C and have some fun too.

Baudot/Murray/ITA2 codes, also commonly referred to as five-unit codes are practically the second evolution of the Morse code and were extensively used back in the old days in telegrapy, systems also known as TELEX, machine programming/execution punched cards and many other ingenious well forgotten systems nowadays. Basically a five-bit code is used for alphabet encoding. Apart from the standard (capital letter only) alphabet characters, these systems include also some special symbols as, carriage return, line feed, blank etc...

This page is a good source giving a brief overview of the ITA2 system, however for convenience I am listing the ITA2 (International Telegraph Agency 2) encoding table I used here:

 Character 5-bit encoding Character 5-bit encoding A 11000 B 10011 C 01110 D 10010 E 10000 F 10110 G 01011 H 00101 I 01100 J 11010 K 11110 L 01001 M 00111 N 00110 O 00011 P 01101 Q 11101 R 01010 S 10100 T 00001 U 11100 V 01111 W 11001 X 10111 Y 10101 Z 10001 CR 00010 SPACE 00100
Parts of the ITA2 encoding standard.

In order to be able to distinguish between the character bit-bursts however the teletype systems use start and stop bit sequences. I found various sources online, which suggest different bit sequences. The ones I have used are based on the information provided by this website. As I am not going to contact anyone I didn't really care so much about that. The following image shows a single character burst including start and stop bits. In my program the used start bit is "zero" and as a stop bit I use "one".

Baudot RTTY burst example, as shown in a number of radio-amateur websites.

The most common transmission scheme in the HF amateur bands for RTTY (Radio Teletype) is FSK. This is practically what all the amateur software encpding programs do, read text and "play" FSK bursts encoded in Baudot, when speaking about RTTY of course :). This is what my rusty program also does. Hear some burst examples:

Transmitting the string "I WILL BE BACK HOME SOON PLEASE LEAVE SOME WATER MELONS PEACHES APPRICOTS PLUMS AND GRAPES FOR ME TOO" using 10ms bit bursts with non-integer related shift frequencies (notice the hum/harmonics)
Transmitting the same string but with integer-related shift keying frequencies.
Transmitting the same string but at 100ms burst time.

You might hear the odd low frequency hum in one of the very short burst time samples. This apparently is caused by incorrect stitching of the dual tone sinewaves and can be fixed with proper tuning of the burst time and choice of frequencies such that no "odd stitching effect" appears anymore. Here is what "d-effect" I am referring to:

Sinewave "stitching d-effect" causing discontinuity and therefore harmonics and hum.

This can be fixed by choosing shift keying frequencies together with burst lengths which are integer numbers, for example, $$\frac{f_{FSK_{1}}}{f_{FSK_{2}}} = int$$

Stitching problem solved by using integer proportion shift keying sines, note there is still an issue.

There is still an inssue with my algorithm, I need to delete the last sample of the FSK sine before stitching the new sine, as now there are two repeating samples, which ideally should be one.

I am posting the source as well as the compiled program here, however I should warn you that the code is not very tidy nor efficient. I am basically generating a PCM file, which I then open with and listen to with audacity. I found this to be simplest and most painless format to use.

When importing the PCM you should use signed 16-bit mono, little-endian bit order settings. You can define the sampling frequency from the program, the default used in the precompiled program is 44.1 kHz, however you can choose your own, you will see also some self-explanatory definitions for ZERO_FREQUENCY, ONE_FREQUENCY, SAMPLING_FREQUENCY, BURST_LENGTH etc... The program is reading from a text file named xmit.txt and treats carriage returns as blank space. The file length is also controlled by the MAXTEXTLEN definition.

Link to ttygen and the source code.

Now a question arises, why is it always easier to build a transmitter than a receiver?. In pretty much every aspect in electronics, when you have to deal with transmitters/receivers it is almost always the case that the transmitter is easier to build. Now I have a new project idea, let's write some code which "receives" and decodes these generated transmission sequences ...

Maybe the next time my internet connection drops.

Date:Sun Jul 05 23:02:00 CEST 2014