How to connect an altimeter that has a serial output.

dkim360:
Ah okay thanks. I did try connecting the TX pin of the altimeter to the RX pin of the Arduino. It said uploading, but never did. Any ideas?

When you set up the altimeter parameters with the PC program you had to tell it when to begin sending telemetery. What did you set it to? And have you activated what ever you set it to? If that has not taken place your altimeter will never begin to transmit and when that setting becomes true, the altimeter will just begin to dump data. Or at least that is what the manual indicates.
You are powering the altimeter?
Paul

cattledog:
What pin is connected to the TXpin of the altimeter?
Please post the code you are using to read the sensor.

Did you enable Telemetry as discussed on page 27 of the manual.

So I connected the TX pin of the altimeter to the RX (d. pin 0) of the arduino Mega. I did post the code before but here it is again. And yes I did enable telemetry.

int foo; // Useless declaration to molify the IDE
#define isdigit(X) (((X) >= '0') && ((X) <= '9'))

void setup()
{
  Serial.begin(9600);
}

void loop()
{
int AGL=read_int();
// Do math
}


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

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

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

Paul_KD7HB:
When you set up the altimeter parameters with the PC program you had to tell it when to begin sending telemetery. What did you set it to? And have you activated what ever you set it to? If that has not taken place your altimeter will never begin to transmit and when that setting becomes true, the altimeter will just begin to dump data. Or at least that is what the manual indicates.
You are powering the altimeter?
Paul

So I set it up by connecting the altimeter to my PC, opening the software and setting it to "OnPad" per the manual instructions and applied the new settings, and yes I am powering the altimeter.

So I connected the TX pin of the altimeter to the RX (d. pin 0) of the arduino Mega.

You were told to use one of the additional hardware serial ports of the Mega.

You can not be connected to pin0 and load code which explains the stalling at "uploading".

cattledog:
You were told to use one of the additional hardware serial ports of the Mega.

Serial - Arduino Reference

https://www.arduino.cc/en/Tutorial/BuiltInExamples/MultiSerialMega

You can not be connected to pin0 and load code which explains the stalling at "uploading".

Ah I see. So should I connect TX pin to the additional ports?

dkim360:
So I set it up by connecting the altimeter to my PC, opening the software and setting it to "OnPad" per the manual instructions and applied the new settings, and yes I am powering the altimeter.

And have you done this: "Connect a suitable ON/OFF switch to the altimeter’s power
switch terminals.".
Paul

dkim360:
Ah I see. I looked into it and it really isn't documented. Thanks!

The Vih on a 2560 (e.g.) is 0.6xVCC. For a 5V rail that's 3.0V so a 3.3V input should be good.

If you're using a different processor you should check the processor datasheet DC Electrical characteristics table.

Paul_KD7HB:
And have you done this: "Connect a suitable ON/OFF switch to the altimeter’s power
switch terminals.".
Paul

Yes it came with a jumper on it.

dkim360:
Ah I see. So should I connect TX pin to the additional ports?

So I used TX 1and RX 1 and used the code. I did finally get something out of the serial monitor. But its just spitting out 56 and 57 not the ASCII format.

But its just spitting out 56 and 57 not the ASCII format.

Post the code reading Serial1 and echoing the reading to Serial. The previously posted code will not do that, and is pretty wrong in several ways.

You really need to take a look as some tutorials about how to read Serial.

Try this example code

void setup() {
  // initialize both serial ports:
  Serial.begin(9600);
  Serial1.begin(9600);
}

void loop() //read from port 1, echo Serial monitor:
  
{
  if (Serial1.available()) {
    char inByte = Serial1.read();
    Serial.print(inByte);
  }
}