Pages: [1]   Go Down
Author Topic: GPS UP501 Connected to an Arduino, No Data Stream  (Read 1804 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I connected my GPS UP501 from Fastrax to my Arduino Leonardo and used the following code:
// Test code for Adafruit GPS modules using MTK driver
// such as www.adafruit.com/products/660
// Pick one up today at the Adafruit electronics shop
// and help support open source hardware & software! -ada
//  #if (ARDUINO >= 100)
#define rxPin 2
#define txPin 3
#include <SoftwareSerial.h>
SoftwareSerial mySerial(rxPin, txPin);
//  #else
// If you're using Arduino IDE v23 or earlier, you'll
// need to install NewSoftSerial
//#include <NewSoftSerial.h>
//NewSoftSerial mySerial(2, 3);
//  #endif

// Connect the GPS Power pin to 3.3V
// Connect the GPS Ground pin to ground
// Connect the GPS VBAT pin to 3.3V if no battery is used
// Connect the GPS TX (transmit) pin to Digital 2
// Connect the GPS RX (receive) pin to Digital 3
// For 3.3V only modules such as the UP501, connect a 10K
// resistor between digital 3 and GPS RX and a 10K resistor
// from GPS RX to ground.

// different commands to set the update rate from once a second (1 Hz) to 10 times a second (10Hz)
#define PMTK_SET_NMEA_UPDATE_1HZ  "$PMTK220,1000*1F"
#define PMTK_SET_NMEA_UPDATE_5HZ  "$PMTK220,200*2C"
#define PMTK_SET_NMEA_UPDATE_10HZ "$PMTK220,100*2F"

// turn on only the second sentence (GPRMC)
#define PMTK_SET_NMEA_OUTPUT_RMCONLY "$PMTK314,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29"
// turn on ALL THE DATA
#define PMTK_SET_NMEA_OUTPUT_ALLDATA "$PMTK314,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0*28"

// to generate your own sentences, check out the MTK command datasheet and use a checksum calculator
// such as the awesome http://www.hhhh.org/wiml/proj/nmeaxor.html

void setup()  
{
  Serial.begin(57600);
  while(!Serial)
  {//This waits for the serial port of the Leonardo to connect.
  }
  Serial.println("Test for Leonardo and Computer Communication\n");

  // 9600 NMEA is the default baud rate
  mySerial.begin(9600);
  
  // uncomment this line to turn on only the "minimum recommended" data for high update rates!
  //mySerial.println(PMTK_SET_NMEA_OUTPUT_RMCONLY);

  // uncomment this line to turn on all the available data - for 9600 baud you'll want 1 Hz rate
  mySerial.println(PMTK_SET_NMEA_OUTPUT_ALLDATA);
  
  // Set the update rate
  // 1 Hz update rate
  mySerial.println(PMTK_SET_NMEA_UPDATE_1HZ);
  // 5 Hz update rate- for 9600 baud you'll have to set the output to RMC only (see above)
  //mySerial.println(PMTK_SET_NMEA_UPDATE_5HZ);
  // 10 Hz update rate - for 9600 baud you'll have to set the output to RMC only (see above)
  //mySerial.println(PMTK_SET_NMEA_UPDATE_10HZ);

}

void loop()                     // run over and over again
{
  if (mySerial.available()) {
      Serial.print((char)mySerial.read());
  }
  if (Serial.available()) {
      mySerial.print((char)Serial.read());
  }

}


Unfortunately all I see is the Test for Leonardo and Computer Communication message and then it stops transmitting and the transmit light does not appear. I was wondering if anyone had any advice. (Some additional information I am using an Arduino Leonardo us the Mac OS X and used the wiring diagram from adafruit.)
« Last Edit: November 18, 2012, 07:52:10 pm by unh2013 » Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 644
Posts: 50486
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I connected my GPS UP501 from Fastrax to my GPS
How did you connect your GPS to your GPS?

Which GPS (aka Arduino) do you have?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry, my mistake I connected my GPS receiver to my Arduino Leonardo.  I have a Fastrax UP501 GPS module and I followed the connection diagram from www.adafruit.com/products/660.
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 644
Posts: 50486
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

http://arduino.cc/en/Guide/ArduinoLeonardo
Quote
Separation of USB and serial communication.

On the Leonardo, the main Serial class refers to the virtual serial driver on the Leonardo for connection to your computer over USB. It's not connected to the physical pins 0 and 1 as it is on the Uno and earlier boards. To use the hardware serial port (pins 0 and 1, RX and TX), use Serial1. (See the Serial reference pages for more information.)
I'd suggest changing the connection to the hardware serial pins, and using Serial1 to read from the GPS, not SoftwareSerial.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I might have come up with an answer to this one:

http://forum.arduino.cc/index.php?topic=223918.0

It's about using hardware serial on the Mega, uses a wiring example like Adafruit does in their tutorial.
There was an error in the example parsing code. Same in the 'echo' and leo_echo' examples.

Logged

Pages: [1]   Go Up
Jump to: