[Radio] Baudot

Summary

The common ASCII code is in 8 bits, which means 8 beeps and 2^8 possible characters. Baudot though is in 5bit, and has only 2^5=32 possible combinations. 5 bits per byte is very little, which is great for radio performance. Though 32 is too little to fit in the alphabet and all the numbers (which we primarilly need), so it uses a bitcombination within that 32 that switches between numbers and the alphabet.

Read more about Baudot here.

Parts list

  • Radiotransmitter
  • Radioreceiver
  • FLDIGI.exe
  • Arduino or equivalent

C++/Arduino Code:
/* RTTY Code
Copyright (C) 2010 HoHoHo-II
Many or most of the smart credits in this code go out to Daniel Richman.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/

#include

#define ARRAY_LEN 32
#define LETTERS_SHIFT 31
#define FIGURES_SHIFT 27
#define LINEFEED 2
#define CARRRTN 8

#define is_lowercase(ch) ((ch) >= 'a' && (ch) = 'A' && (ch) <= 'Z')

unsigned long time;

char letters_arr[33] = "00E\nA SIU\rDRJNFCKTZLWHYPQOBG00MXV00";
char figures_arr[33] = "003\n- \a87\r$4',!:(5\")2#6019?&00./;00";

void setup(){
Serial.begin(9600);
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
}

void loop(){

time=millis();
rtty_txstring("$$TBL,167,12:13:14,52.7933,5.1163,14378#3A\r\n");
time=millis()-time;
Serial.println(time);
delay(200);
}

uint8_t char_to_baudot(char c, char *array)
{
int i;
for (i = 0; i = 0; i--) */
for (i = 0; i < 5; i++)
{
if (b & (1 << i))
rtty_txbit(1);
else
rtty_txbit(0);
}

rtty_txbit(1);
}

enum baudot_mode
{
NONE,
LETTERS,
FIGURES
};

void rtty_txstring(char *str)
{
enum baudot_mode current_mode = NONE;
char c;
uint8_t b;

while (*str != '')
{
c = *str;
/* some characters are available in both sets */
if (c == '\n')
{
rtty_txbyte(LINEFEED);
}
else if (c == '\r')
{
rtty_txbyte(CARRRTN);
}
else if (is_lowercase(*str) || is_uppercase(*str))
{
if (is_lowercase(*str))
{
c -= 32;
}

if (current_mode != LETTERS)
{
rtty_txbyte(LETTERS_SHIFT);
current_mode = LETTERS;
}

rtty_txbyte(char_to_baudot(c, letters_arr));
}
else
{
b = char_to_baudot(c, figures_arr);

if (b != 0 && current_mode != FIGURES)
{
rtty_txbyte(FIGURES_SHIFT);
current_mode = FIGURES;
}

rtty_txbyte(b);
}

str++;
}
}

 

// Transmit a bit as a mark or space
void rtty_txbit (int bit) {
if (bit) {
// High - mark
digitalWrite(2, HIGH);
digitalWrite(3, LOW);
}
else {
// Low - space
digitalWrite(3, HIGH);
digitalWrite(2, LOW);
}
// Delay appropriately - tuned to 50 baud.
delay(20);
//delayMicroseconds(250);
}

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: