Wednesday 9 November 2011

RTTY Library for the Arduino

Just finished making an Arduino library for use with normal UKHAS style setups.
Links to a demo file here, as well as the RTTY.h and RTTY.cpp files.

This library supports ASCII 7 or 8 bit, 1 or 2 stop bits, 50 or 300 baud speeds and has XOR checksums using USB type transmissions. Which is fairly standard and a good starting point for HAB projects.

Many people have code which uses most of this already, though this library is more for a quick fire HAB project or for easy beginners starting a project.
Only two lines of code should cover the setup and calling of a RTTY transmission.

The RTTY.h and RTTY.cpp files need to be placed inside a new folder called RTTY inside the arduino/libraries directory.

Thanks to Tim Zaman for the initial inspiration to create the library, and for the usual UKHAS crew for the code, ideas and their help as always :-)
(Project Horus, RJHarrison & JCoxon)

Example sketch code is similar to:


#include <RTTY.h>
// create the rtty object with following parameters:
// Mark_Pin, Space_Pin, ASCII (7 or 8), Num Stop Bits (1 or 2), Baud (50 or 300)
RTTY rtty(4,5,7,1,50);

// our sprintf buffer
char superbuffer[100]="";
void setup()
{
  Serial.begin(9600);
  Serial.println("Startup");
}

void loop()
{
  //$$callsign,txcount,hour,min,secs,lat,lon,alt
  sprintf(superbuffer, "$$CallSign,%d,%02d:%02d:%02d,%s,%s,%d", rtty.txCount(), 12, 00, 20, "52.2", "0.09", 485);
  rtty.TxString(superbuffer);
 
  //we can print the current tranmission counts:
  Serial.println(rtty.txCount());
}

No comments:

Post a Comment