[Radio] RTTY

here.

Tell me how it works

Easy: a “low beep” is a binary 0, a “high beep” a binary 1. Then if you emit every 0.02 seconds either one of these beeps, you can make up a data string in a “ASCII” way. For instance: “1010100” is the character “T”. Repeating this same method you can make any data transmission you want. (For more (historic) information see wikipedia)

How i have used this before

The beeps you are hearing (brrrzzz brzzzz) is actually the “RTTY” as i receive it from a radio receiver. Then i put that in the audiojack of my computer, which analyzes the sound and converts the beeps into bits and then into readable characters! That way i knew GPS information of the autonomous balloon. http://www.youtube.com/watch?v=3NrmeVZ1j8g&start=154

Also cool: Optic RTTY

This uses the same code as for the radio, but the medium now is not radio waves, but light. You could use light of different wavelengths to separate the data that is transmitted. http://www.youtube.com/watch?v=Foa989eyG6Q&feature=channel_video_title&start=26

Code

So you can either hook up two leds or a radio to the two corresponding pins. For hooking up a radio you can check this page.
  1. // Project Hollands Hoogte © July 2010
  2. // RTTY (original i believe by J. Coxon)
  3. // Digital Pins
  4. #define RTTY_PIN_1 		5	// RTTY space pin
  5. #define RTTY_PIN_2 		6	// RTTY mark pin
  6. #define RTTY_LED                30      // RTTY busy led
  7. // Misc
  8. #define RTTY_ASCII      7       // ASCII set for RTTY (7/8bit)
  9. void setup() {
  10.   Serial.begin(9600);
  11.   pinMode(RTTY_LED, OUTPUT);
  12.   // Setup for RTTY
  13.   pinMode(RTTY_PIN_1, OUTPUT);
  14.   pinMode(RTTY_PIN_2, OUTPUT);
  15. }
  16. void loop() {
  17.         TxString("abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()");
  18. }
  19. // Calculates the checksum for a given string
  20. // returns as integer
  21. int getCheckSum(char *string) {
  22.   int i;
  23.   int XOR;
  24.   int c;
  25.   // Calculate checksum ignoring any $'s in the string
  26.   for (XOR = 0, i = 0; i < strlen(string); i++) {
  27.     c = (unsigned char)string[i];
  28.     if (c == '*') break;
  29.     if (c != '$') XOR ^= c;
  30.   }
  31.   return XOR;
  32. }
  33. // ------ RTTY ----------
  34. // Transmit a string, log it to SD & produce debug output
  35. void TxString(char *string) {
  36.   digitalWrite(RTTY_LED, HIGH);
  37.   // Checksum
  38.   char txSum[4];
  39.   int checkSum = getCheckSum(string);
  40.   sprintf(txSum, "%02X", checkSum);
  41.   rtty_txstring(string);
  42.   rtty_txstring("*");
  43.   rtty_txstring(txSum);
  44.   rtty_txstring("rn");
  45.   digitalWrite(RTTY_LED, LOW);
  46. }
  47. // Transmit a string, one char at a time
  48. void rtty_txstring (char *string) {
  49.   for (int i = 0; i < strlen(string); i++) {
  50.     rtty_txbyte(string[i]);
  51.   }
  52. }
  53. // Transmit a byte, bit by bit, LSB first
  54. // ASCII_BIT can be either 7bit or 8bit
  55. void rtty_txbyte (char c) {
  56.   int i;
  57.   // Start bit
  58.   rtty_txbit (0);
  59.   // Send bits for for char LSB first
  60.   for (i=0;i<rtty_ASCII;i++) {
  61.     if (c & 1) rtty_txbit(1);
  62.     else rtty_txbit(0);
  63.     c = c >> 1;
  64.   }
  65.   // Stop bit
  66.   rtty_txbit (1);
  67. }
  68. // Transmit a bit as a mark or space
  69. void rtty_txbit (int bit) {
  70.   if (bit) {
  71.     // High - mark
  72.     digitalWrite(RTTY_PIN_1, HIGH);
  73.     digitalWrite(RTTY_PIN_2, LOW);
  74.   }
  75.   else {
  76.     // Low - space
  77.     digitalWrite(RTTY_PIN_2, HIGH);
  78.     digitalWrite(RTTY_PIN_1, LOW);
  79.   }
  80.   // Delay, not tuned to 50baud, but you can tune this
  81.   delay(19);
  82.   delayMicroseconds(250);
  83. }
]]>

You may also like...