Go Down

Topic: Interfacing an Altimeter that has Serial Output (Read 1 time) previous topic - next topic


I have a question, I have no experience with inputing data from hardware. So, in the user manual of the PerfectFlite Stratto Logger Altimeter, under the 'Telemetry output' section:

The StratoLogger has an on-board data connector that is used for real time data output during flight using the telemetry feature

Serial port settings should be configured for 9,600BPS, 8 data bits, no parity, and 1 stop bit.  Output data format from the altimeter is ASCII text based, with a <CR> and <LF> character appended to the end of each line.

When telemetry data is selected to start "OnLaunch", all data will be AGL (above ground level) altitudes:
198<CR><LF>   {all data points are AGL altitude}

So I was hoping that some of you could kinda guide me on the part of getting the data into the altimeter. Specially on the part of 9600BPS and 8 data bits, no party and 1 stop bit. What does this all mean

I also don't quite understand that 'the format of the altimeter is ASCII text based'. According to http://www.arduino.cc/en/Reference/ASCIIchart , ASCII is used to encode text into numerical values, but an altimeter does not measure in letters, it measures in numbers (feet or meters)...

If you are reading this and can help in anything of the above it will be greatly appreciated. Thank you.


in void setup.  Default settings are 8 data bits, 1 stop  bit, no parity. Check out RS232 at wikipedia.com for an explanation of serial data transfers.

Check out asciitable.com

If you were to look at the data actually transmitted, you would see 5 bytes of hex code for every line above. The 1, 9, 8, <CR>, <LF> all
have a hex equivelent,  your arduino will receive and those and make decisions as to what to do with the data.
198<CR><LF> would come out as 0x31 0x39 0x38 0x0D 0x0A, where 0x signifies hex data.

So you would have your code look for data, something like this
Code: [Select]

if (Serial.available()>0){ // did at least 6 bytes come in?
incomingByte = Serial.read; // read the first character
   if (incomingByte == 0x0A){  // ignore bytes that aren't end of a block of 5 to get in sync
      while (Serial.available <4){ //saw good LF, wait for 5 bytes to come in
      // 5 bytes are in, read them:
        byte0 = Serial.read();  //read hundreds digit
        byte1 = Serial.read();  // read tens digit
        byte2 = Serial.read(); // read ones digit
        byte3  = Serial.read();  // CR
        byte4 = Serial.read(); // LF
       } // end while
      // do something with the data
    } // end 0x0A check
}  // end serial.available check
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.


CrossRoads' code is a good start, but it won't work.  The data isn't a fixed 3 column field; you'll need to be able to deal with varying length numbers.

Here's some code I wrote that reads positive integers.

Code: [Select]
#define isdigit(X) (((X) >= '0') && ((X) <= '9')

int read_int()
  static byte c;
  static int i;

  i = 0;
  while (1)
    while (!Serial.available())

    c = Serial.read();
    Serial.print(c, BYTE);
    if (c == '\r')
      return i;
    if (isdigit(c))
      i = i * 10 + c - '0';
      Serial.print("\r\nERROR: \"");
      Serial.print(c, BYTE);
      Serial.print("\" is not a digit\r\n");
      return -1;

Hopefully the stratologger doesn't throw commas in there when you get >10,000'...



Note that the manual also states that it is a 3.3V interface.


I was wondering if anyone ever figured out the code for reading the data from a stratologger device in a way that recognizes it as integers so  you can apply some math to the values being transmitted.  I've tried a number of things using the great input posted on Aduino Forum but I'm too much of a newbie to figure it out.  Any thoughts and I'll keep trying!

Go Up