Reading NMEA over serial

Hi Everyone,

First project, first post so ge easy on me.

I'm trying to read NMEA data from a device and print it in the serial monitor.

I'm using a Garmin 60CS GPS to generate the NMEA sentence but would like to be able to read other NMEA devices as well.

I have the GARMIN hooked up to an Arduino Micro through a MAX232 chip.

I have tried all sorts of code that I have been able to find online but I am not getting anything at all up on the screen.

Does anyone have a really simple sketch that will just collect the NMEA sentence and print it to the serial monitor? At this stage I dont want to do anything with the sentence other than view it. (baby steps)

I have been using the software serial as an input from the MAX232.

Not sure if it is the code or the wiring but I have.

GPS Ground to Arduino Ground
GPS Tx to Max 232 Rxin

Max232 TTL out to Arduino pin 2 (Software serial Rx)

The max232 also has 5V and groud connections as well as the capacitors as per the manufacturers circuit.

Any help would be appreciated.

To start, should be able to see the data:

if (softwareSerial.available()>0){
incomingyByte = softwareSerial.read();
Serial.print(incomingByte);
}

with softwareserial equivalents for the first 2 lines

Are you sure that the device is emitting data? IIRC, the one I had needed to be configured to do so.

Can you test it on a PC first?

Hi there,

Thanks for the comments so far.

I have put the following code together but still no success.

In the serial screen :

I get a timer result in full seconds (indicating serial window is recieving OK).
I get a confirmation message that the software serial is listening on the correct pin.

But no milliseconds result (indicationg that I am not getting in to the IF loop)
And no NMEA sentence (probably because I am not getting in to the IF loop)

The GPS is set to NMEA transmission and I can pick up some output from the MAX232 chip with a volt meter so I think there is something being sent but I cant seem to get the sketch to acknowledge. I have also tried with the NMEA output from the speed/depth instrument on the boat and no result there either.

Can anyone see why???

/*
Sketch to read and print NMEA sentence from Garmin 60CS
GPS data out pin connected to Arduino pin 2
GPS data in pin connected to Arduino pin 3
GPS ground connected to Arduino ground

*/


#include <SoftwareSerial.h>

#define rxPin 2
#define txPin 3

SoftwareSerial gps = SoftwareSerial(rxPin,txPin);


void setup()
{

  pinMode(rxPin, INPUT);
  pinMode(txPin, OUTPUT);

  gps.begin(4800); 
  Serial.begin(9600);

}

void loop(){

  char incomingByte;

  Serial.println(millis()/1000);  //for debugging to see that the serial port is open

  if (gps.isListening()){         //check if software serial is listening and confirm pins
    Serial.print("Port Rx=");
    Serial.print(rxPin);
    Serial.print(", Tx=");
    Serial.print(txPin);
    Serial.println(" is listening");
  }


  if (gps.available()>0){             //capture NMEA sentence and print to serial window

    Serial.println(millis());      //for debugging to see if the IF loop is entered
    incomingByte = gps.read();
    Serial.print(incomingByte);

  }
  delay(1000);

}
[code]

[/code]

WAG -- Have you tried swapping the rx/tx at the Arduino?

You should be able to see evidence of data/activity from the MAX's "TTL" (CMOS?) output by connecting
an LED with a series resistor, 1K, between TTL data out and +5V.

[For troubleshooting, that MAX TTL_data_out could go to Arduino RX, D0, (instead of the softwareserial arrangement) - with no connection to TX (D1), Serial Monitor will still work. Disconnect GPS from Arduino when uploading a sketch though.]

MAX_TTL_out -----1K?---K_A---- +5V

Previous post on the subject that might be worth reading.

https://www.google.com/search?as_q=nmea&as_epq=&as_oq=&as_eq=&as_nlo=&as_nhi=&lr=&cr=&as_qdr=all&as_sitesearch=http%3A%2F%2Fforum.arduino.cc%2Findex&as_occt=any&safe=images&tbs=&as_filetype=&as_rights=