interfacing GPS receiver

Hi to all,
I’m trying to interface arduino to gps receiver following this playground script: ([w_w_w]arduino.cc/playground/Tutorials/GPS)

I have a serius serial comunication problem…
when I try to read data from receiver I read something like that:

:... N:>&N.
NæxüxüÌ??øxüÌx
øxÌàø?øxüx<æ

lSÖnâù?Éeå?3þú/
jjB
åÑ?
AM¥jjjzz
j?
âkjjB
åÑ?
AM¥µjjâ
þnÿú·íº ...

I tried to simplify code of script and I sent to arduino this one:

 #include <string.h>
 #include <ctype.h>
 int ledPin = 13;                  // LED test pin
 int rxPin = 0;                    // RX PIN 
 int txPin = 1;                    // TX TX
 int byteGPS=-1;

  
 void setup() {
   pinMode(ledPin, OUTPUT);       // Initialize LED pin
   pinMode(rxPin, INPUT);                               
   pinMode(txPin, OUTPUT);                               
   Serial.begin(4800);                                    
   for (int i=0;i<70;i++){       // Initialize a buffer for received data
     linea[i]=' ';
   }   

 }
 void loop() {
   digitalWrite(ledPin, HIGH);               // light led
   byteGPS=Serial.read();                    // Read a byte of the serial port
   Serial.print(" //---(byteGPS)---// ");    // write a prescript
   Serial.print(byteGPS);                    // write databit
   Serial.print(" \\---(byteGPS)---\\ ");    // write postscript
   digitalWrite(ledPin, LOW);                // unled light
   delay(300);                               // wait
 }

In this way I tried to read a single databit from receiver, but I read only value ‘-1’, as default value… :frowning:

My gps receiver is a Lorentz active receiver and you can find some specifs on this link: ([h_t_t_p]ordering.tmq.com.au/docs/catalogue/GPS-12WM.pdf)

I connected:
gnd gps pin → gnd arduino
tx pin → i/o 1 on arduino

The manual specify:
input voltage: 10-35 Vcd
electrical interface: TTL voltage levels, RS-232 polarity
DGPS format: RTCM SC-104, 4800bps (Type 1,2,7,9); Waas
Output format: NMEA-0183 Baud rate 4800 N81

I used 12Vdc input voltage that produce on wires connected to arduino, a variable 0.60mA current with 0-2V in a frequence about 1 sec.
thank for any suggestion…

Well… no idea if this is a good or helpful reply buuut…
I would say that you should try a softserial library for what you have in mind. From my experiments with my GPS module i can say that i have experienced all kinds of weird results when it was wired like you describe it there - especially if you have the arduino also connected to the pc! (it ‘shares’ the RX and TX Data from the Ports 0 and 1 with the Serial interface as far as i understand… that way i got a GPS mouse ><).
Also you could check if Serial.Available() before reading, this might be another problem…

Out of curiosity: Why do you try to get a single Byte from the NMEA sentence each 300ms?

I do not mean to insult you my this suggestion - but have you verified what baud rate you're connecting to the arduino from your terminal program? (probably the Arduino IDE.)

The Arduino IDE defaults to 9600 (if you haven't changed it), and I noticed that you're using 4800 - so it might be as simple as choosing 4800 from the baud rate dropbox in the IDE.

The manual says "TTL voltage levels, RS232 polarity". this means you need an inverter on the RX and TX lines.

-j