Earthmate II

ok, I am pulling my hair out here and I need some help. I have an earthmate II gps unit that I am trying to get to communicate with the arduino. I found the pinout information online to add the serial connection to the existing connector. I have done this and it works perfectly when plugged into the serial port on the computer. It spits out NMEA data with no issues. Now I assume that a simple serial.read() with SoftwareSerial should be able to recieve this data and spit it back out through the usb cable going to the computer… or am I completely nuts?

here is a link with a picture of the current circuit. please ignore the thing that looks like a transistor its a one-wire thermestor which will be added back into the code once I get this working :wink:
http://www.fighting4sanity.com/documents/project/100_0889.jpg

here is the code:

#include <SoftwareSerial.h>

#define rxPin 7 //device tx
#define txPin 8 //device rx
#define DTR 4

SoftwareSerial mySerial = SoftwareSerial(rxPin,txPin);

char gpsData[301];
int i;

void setup(){
  pinMode(rxPin, INPUT);
  pinMode(txPin, OUTPUT);
  pinMode(DTR, OUTPUT);
  digitalWrite(DTR,HIGH);
  mySerial.begin(4800);
  Serial.begin(9600);
}

void loop(){
 for(i=0; i<=300; i++){
  gpsData[i] = mySerial.read();
 }
 Serial.print(gpsData);
 Serial.println();
 Serial.println();

}

here is a screen shot of the gibberish I get
http://www.fighting4sanity.com/documents/project/screenshot.jpg

and here is the pinout information for the device. It explains the DTR pin, but basically it needs to be high for the gps to be on
http://www.fighting4sanity.com/documents/project/gps%20pins.txt

Any help you can offer would be greatly appreciated.

One potential problem i see is that in your Void loop() you read data without waiting or anything

The Arduino boards processor is running at 16 Mhz so yo are trying to read data very very fast. The soft serial lib. does nothave a "seria lavailable" function, which would have been very nice in this case.

I don't know if tthis is your problem, but the way your code is now, it will try to read 301 bytes of data no matter if it is available or not, and it wil do so continously and very fast.

ok that makes since, next question would be since my understanding of baud is limited, is there a good way to determine the timeing? secondly would I need to put in a delay after each byte read also? or would waiting for the serial to be available be enough?

Also, the SoftwareSerial read function, does that not work the same way that the regular serial read function works. My understanding is that the read function waits for data to be sent before it proceeds....

It might be an idea to start with the Earthmate connected to the Arduino's "ordinary", buffered, serial port (pins 0 and 1). Get things working there, and then move to other pins.

Divide and conquer?

A normally-closed pushbutton switch on the data from the Earthmate to the Arduino, or even both lines, can be handy for interrupting "things" from the Earthmate coming in while your PC is uploading a new program to the Arduino.

ok... I connected to the serial read and I am still getting gibberish... I must have missed something

the device works connected to the serial port on the computer at 4800/8/n/1

any ideas?

I am not clear how you have this connected. It sounds like you are using RS232 level lines (plus/minus 5 volts or more) that work when connected to a PC, to connect to digital pins on an Arduino. You would need a serial to TTL adapter to get the correct signal levels into the Arduino, are you using one and if so are you sure its working correctly?

Also, I had a very early Earthmate years ago and I think it needed the output looped back to the input in order work correctly. Hyperterminal may be echoing the signal but the Arduino doesn't do that, you may want to check if you need to wire the GPS input and output together to echo the data.

I am not clear how you have this connected. It sounds like you are using RS232 level lines (plus/minus 5 volts or more) that work when connected to a PC, to connect to digital pins on an Arduino. You would need a serial to TTL adapter to get the correct signal levels into the Arduino, are you using one and if so are you sure its working correctly?

Also, I had a very early Earthmate years ago and I think it needed the output looped back to the input in order work correctly. Hyperterminal may be echoing the signal but the Arduino doesn't do that, you may want to check if you need to wire the GPS input and output together to echo the data.

So my assumption that the serial data that is coming out is readable by softwareSerial is where I went astray because I am not using a TTL adapter. I will look into getting one, thanks

If you have a spare npn transistor and a few resistors lying around you can probably make one. Have a search for schematics for the Arduino/Freeduino serial boards to see some examples. Also, if I recall correctly, the sense of the signal is reversed between RS232 levels and TTL levels and that may explain the gibberish. The simple one transistor converters will reverse the sense as well as ensure the voltage levels are correct.

If you have a spare npn transistor and a few resistors lying around you can probably make one. Have a search for schematics for the Arduino/Freeduino serial boards to see some examples. Also, if I recall correctly, the sense of the signal is reversed between RS232 levels and TTL levels and that may explain the gibberish. The simple one transistor converters will reverse the sense as well as ensure the voltage levels are correct.

DUDE YOU ROCK!!!

that was exactly what the problem was. I found this schematic and used the rs232 to ttl section, now its working http://www.uchobby.com/index.php/2007/06/11/ttl-to-rs232-adaptor-explained/

thanks for the help!!!