Shop OBEX P1 Docs P2 Docs Learn Events
Parallax GPS Smart Mode — Parallax Forums

Parallax GPS Smart Mode

MRLindstromMRLindstrom Posts: 2
edited 2010-03-16 02:55 in General Discussion
Hello,

I am trying to interface the Parallax GPS Receiver with an Arduino Duemilanove board. The Arduino itself has 2 pins for serial communications. The GPS receiver only has the single I/O pin. I have attached both the TX/RX pins of the Arduino to the single SIO pin on the GPS and have tried issuing "smart" commands by sending "!GPS" (minus the quotes) and a single byte of data equivalent to a 1 in decimal. I also have an LCD hooked up to the Arduino to display all data received on the serial RX port.

As I said before, the Arduino has 2 ports for serial communication. As such, whatever I send out on the TX port to the GPS is also read back at the RX port of the Arduino. This isn't so much of a problem as I can tell the Arduino to just disregard those first 4 bytes of information and only take the data after.

My problem, however, seems to be that the GPS is not responding to any of the requests for data that I send it. I have tested the board with the /RAW pin grounded and can see all of the RAW data come in on the Arduino's RX port so I know the GPS is working in that aspect. Does anyone have any ideas why it wouldn't be responding to my data requests?

Here is the code I am using:

#include <LiquidCrystal.h>

boolean requested = false;
int byteRead = 0;

LiquidCrystal lcd(12, 11, 10, 4, 5, 6, 7);

byte getValid = B00000001;
byte getVersion = B00000000;
byte getTime = B00000011;
byte getDate = B00000100;

void  setup() {
  Serial.begin(4800);
  lcd.begin(16,2);
  lcd.clear();
}

void loop() {
  while (!requested) {
    Serial.print("!GPS");
    Serial.write(getValid);
    requested = !requested;
  }
  while (requested) {
    lcd.clear();
    while (Serial.available()) {
      lcd.setCursor(0, 0);
      byteRead = Serial.read();
      lcd.print("Received: ");
      lcd.print(byteRead, DEC);
      delay(1000);
      lcd.clear();
    }
    requested = !requested;
  }
}

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-03-15 20:58
    You can't connect it that way. The Arduino's transmit pin will prevent the GPS receiver from sending its data. What you can do is to connect the Arduino's transmit pin through a diode to its receive pin. Use a diode like the 1N914 or equivalent switching diode and connect its cathode to the transmit pin and its anode to the receive pin and the GPS receiver's data line. When the Arduino's transmit line is at idle (high), it won't affect either the receive pin or the GPS data line. When the Arduino's transmit line goes low briefly to send data, it will pull the receive pin and GPS data line low which is what you want.
  • MRLindstromMRLindstrom Posts: 2
    edited 2010-03-16 02:55
    Thank you very much for the diode suggestion, working like a champ.
Sign In or Register to comment.